Get your Apple iOS (iPhone), iPadOS (iPad) and Mac Catalyst app Version and Build number programmatically.

Here is a small function that I have written that you can use in your iOS, iPadOS or macOS Catalyst app to get your app’s current version and build number and print it on screen whether will on the app’s about or support view.

Function: copy the below function in the Xcode project’s UIViewController Swift class file.

func appVersion() -> (version: String, build: String) {
    return ("\(Bundle.main.infoDictionary!["CFBundleShortVersionString"] as? String ?? "")", "\(Bundle.main.infoDictionary!["CFBundleVersion"] as? String ?? "").")

Here is how to print the value: Copy the below code in the same Swift file inside the ViewDidLoad function.

print("App Info: Your app version number is \(self.appVersion().version) and build number is \(self.appVersion().build)")

Thanks & Regards
Mandar Apte

Published by Mandar Apte

Mandar is a Mumbai-based multi-disciplinary designer with UX/UI, Logo, Symbol, and Brand Identity design expertise. He currently runs his Mudrkashar Linguistic Apple iPhone, iPad, and Mac app business in the heart of Mumbai city.

Leave a comment

Leave a Reply