Skip to content

Commit 0190998

Browse files
authored
Merge pull request #29 from v2er-app/bugfix/real-version-display
Fix: Display real version number in Settings About section
2 parents 8828fa8 + 477cc3f commit 0190998

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

V2er/View/Settings/SettingsPage.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@ struct SettingsPage: View {
2121
@State var logingOut: Bool = false
2222
@State private var safariURL: IdentifiableURL?
2323

24+
// Get version and build number from Bundle
25+
private var appVersion: String {
26+
let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0"
27+
let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "1"
28+
return "版本v\(version)(\(build))"
29+
}
30+
2431
var body: some View {
2532
formView
2633
.navBar("设置")
@@ -72,7 +79,7 @@ struct SettingsPage: View {
7279
} label: {
7380
SectionView("关于") {
7481
HStack {
75-
Text("版本1.0.0")
82+
Text(appVersion)
7683
.font(.footnote)
7784
.foregroundColor(Color.tintColor)
7885
Image(systemName: "chevron.right")

0 commit comments

Comments
 (0)