This repository demonstrates how to implement a mandatory update check in a SwiftUI iOS app. It ensures users are prompted to update their app when their version is below the minimum supported.

- iOS 17 or higher
- SwiftUI
- Xcode 15+
- Checks the minimum supported app version from a remote source
- Displays an alert forcing users to update
- Simple and lightweight SwiftUI implementation
- Ensure all users are on supported version(s)
- Enforce critical updates for bug fixes and security patches
- Improve user experience by preventing outdated app usage
📌 Ideal for iOS developers looking to add a force update mechanism to their SwiftUI apps!
git clone https://github.com/steelcityamir/ios-swift-mandatory-update-check.git
cd ios-swift-mandatory-update-check
Double-click the .xcodeproj or .xcworkspace file. Alternatively, open Xcode and select File > Open, then choose the project folder.
In the top menu bar of Xcode, click on the device selector. Choose an iPhone or iPad simulator, or a connected physical device.
-
Click the
▶️ "Run" button in Xcode to launch the app in your selected simulator or device. -
By default, the app version is set to 1.0.0, which is below the minimum required version (2.0.0). As a result, the Mandatory Update screen will be displayed.
-
To bypass the update prompt and access the main view:
- Open Xcode > Project Navigator.
- Locate the app's Info.plist file.
- Update the CFBundleShortVersionString to 2.0.0 or higher.
- Rebuild and relaunch the app.