Swift Get App Version And Build

[Solved] Swift Get App Version And Build | Swift - Code Explorer | yomemimo.com
Question : swift get app version and build

Answered by : valentinorossi

let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String

Source : https://stackoverflow.com/questions/25965239/how-do-i-get-the-app-version-and-build-number-using-swift | Last Update : Sat, 19 Sep 20

Question : swift get app version and build

Answered by : valentinorossi

import Foundation
extension Bundle { var shortVersion: String { if let result = infoDictionary?["CFBundleShortVersionString"] as? String { return result } else { assert(false) return "" } } var buildVersion: String { if let result = infoDictionary?["CFBundleVersion"] as? String { return result } else { assert(false) return "" } } var fullVersion: String { return "\(shortVersion)(\(buildVersion))" }
}
// Usage:
someLabel.text = Bundle.main.versionNumber

Source : https://stackoverflow.com/questions/25965239/how-do-i-get-the-app-version-and-build-number-using-swift | Last Update : Sat, 19 Sep 20

Question : swift 5 get app version

Answered by : nathan-hedgeman

import Foundation
let versionString = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String ?? "Default String to shut up warning"
let buildString = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") as? String ?? "Default String to shut up warning"

Source : | Last Update : Fri, 08 Oct 21

Answers related to swift get app version and build

Code Explorer Popular Question For Swift