Skip to content

Commit

Permalink
๐Ÿ”€ :: (#4) ํšŒ์›๊ฐ€์ž… ํผ๋ธ”๋ฆฌ์‹ฑ
Browse files Browse the repository at this point in the history
  • Loading branch information
HongSJae authored Apr 25, 2024
2 parents bf96d58 + 84dfaa2 commit f9ba81d
Show file tree
Hide file tree
Showing 66 changed files with 1,547 additions and 110 deletions.
3 changes: 0 additions & 3 deletions .swiftlint.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extension ModulePaths: MicroTargetPathConvertable {

public extension ModulePaths {
enum Feature: String, MicroTargetPathConvertable {
case SignupFeature
case SigninFeature
case SplashFeature
case RootFeature
Expand Down
3 changes: 3 additions & 0 deletions Projects/App/.swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
excluded:
- "Sources/Application/NeedleGenerated.swift"
- "Tuist"
24 changes: 24 additions & 0 deletions Projects/App/Sources/Application/DI/AppComponent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import SplashFeature
import SplashFeatureInterface
import SigninFeature
import SigninFeatureInterface
import SignupFeature
import SignupFeatureInterface

public final class AppComponent: BootstrapComponent {
// private let _keychain: any Keychain
Expand Down Expand Up @@ -36,4 +38,26 @@ public extension AppComponent {
var signinFactory: any SigninFactory {
SigninComponent(parent: self)
}
// Signup
var signupEmailVerifyFactory: any SignupEmailVerifyFactory {
SignupEmailVerifyComponent(parent: self)
}
var signupEmailAuthCodeVerifyFactory: any SignupEmailAuthCodeVerifyFactory {
SignupEmailAuthCodeVerifyComponent(parent: self)
}
var signupPasswordFactory: any SignupPasswordFactory {
SignupPasswordComponent(parent: self)
}
var signupNameFactory: any SignupNameFactory {
SignupNameComponent(parent: self)
}
var signupStudentIDFactory: any SignupStudentIDFactory {
SignupStudentIDComponent(parent: self)
}
var signupGenderFactory: any SignupGenderFactory {
SignupGenderComponent(parent: self)
}
var signupCheckLevelFactory: any SignupCheckLevelFactory {
SignupCheckLevelComponent(parent: self)
}
}
2 changes: 1 addition & 1 deletion Projects/App/Sources/Application/KillerGramApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import ViewUtil

@main
struct KillerGramApp: App {
@StateObject var appState = AppState(sceneFlow: .splash)
@ObservedObject var appState = AppStateProvider(sceneFlow: .splash, rule: .student)

init() {
DesignSystemFontFamily.registerAllCustomFonts()
Expand Down
158 changes: 150 additions & 8 deletions Projects/App/Sources/Application/NeedleGenerated.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import RootFeature
import RootFeatureInterface
import SigninFeature
import SigninFeatureInterface
import SignupFeature
import SignupFeatureInterface
import SplashFeature
import SplashFeatureInterface
import SwiftUI
Expand Down Expand Up @@ -33,6 +35,95 @@ private class SplashDependencye0cb7136f2ec3edfd60aProvider: SplashDependency {
private func factoryace9f05f51d68f4c0677e3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject {
return SplashDependencye0cb7136f2ec3edfd60aProvider()
}
private class SignupPasswordDependency778bf5389a70d7df6152Provider: SignupPasswordDependency {
var signupNameFactory: any SignupNameFactory {
return appComponent.signupNameFactory
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->SignupPasswordComponent
private func factorye93d1d56840ff97c674af47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return SignupPasswordDependency778bf5389a70d7df6152Provider(appComponent: parent1(component) as! AppComponent)
}
private class SignupEmailAuthCodeVerifyDependencyaf9da1ebf0e9e5f1b708Provider: SignupEmailAuthCodeVerifyDependency {
var signupPasswordFactory: any SignupPasswordFactory {
return appComponent.signupPasswordFactory
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->SignupEmailAuthCodeVerifyComponent
private func factoryb06be35aa893adde971bf47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return SignupEmailAuthCodeVerifyDependencyaf9da1ebf0e9e5f1b708Provider(appComponent: parent1(component) as! AppComponent)
}
private class SignupStudentIDDependencyc62f548e51245f5bf42dProvider: SignupStudentIDDependency {
var signupGenderFactory: any SignupGenderFactory {
return appComponent.signupGenderFactory
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->SignupStudentIDComponent
private func factorycca12bec445b4f4f6de7f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return SignupStudentIDDependencyc62f548e51245f5bf42dProvider(appComponent: parent1(component) as! AppComponent)
}
private class SignupGenderDependency65e2a6565372eb41f4acProvider: SignupGenderDependency {
var signupCheckLevelFactory: any SignupCheckLevelFactory {
return appComponent.signupCheckLevelFactory
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->SignupGenderComponent
private func factory997eaa831d16af15eee5f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return SignupGenderDependency65e2a6565372eb41f4acProvider(appComponent: parent1(component) as! AppComponent)
}
private class SignupCheckLevelDependencye4ec84c7d38354a454aeProvider: SignupCheckLevelDependency {


init() {

}
}
/// ^->AppComponent->SignupCheckLevelComponent
private func factory5b23127e837152346fdae3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject {
return SignupCheckLevelDependencye4ec84c7d38354a454aeProvider()
}
private class SignupNameDependency860534ba64c054146b7bProvider: SignupNameDependency {
var signupStudentIDFactory: any SignupStudentIDFactory {
return appComponent.signupStudentIDFactory
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->SignupNameComponent
private func factory71e8fa7f4327b1e25ed0f47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return SignupNameDependency860534ba64c054146b7bProvider(appComponent: parent1(component) as! AppComponent)
}
private class SignupEmailVerifyDependencyf9d372ac752ee19b78caProvider: SignupEmailVerifyDependency {
var signupEmailAuthCodeVerifyFactory: any SignupEmailAuthCodeVerifyFactory {
return appComponent.signupEmailAuthCodeVerifyFactory
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->SignupEmailVerifyComponent
private func factory3b1904c76335d70151ebf47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return SignupEmailVerifyDependencyf9d372ac752ee19b78caProvider(appComponent: parent1(component) as! AppComponent)
}
private class RootDependency3944cc797a4a88956fb5Provider: RootDependency {
var splashFactory: any SplashFactory {
return appComponent.splashFactory
Expand All @@ -50,15 +141,17 @@ private func factory264bfc4d4cb6b0629b40f47b58f8f304c97af4d5(_ component: Needle
return RootDependency3944cc797a4a88956fb5Provider(appComponent: parent1(component) as! AppComponent)
}
private class SigninDependencyde06a9d0b22764487733Provider: SigninDependency {


init() {

var signupEmailVerifyFactory: any SignupEmailVerifyFactory {
return appComponent.signupEmailVerifyFactory
}
private let appComponent: AppComponent
init(appComponent: AppComponent) {
self.appComponent = appComponent
}
}
/// ^->AppComponent->SigninComponent
private func factory2882a056d84a613debcce3b0c44298fc1c149afb(_ component: NeedleFoundation.Scope) -> AnyObject {
return SigninDependencyde06a9d0b22764487733Provider()
private func factory2882a056d84a613debccf47b58f8f304c97af4d5(_ component: NeedleFoundation.Scope) -> AnyObject {
return SigninDependencyde06a9d0b22764487733Provider(appComponent: parent1(component) as! AppComponent)
}

#else
Expand All @@ -67,13 +160,55 @@ extension AppComponent: Registration {

localTable["splashFactory-any SplashFactory"] = { [unowned self] in self.splashFactory as Any }
localTable["signinFactory-any SigninFactory"] = { [unowned self] in self.signinFactory as Any }
localTable["signupEmailVerifyFactory-any SignupEmailVerifyFactory"] = { [unowned self] in self.signupEmailVerifyFactory as Any }
localTable["signupEmailAuthCodeVerifyFactory-any SignupEmailAuthCodeVerifyFactory"] = { [unowned self] in self.signupEmailAuthCodeVerifyFactory as Any }
localTable["signupPasswordFactory-any SignupPasswordFactory"] = { [unowned self] in self.signupPasswordFactory as Any }
localTable["signupNameFactory-any SignupNameFactory"] = { [unowned self] in self.signupNameFactory as Any }
localTable["signupStudentIDFactory-any SignupStudentIDFactory"] = { [unowned self] in self.signupStudentIDFactory as Any }
localTable["signupGenderFactory-any SignupGenderFactory"] = { [unowned self] in self.signupGenderFactory as Any }
localTable["signupCheckLevelFactory-any SignupCheckLevelFactory"] = { [unowned self] in self.signupCheckLevelFactory as Any }
}
}
extension SplashComponent: Registration {
public func registerItems() {

}
}
extension SignupPasswordComponent: Registration {
public func registerItems() {
keyPathToName[\SignupPasswordDependency.signupNameFactory] = "signupNameFactory-any SignupNameFactory"
}
}
extension SignupEmailAuthCodeVerifyComponent: Registration {
public func registerItems() {
keyPathToName[\SignupEmailAuthCodeVerifyDependency.signupPasswordFactory] = "signupPasswordFactory-any SignupPasswordFactory"
}
}
extension SignupStudentIDComponent: Registration {
public func registerItems() {
keyPathToName[\SignupStudentIDDependency.signupGenderFactory] = "signupGenderFactory-any SignupGenderFactory"
}
}
extension SignupGenderComponent: Registration {
public func registerItems() {
keyPathToName[\SignupGenderDependency.signupCheckLevelFactory] = "signupCheckLevelFactory-any SignupCheckLevelFactory"
}
}
extension SignupCheckLevelComponent: Registration {
public func registerItems() {

}
}
extension SignupNameComponent: Registration {
public func registerItems() {
keyPathToName[\SignupNameDependency.signupStudentIDFactory] = "signupStudentIDFactory-any SignupStudentIDFactory"
}
}
extension SignupEmailVerifyComponent: Registration {
public func registerItems() {
keyPathToName[\SignupEmailVerifyDependency.signupEmailAuthCodeVerifyFactory] = "signupEmailAuthCodeVerifyFactory-any SignupEmailAuthCodeVerifyFactory"
}
}
extension RootComponent: Registration {
public func registerItems() {
keyPathToName[\RootDependency.splashFactory] = "splashFactory-any SplashFactory"
Expand All @@ -82,7 +217,7 @@ extension RootComponent: Registration {
}
extension SigninComponent: Registration {
public func registerItems() {

keyPathToName[\SigninDependency.signupEmailVerifyFactory] = "signupEmailVerifyFactory-any SignupEmailVerifyFactory"
}
}

Expand All @@ -103,8 +238,15 @@ private func registerProviderFactory(_ componentPath: String, _ factory: @escapi
@inline(never) private func register1() {
registerProviderFactory("^->AppComponent", factoryEmptyDependencyProvider)
registerProviderFactory("^->AppComponent->SplashComponent", factoryace9f05f51d68f4c0677e3b0c44298fc1c149afb)
registerProviderFactory("^->AppComponent->SignupPasswordComponent", factorye93d1d56840ff97c674af47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SignupEmailAuthCodeVerifyComponent", factoryb06be35aa893adde971bf47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SignupStudentIDComponent", factorycca12bec445b4f4f6de7f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SignupGenderComponent", factory997eaa831d16af15eee5f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SignupCheckLevelComponent", factory5b23127e837152346fdae3b0c44298fc1c149afb)
registerProviderFactory("^->AppComponent->SignupNameComponent", factory71e8fa7f4327b1e25ed0f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SignupEmailVerifyComponent", factory3b1904c76335d70151ebf47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->RootComponent", factory264bfc4d4cb6b0629b40f47b58f8f304c97af4d5)
registerProviderFactory("^->AppComponent->SigninComponent", factory2882a056d84a613debcce3b0c44298fc1c149afb)
registerProviderFactory("^->AppComponent->SigninComponent", factory2882a056d84a613debccf47b58f8f304c97af4d5)
}
#endif

Expand Down
24 changes: 21 additions & 3 deletions Projects/Feature/BaseFeature/Sources/AppState.swift
Original file line number Diff line number Diff line change
@@ -1,9 +1,27 @@
import Foundation
import SwiftUI

public final class AppState: ObservableObject {
@propertyWrapper
public struct AppState: DynamicProperty {
@EnvironmentObject private var object: AppStateProvider

public var wrappedValue: AppStateProvider {
object
}

public init() { }
}

public final class AppStateProvider: ObservableObject {
@Published public var sceneFlow: SceneFlow
@Published public var rule: RuleExample

public init(sceneFlow: SceneFlow) {
public init(sceneFlow: SceneFlow, rule: RuleExample) {
self.sceneFlow = sceneFlow
self.rule = rule
}
}

public enum RuleExample {
case student
case manager
}
30 changes: 30 additions & 0 deletions Projects/Feature/BaseFeature/Sources/HideKeyboard.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import SwiftUI
import UIKit

public extension View {
func hideKeyboardWhenTap() -> some View {
onAppear(perform: UIApplication.shared.hideKeyboard)
}
}

public extension UIApplication {
func hideKeyboard() {
guard
let scene = connectedScenes.first as? UIWindowScene,
let window = scene.windows.first
else { return }
let tapRecognizer = UITapGestureRecognizer(target: window, action: #selector(UIView.endEditing))
tapRecognizer.cancelsTouchesInView = false
tapRecognizer.delegate = self
window.addGestureRecognizer(tapRecognizer)
}
}

extension UIApplication: UIGestureRecognizerDelegate {
public func gestureRecognizer(
_ gestureRecognizer: UIGestureRecognizer,
shouldRecognizeSimultaneouslyWith otherGestureRecognizer: UIGestureRecognizer
) -> Bool {
return false
}
}
5 changes: 4 additions & 1 deletion Projects/Feature/RootFeature/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ let project = Project.module(
.interface(module: .feature(.RootFeature)),
.implements(module: .feature(.RootFeature), dependencies: [
.feature(target: .RootFeature, type: .interface),
.feature(target: .BaseFeature)
.feature(target: .BaseFeature),
.feature(target: .SigninFeature, type: .interface),
// .feature(target: .MainFeature, type: .interface),
.feature(target: .SplashFeature, type: .interface)
]),
.tests(module: .feature(.RootFeature), dependencies: [
.feature(target: .RootFeature)
Expand Down
32 changes: 17 additions & 15 deletions Projects/Feature/RootFeature/Sources/RootView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import SigninFeatureInterface
import ViewUtil

struct RootView: View {
@EnvironmentObject var appState: AppState
@AppState var appState
private let splashFactory: any SplashFactory
private let signinFactory: any SigninFactory

Expand All @@ -19,23 +19,25 @@ struct RootView: View {
}

var body: some View {
ZStack {
switch appState.sceneFlow {
case .auth:
signinFactory.makeView().eraseToAnyView()
.environmentObject(appState)
NavigationView {
ZStack {
switch appState.sceneFlow {
case .auth:
signinFactory.makeView().eraseToAnyView()
.environmentObject(appState)

case .main:
EmptyView()
.environmentObject(appState)
case .main:
EmptyView()
.environmentObject(appState)

case .splash:
splashFactory.makeView().eraseToAnyView()
.environmentObject(appState)
case .splash:
splashFactory.makeView().eraseToAnyView()
.environmentObject(appState)
}
}
.background(Color.System.background.ignoresSafeArea())
.animation(.easeInOut, value: appState.sceneFlow)
.transition(.opacity.animation(.easeInOut))
}
.background(Color.System.background.ignoresSafeArea())
.animation(.easeInOut, value: appState.sceneFlow)
.transition(.opacity.animation(.easeInOut))
}
}
Loading

0 comments on commit f9ba81d

Please sign in to comment.