**Overview**
VersionTrackerSwift is a powerful Swift library that allows developers to easily track the version of their iOS app and prompt users to upgrade to the latest version if needed. It provides a simple API to keep track of version numbers, compare them, and display custom upgrade alerts.
**Features**
***Version Tracking***
With VersionTrackerSwift, you can easily track the current version of your app. It provides a simple method to get the current version number and compare it with the latest available version.
“`swift
// Get current version
let currentVersion = VersionTracker.currentVersion
// Compare versions
let isUpdateAvailable = VersionTracker.isUpdateAvailable(latestVersion: “1.2.3”)
“`
***Custom Upgrade Alerts***
VersionTrackerSwift allows you to display custom upgrade alerts to your users, prompting them to update to the latest version. You can customize the alert title, message, buttons, and their actions.
“`swift
// Custom Upgrade Alert
let upgradeAlert = VersionTracker.createUpgradeAlert(
title: “Update Available”,
message: “A new version of the app is available. Do you want to update?”,
upgradeButtonTitle: “Upgrade”,
skipButtonTitle: “Skip”
)
// Present upgrade alert
upgradeAlert.show()
“`
***Automatic Version Update Prompt***
By using the autoCheckForUpdate method, VersionTrackerSwift can automatically check for new versions whenever the app launches and display the upgrade alert if a new version is available.
“`swift
// Automatic version update prompt
VersionTracker.autoCheckForUpdate(
currentVersion: VersionTracker.currentVersion,
appStoreID: “123456789”
)
“`
**Installation**
VersionTrackerSwift can be easily installed via [CocoaPods](https://cocoapods.org/). Just add the following line to your `Podfile`:
“`ruby
pod ‘VersionTrackerSwift’
“`
Then, run the command `pod install` in the terminal to fetch and integrate the library into your Xcode project.
**Usage**
To start using VersionTrackerSwift, import the library at the top of your Swift file:
“`swift
import VersionTrackerSwift
“`
Then, you can utilize the various features provided by the library as mentioned in the features section.
**Requirements**
VersionTrackerSwift requires iOS 10.0 or later and is compatible with both Swift 4 and Swift 5.
**License**
VersionTrackerSwift is released under the [MIT License](https://github.com/versiontracker/versiontracker-swift/blob/master/LICENSE)
**Resources**
– [GitHub Repository](https://github.com/versiontracker/versiontracker-swift)
– [API Documentation](https://versiontracker.net/documentation)
Feel free to explore more about VersionTrackerSwift and its functionalities using the provided resources.