DevPrep

All topics › Building and shipping

Version, build number and phased release

Junior PRO

Two numbers

One version, many builds: 2.4.0 (410) went to TestFlight, a bug was found, 2.4.0 (411) went to review. The user sees only 2.4.0.

let info = Bundle.main.infoDictionary
let version = info?["CFBundleShortVersionString"] as? String ?? "?"
let build = info?["CFBundleVersion"] as? String ?? "?"
print("Version \(version) (\(build))")   // on the About screen and in logs

The rest of this answer, with code and interview follow-ups, is in the DevPrep app.

Read the full answer in DevPrep

Practice this before your interview

DevPrep turns these answers into one-minute challenges: what does this code print, find the bug, mock interviews. One challenge a day.

Get DevPrep on the App Store