Skip to content

Commit 6887266

Browse files
committed
refactor: 앱 버전 표시 형식 정리
1 parent 8e4998f commit 6887266

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Application/DevLogPresentation/Sources/Settings/SettingsFeature.swift

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,23 @@ struct SettingsFeature {
3333
var activeLoadingRow: ActiveLoadingRow?
3434
var loading = LoadingFeature.State()
3535
var alertType: Action.AlertType?
36-
var appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
36+
var appVersion = Self.appVersion()
3737
var appstoreUrl = Bundle.main.object(forInfoDictionaryKey: "TESTFLIGHT_URL") as? String
3838
var policyURL = Bundle.main.object(forInfoDictionaryKey: "PRIVACY_POLICY_URL") as? String
3939

4040
var isLoading: Bool {
4141
loading.isLoading
4242
}
43+
44+
private static func appVersion() -> String? {
45+
let marketingVersion = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
46+
let buildNumber = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String
47+
let components = [marketingVersion, buildNumber]
48+
.compactMap { $0?.trimmingCharacters(in: .whitespacesAndNewlines) }
49+
.filter { !$0.isEmpty }
50+
51+
return components.isEmpty ? nil : components.joined(separator: ".")
52+
}
4353
}
4454

4555
enum Action: BindableAction {

0 commit comments

Comments
 (0)