Skip to content

Commit ba61384

Browse files
author
Roy
committed
feat: 앱 기본 구조 및 디자인 시스템 구축
- App 모듈에 기본 앱 구조 추가 (AppDelegate, DiRegister, AppReducer, AppView) - Splash 화면 모듈 추가 - DesignSystem에 UI 컴포넌트들 추가 (버튼, 토스트, 알림, 폰트 등) - Utility 모듈에 공통 함수들 추가 - 기존 Base.swift 파일들 정리
1 parent 7fc12ac commit ba61384

52 files changed

Lines changed: 2817 additions & 56 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Plugins/DependencyPlugin/ProjectDescriptionHelpers/TargetDependency+Module/Modules.swift‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ public enum ModulePath {
2020
public extension ModulePath {
2121
enum Presentations: String, CaseIterable {
2222
case Presentation
23+
case Splash
2324

2425

2526
public static let name: String = "Presentation"

‎Plugins/ProjectTemplatePlugin/ProjectDescriptionHelpers/Project+Templete/ProjectConfig.swift‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public struct ProjectConfig {
1717
public static let projectName: String = "NomadSpot"
1818

1919
// MARK: - 📱 앱 정보 (자동 생성됨)
20-
public static let appName = projectName
20+
public static let appName = "노마드 스팟"
2121
public static let appDisplayName = projectName // 🎯 앱 화면에 표시될 이름
2222
public static let appStageName = "\(projectName)-Stage"
2323
public static let appProdName = "\(projectName)-Prod"

‎Plugins/ProjectTemplatePlugin/ProjectDescriptionHelpers/infoPlist/Project+InfoPlist.swift‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ public extension InfoPlist {
3838
]
3939
]
4040
])
41+
.setUIRequiredDeviceCapabilities(["armv7"])
42+
.setCFBundleDevelopmentRegion()
43+
.setBaseURL("$(BASE_URL)")
44+
.setUILaunchScreens()
45+
4146
)
4247

4348
static let moduleInfoPlist: Self = .extendingDefault(

‎Projects/App/Project.swift‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ let project = Project.makeAppModule(
1010
settings: .appMainSetting,
1111
scripts: [],
1212
dependencies: [
13-
.Presentation(implements: .Presentation)
13+
.Presentation(implements: .Presentation),
14+
.Data(implements: .Repository)
1415
],
1516
sources: ["Sources/**"],
1617
resources: ["Resources/**"],
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
//
2+
// AppDelegate.swift
3+
// NomadSpot
4+
//
5+
// Created by Wonji Suh on 3/1/26.
6+
//
7+
8+
import UIKit
9+
import WeaveDI
10+
11+
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
func application(
14+
_ application: UIApplication,
15+
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
16+
) -> Bool {
17+
18+
WeaveDI.Container.bootstrapInTask { @DIContainerActor _ in
19+
await AppDIManager.shared.registerDefaultDependencies()
20+
}
21+
22+
return true
23+
}
24+
25+
func application(
26+
_ application: UIApplication,
27+
configurationForConnecting connectingSceneSession: UISceneSession,
28+
options: UIScene.ConnectionOptions
29+
) -> UISceneConfiguration {
30+
return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
31+
}
32+
33+
func application(
34+
_ application: UIApplication,
35+
didDiscardSceneSessions sceneSessions: Set<UISceneSession>
36+
) {
37+
}
38+
}
Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
1+
12
import SwiftUI
23

4+
import ComposableArchitecture
5+
36
@main
4-
struct NomadSpotApp: App {
5-
var body: some Scene {
6-
WindowGroup {
7-
ContentView()
8-
}
7+
struct AttendanceApp: App {
8+
@UIApplicationDelegateAdaptor(AppDelegate.self) var appDelegate
9+
10+
init() {
11+
12+
}
13+
14+
var body: some Scene {
15+
WindowGroup {
16+
let store = Store(initialState: AppReducer.State()) {
17+
AppReducer()
18+
._printChanges()
19+
._printChanges(.actionLabels)
20+
}
21+
22+
AppView(store: store)
923
}
24+
}
1025
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
//
2+
// DiRegister.swift
3+
// NomadSpot
4+
//
5+
// Created by Wonji Suh on 3/1/26.
6+
//
7+
8+
import Foundation
9+
10+
import DomainInterface
11+
import Repository
12+
import Foundations
13+
import UseCase
14+
15+
import ComposableArchitecture
16+
import WeaveDI
17+
18+
19+
/// 🚀 **앱 전역 DI 관리자**
20+
public class AppDIManager: @unchecked Sendable {
21+
public static let shared = AppDIManager()
22+
23+
private init() {}
24+
25+
/// 🎯 기본 의존성들을 등록
26+
public func registerDefaultDependencies() async {
27+
// 🏗️ 1. WeaveDI.builder 패턴으로 실제 구현체들 등록
28+
WeaveDI.builder
29+
// .register { KeychainManager() as KeychainManaging }
30+
// .register {
31+
// let keychainManager = UnifiedDI.resolve(KeychainManaging.self) ?? KeychainManager()
32+
// return KeychainTokenProvider(keychainManager: keychainManager) as TokenProviding
33+
// }
34+
// .register(ProfileInterface.self) { ProfileRepositoryImpl() }
35+
// // MARK: - 로그인
36+
// .register { AuthRepositoryImpl() as AuthInterface }
37+
// .register { GoogleOAuthRepositoryImpl() as GoogleOAuthInterface }
38+
// .register { AppleLoginRepositoryImpl() as AppleAuthRequestInterface }
39+
// .register { AppleOAuthRepositoryImpl() as AppleOAuthInterface }
40+
// .register { AppleOAuthProvider() as AppleOAuthProviderInterface }
41+
// .register { GoogleOAuthProvider() as GoogleOAuthProviderInterface }
42+
// // MARK: - 온보딩
43+
// .register { OnBoardingRepositoryImpl() as OnBoardingInterface }
44+
// .register { SignUpRepositoryImpl() as SignUpInterface }
45+
// // MARK: - 출석
46+
// .register { AttendanceRepositoryImpl() as AttendanceInterface }
47+
// // MARK: - 마이페이지
48+
// .register { MyPageRepositoryImpl() as MyPageRepositoryInterface }
49+
// // MARK: - 스케줄
50+
// .register { ScheduleRepositoryImpl() as ScheduleInterface }
51+
// // MARK: - QRCode
52+
// .register { QRCodeRepositoryImpl() as QRCodeInterface }
53+
.configure()
54+
}
55+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
//
2+
// KeychainTokenProvider.swift
3+
// NomadSpot
4+
//
5+
// Created by Wonji Suh on 3/1/26.
6+
//
7+
8+
//import Foundation
9+
//
10+
//import DomainInterface
11+
//import Foundations
12+
//
13+
//struct KeychainTokenProvider: TokenProviding {
14+
// private let keychainManager: KeychainManaging
15+
//
16+
// init(keychainManager: KeychainManaging) {
17+
// self.keychainManager = keychainManager
18+
// }
19+
//
20+
// func accessToken() -> String? {
21+
// keychainManager.accessToken()
22+
// }
23+
//
24+
// func saveAccessToken(_ token: String) {
25+
// keychainManager.saveAccessToken(token)
26+
// }
27+
//}
Lines changed: 206 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,206 @@
1+
//
2+
// AppReducer.swift
3+
// NomadSpot
4+
//
5+
// Created by Wonji Suh on 3/1/26.
6+
//
7+
8+
import Presentation
9+
import ComposableArchitecture
10+
import Entity
11+
import LogMacro
12+
13+
@Reducer
14+
public struct AppReducer: Sendable {
15+
public init() {}
16+
17+
@ObservableState
18+
public enum State {
19+
case splash(SplashReducer.State)
20+
21+
22+
public init() {
23+
self = .splash(SplashReducer.State())
24+
}
25+
26+
// Animation identifier for SwiftUI transitions
27+
var animationID: String {
28+
switch self {
29+
case .splash: return "splash"
30+
}
31+
}
32+
}
33+
34+
//MARK: - Action
35+
public enum Action: ViewAction {
36+
case view(View)
37+
case async(AsyncAction)
38+
case inner(InnerAction)
39+
case navigation(NavigationAction)
40+
case scope(ScopeAction)
41+
}
42+
43+
@CasePathable
44+
public enum View {
45+
case presentView
46+
case presentRoot
47+
case presentAuth
48+
case presentStaff
49+
case presentMember
50+
}
51+
52+
//MARK: - 앱내에서 사용하는 액션
53+
public enum InnerAction: Equatable {
54+
55+
}
56+
57+
//MARK: - 비동기 처리 액션
58+
public enum AsyncAction: Equatable {
59+
case startNotificationListener
60+
case refreshTokenExpired
61+
}
62+
63+
//MARK: - 네비게이션 연결 액션
64+
public enum NavigationAction: Equatable {
65+
66+
}
67+
68+
//MARK: - 스코프 액션
69+
@CasePathable
70+
public enum ScopeAction {
71+
case splash(SplashReducer.Action)
72+
}
73+
74+
@Dependency(\.continuousClock) var clock
75+
76+
private enum CancelID {
77+
case refreshTokenExpiredListener
78+
case splashRouting
79+
case authEffects
80+
case staffEffects
81+
case memberEffects
82+
}
83+
84+
public var body: some ReducerOf<Self> {
85+
Reduce { state, action in
86+
switch action {
87+
case .view(let viewAction):
88+
return handleViewAction(state: &state, action: viewAction)
89+
90+
case .inner(let innerAction):
91+
return handleInnerAction(state: &state, action: innerAction)
92+
93+
case .async(let asyncAction):
94+
return handleAsyncAction(state: &state, action: asyncAction)
95+
96+
case .navigation(let navigationAction):
97+
return handleNavigationAction(state: &state, action: navigationAction)
98+
99+
case .scope(let scopeAction):
100+
return handleScopeAction(state: &state, action: scopeAction)
101+
}
102+
}
103+
.ifCaseLet(\.splash, action: \.scope.splash) {
104+
SplashReducer()
105+
}
106+
}
107+
108+
private func handleViewAction(
109+
state: inout State,
110+
action: View
111+
) -> Effect<Action> {
112+
switch action {
113+
case .presentView:
114+
return .run { send in
115+
// await send(.scope(.splash(.view(.onAppear))))
116+
}
117+
118+
case .presentRoot:
119+
//
120+
return .none
121+
122+
case .presentAuth:
123+
// state = .auth(.init())
124+
return .concatenate(
125+
.cancel(id: CancelID.staffEffects),
126+
.cancel(id: CancelID.memberEffects)
127+
)
128+
129+
case .presentStaff:
130+
// state = .staff(.init())
131+
return .concatenate(
132+
.cancel(id: CancelID.authEffects),
133+
.cancel(id: CancelID.memberEffects)
134+
)
135+
136+
case .presentMember:
137+
// state = .member(.init())
138+
return .concatenate(
139+
.cancel(id: CancelID.authEffects),
140+
.cancel(id: CancelID.staffEffects)
141+
)
142+
}
143+
}
144+
145+
private func handleAsyncAction(
146+
state: inout State,
147+
action: AsyncAction
148+
) -> Effect<Action> {
149+
switch action {
150+
case .startNotificationListener:
151+
return setupRefreshTokenExpiredListener()
152+
.cancellable(id: CancelID.refreshTokenExpiredListener, cancelInFlight: true)
153+
154+
case .refreshTokenExpired:
155+
// Refresh token이 만료된 경우 로그인 화면으로 이동
156+
157+
// state = .auth(.init())
158+
159+
return .concatenate(
160+
.cancel(id: CancelID.splashRouting),
161+
.cancel(id: CancelID.staffEffects),
162+
.cancel(id: CancelID.memberEffects)
163+
)
164+
}
165+
}
166+
167+
private func handleInnerAction(
168+
state: inout State,
169+
action: InnerAction
170+
) -> Effect<Action> {
171+
return .none
172+
}
173+
174+
private func handleNavigationAction(
175+
state: inout State,
176+
action: NavigationAction
177+
) -> Effect<Action> {
178+
return .none
179+
}
180+
181+
private func handleScopeAction(
182+
state: inout State,
183+
action: ScopeAction
184+
) -> Effect<Action> {
185+
switch action {
186+
187+
188+
default:
189+
return .none
190+
}
191+
}
192+
193+
/// Refresh token 만료 감지 리스너 설정
194+
private func setupRefreshTokenExpiredListener() -> Effect<Action> {
195+
#logDebug("🔔 [AppReducer] 🚨 SETTING UP REFRESH TOKEN EXPIRED LISTENER...")
196+
return .publisher {
197+
NotificationCenter.default
198+
.publisher(for: NSNotification.Name("RefreshTokenExpired"))
199+
.map { notification in
200+
#logDebug("🔔 [AppReducer] 🔥 🎯 REFRESH TOKEN EXPIRED NOTIFICATION RECEIVED!")
201+
#logDebug("🔔 [AppReducer] Notification details: \(notification)")
202+
return Action.async(.refreshTokenExpired)
203+
}
204+
}
205+
}
206+
}

0 commit comments

Comments
 (0)