Get iOS, iPadOS and macOS app Versions and Build numbers programmatically.

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

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’s how to print the value: Copy the code below into 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.