iOS Get App Version & Build Number
You can declare globally to get appVersion any where.
Swift:
//MARK:- appVersion
public var appVersion: String {
//versionNumber
let versionNumber = Bundle.main.object(forInfoDictionaryKey: "CFBundleShortVersionString") ?? "1.0"
//buildNumber
let buildNumber = Bundle.main.object(forInfoDictionaryKey: "CFBundleVersion") ?? "1.0"
return "Version: #\(versionNumber) (#\(buildNumber))"
}
Output:
Let's grow together 🌱Cheers 🍻