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

Mandar Apte

This website contains a design articles blog by Mandar Apte. He writes and shares his iOS development, graphic, web, & animation film design experience through articles. Mandar is Mumbai based multi-disciplinary designer with expertise in UI, UX, Logo, Symbol, and Brand Identity design. He is an alumnus of Sir J. J. Institute of Applied Art, Mumbai. He currently runs his studio in the heart of the city of Mumbai.

Leave a Reply

Your email address will not be published. Required fields are marked *