-
Notifications
You must be signed in to change notification settings - Fork 1
/
Project.swift
143 lines (127 loc) · 5.12 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
import ProjectDescription
import ProjectDescriptionHelpers
/*
+-------------+
| |
| App | Contains MyApp App target and MyApp unit-test target
| |
+------+-------------+-------+
| depends on |
| |
+----v-----+ +-----v-----+
| | | |
| Kit | | UI | Two independent frameworks to share code and start modularising your app
| | | |
+----------+ +-----------+
*/
// MARK: - Project Factory
protocol ProjectFactory {
var projectName: String { get }
var dependencies: [TargetDependency] { get }
func generateTarget() -> [Target]
func generateConfigurations() -> Settings
}
// MARK: - Base Project Factory
class BaseProjectFactory: ProjectFactory {
let appName: String = "저니피키"
let projectName: String = "JYP-iOS"
let bundleName: String = "journeypiki"
let infoPlist: [String: InfoPlist.Value] = [
"ITSAppUsesNonExemptEncryption": false,
"CFBundleName": "저니피키",
"CFBundleShortVersionString": "1.2.1",
"CFBundleVersion": "1",
"UILaunchStoryboardName": "LaunchScreen",
"KAKAO_REST_KEY": "$(KAKAO_REST_KEY)",
"KAKAO_APP_KEY": "$(KAKAO_APP_KEY)",
"SERVER_HOST": "$(SERVER_HOST)",
"SERVER_JWT_MASTER_KEY": "$(SERVER_JWT_MASTER_KEY)",
"GOOGLE_API_KEY": "$(GOOGLE_API_KEY)",
"CFBundleURLTypes": [
[
"CFBundleTypeRole": "Editor",
"CFBundleURLSchemes": ["kakao$(KAKAO_APP_KEY)"]
]
],
"UIApplicationSceneManifest": [
"UIApplicationSupportsMultipleScenes": false,
"UISceneConfigurations": [
"UIWindowSceneSessionRoleApplication": [
[
"UISceneConfigurationName": "Default Configuration",
"UISceneDelegateClassName": "$(PRODUCT_MODULE_NAME).SceneDelegate"
],
]
]
],
"LSApplicationQueriesSchemes": ["kakaokompassauth", "kakaolink", "kakao$(KAKAO_APP_KEY)", "googlechromes", "comgooglemaps"],
"App Transport Security Settings": ["Allow Arbitrary Loads": true],
"NSAppTransportSecurity": ["NSAllowsArbitraryLoads": true],
"UIAppFonts": [
"Item 0": "Pretendard-Medium.otf",
"Item 1": "Pretendard-Regular.otf",
"Item 2": "Pretendard-SemiBold.otf",
"Item 3": "Pretendard-Bold.otf"
],
"UIUserInterfaceStyle": "Light"
]
let dependencies: [TargetDependency] = [
.external(name: "Moya"),
.external(name: "Alamofire"),
.external(name: "RxMoya"),
.external(name: "SnapKit"),
.external(name: "RxSwift"),
.external(name: "RxCocoa"),
.external(name: "RxGesture"),
.external(name: "RxDataSources"),
.external(name: "ReactorKit"),
.external(name: "Then"),
.external(name: "Lottie"),
.external(name: "KakaoSDKCommon"),
.external(name: "KakaoSDKAuth"),
.external(name: "KakaoSDKUser"),
.external(name: "GoogleMaps"),
.external(name: "Kingfisher"),
.external(name: "KeychainAccess")
]
func generateConfigurations() -> Settings {
Settings.settings(configurations: [
.debug(name: "Debug", xcconfig: .relativeToRoot("\(projectName)/\(projectName)/Sources/Config/Debug.xcconfig")),
.release(name: "Release", xcconfig: .relativeToRoot("\(projectName)/\(projectName)/Sources/Config/Release.xcconfig")),
])
}
func generateTarget() -> [Target] {
[
Target(
name: projectName,
platform: .iOS,
product: .app,
bundleId: "com.jyp.\(bundleName)",
deploymentTarget: .iOS(targetVersion: "14.0", devices: [.iphone]),
infoPlist: .extendingDefault(with: infoPlist),
sources: ["\(projectName)/\(projectName)/Sources/**"],
resources: "\(projectName)/\(projectName)/Resources/**",
entitlements: "\(projectName)/\(projectName).entitlements",
scripts: [.pre(path: "Scripts/SwiftLintRunScript.sh", arguments: [], name: "SwiftLint")],
dependencies: dependencies
),
Target(
name: "\(projectName)Tests",
platform: .iOS,
product: .unitTests,
bundleId: "com.jyp.\(projectName).Tests",
infoPlist: .default,
sources: ["\(projectName)/\(projectName)Tests/**"],
dependencies: [.target(name: "\(projectName)")]
)
]
}
}
// MARK: - Project
let factory = BaseProjectFactory()
let project: Project = .init(
name: factory.projectName,
organizationName: factory.projectName,
settings: factory.generateConfigurations(),
targets: factory.generateTarget()
)