From 477cc3fa3c3dd3ed64d563d82fea10f080130757 Mon Sep 17 00:00:00 2001 From: Gray Zhang Date: Sun, 14 Sep 2025 23:12:27 +0800 Subject: [PATCH] fix: display real version number in Settings About section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed hardcoded version "版本1.0.0" to dynamically read from Bundle - Now displays version in format "版本v1.1.0(3)" with actual version and build number - Version info is pulled from CFBundleShortVersionString and CFBundleVersion 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- V2er/View/Settings/SettingsPage.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/V2er/View/Settings/SettingsPage.swift b/V2er/View/Settings/SettingsPage.swift index 8715d11..1acb8b7 100644 --- a/V2er/View/Settings/SettingsPage.swift +++ b/V2er/View/Settings/SettingsPage.swift @@ -21,6 +21,13 @@ struct SettingsPage: View { @State var logingOut: Bool = false @State private var safariURL: IdentifiableURL? + // Get version and build number from Bundle + private var appVersion: String { + let version = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String ?? "1.0.0" + let build = Bundle.main.infoDictionary?["CFBundleVersion"] as? String ?? "1" + return "版本v\(version)(\(build))" + } + var body: some View { formView .navBar("设置") @@ -72,7 +79,7 @@ struct SettingsPage: View { } label: { SectionView("关于") { HStack { - Text("版本1.0.0") + Text(appVersion) .font(.footnote) .foregroundColor(Color.tintColor) Image(systemName: "chevron.right")