-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathProject.swift
200 lines (181 loc) · 5.76 KB
/
Project.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
import ProjectDescription
import Foundation
import ProjectDescriptionHelpers
import MyPlugin
/*
+-------------+
| |
| App | Contains CMC App target and CMC unit-test target
| |
+------+-------------+-------+
| depends on |
| |
+----v-----+ +-----v-----+
| | | |
| Kit | | UI | Two independent frameworks to share code and start modularising your app
| | | |
+----------+ +-----------+
*/
// MARK: - Project
enum TargetType {
case DesignSystem
case App
}
protocol ProjectProfile {
var projectName: String { get }
func generateDependencies(targetName target: TargetType) -> [TargetDependency]
func generateTarget() -> [Target]
func generateAppConfigurations() -> Settings
}
class BaseProjectProfile: ProjectProfile{
let projectName: String = "CMC"
let infoPlist: [String: Plist.Value] = [
"Base_Url" : "$(BASE_URL)",
"ITSAppUsesNonExemptEncryption": false,
/*
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLSchemes</key>
<array>
<string>yourappscheme</string> <!-- yourappscheme를 원하는 스킴으로 변경 -->
</array>
<key>CFBundleURLName</key>
<string>com.yourcompany.yourapp</string>
</dict>
</array>
*/
"CFBundleShortVersionString": "1.2.0",
"CFBundleVersion": "1",
"UISupportedInterfaceOrientations": ["UIInterfaceOrientationPortrait"],
"CFBundleDevelopmentRegion": "ko_KR",
"UILaunchStoryboardName": "LaunchScreen",
"UIUserInterfaceStyle": "Light",
"UIApplicationSceneManifest": [
"UIApplicationSupportsMultipleScenes": false,
"UISceneConfigurations": [
"UIWindowSceneSessionRoleApplication": [
[
"UISceneConfigurationName": "Default Configuration",
"UISceneDelegateClassName": "$(PRODUCT_MODULE_NAME).SceneDelegate"
],
]
]
],
"CFBundleIconName": "AppIcon",
"NSCameraUsageDescription": "QRCode에 접근하기 위해 카메라 권한이 필요합니다.",
"UIAppFonts": [
"Item 0": "Pretendard-Medium.otf",
"Item 1": "Pretendard-Regular.otf",
"Item 2": "Pretendard-SemiBold.otf",
"Item 3": "Pretendard-Bold.otf"
],
"CFBundleURLTypes": [
[
"CFBundleURLSchemes": ["cmcqrcodechecker"],
"CFBundleURLName": "com.softsquared.cmc.ios"
]
],
"NSAppTransportSecurity": [
"NSAllowsArbitraryLoads": true
]
]
func generateDependencies(targetName target: TargetType) -> [TargetDependency] {
switch target{
case .App:
return commonDependencies() + [
.target(name: "DesignSystem")
]
case .DesignSystem:
return commonDependencies()
}
}
func generateAppConfigurations() -> Settings {
return Settings.settings(
base: [
"TARGETED_DEVICE_FAMILY": "1"
],
configurations: [
.debug(name: "Dev", xcconfig: .relativeToCurrentFile("CMC/Resources/Configure/Dev.xcconfig")),
.release(name: "Release", xcconfig: .relativeToCurrentFile("CMC/Resources/Configure/Release.xcconfig")),
])
}
func generateTarget() -> [Target] {
[
Target(
name: projectName,
platform: .iOS,
product: .app,
bundleId: "com.softsquared.cmc.ios",
deploymentTarget: .iOS(targetVersion: "15.0", devices: [.iphone]),
infoPlist: .extendingDefault(with: infoPlist),
sources: ["\(projectName)/Sources/**"],
resources: "\(projectName)/Resources/**",
dependencies: [
.target(name: "DesignSystem")
],
settings: generateAppConfigurations()
),
Target(
name: "DesignSystem",
platform: .iOS,
product: .framework,
bundleId: "com.softsquared.cmc.ios.DesignSystem",
deploymentTarget: .iOS(targetVersion: "15.0", devices: [.iphone]),
infoPlist: .default,
sources: ["DesignSystem/Sources/**"],
resources: "\(projectName)/Resources/**",
dependencies: generateDependencies(targetName: .DesignSystem)
)
]
}
}
let profile = BaseProjectProfile()
let project: Project = .init(
name: profile.projectName,
organizationName: "com.softsquared.cmc",
packages: [
.remote(
url: "https://github.com/ReactiveX/RxSwift",
requirement: .upToNextMajor(from: "6.6.0")),
.remote(
url: "https://github.com/RxSwiftCommunity/RxGesture",
requirement: .upToNextMajor(from: "4.0.4")),
.remote(
url: "https://github.com/SnapKit/SnapKit",
requirement: .upToNextMajor(from: "5.7.1")),
.remote(
url: "https://github.com/firebase/firebase-ios-sdk.git",
requirement: .upToNextMajor(from: "10.25.0")),
.remote(
url: "https://github.com/DaveWoodCom/XCGLogger.git",
requirement: .upToNextMajor(from: "7.0.0"))
],
settings: .settings(configurations: [
.debug(name: "Dev"),
.release(name: "Release")
]),
targets: profile.generateTarget()
)
extension BaseProjectProfile {
fileprivate func commonDependencies() -> [TargetDependency] {
return [
.package(product: "RxSwift",
type: .runtime),
.package(product: "RxCocoa",
type: .runtime),
.package(product: "RxRelay",
type: .runtime),
.package(product: "RxGesture",
type: .runtime),
.package(product: "SnapKit",
type: .runtime),
.package(product: "XCGLogger",
type: .runtime),
.package(product: "FirebaseAnalytics",
type: .runtime),
.package(product: "FirebaseCrashlytics",
type: .runtime)
]
}
}