Latest 1.1.0
License MIT
Platforms ios 8.0
Frameworks UIKit

Prince of versions


Library checks for updates using configuration from some resource.


  • Load update configuration from network resource
  • Use predefined parser for parsing update configuration in JSON format
  • Make asynchronous loading and use callback for notifying result
  • Loading and verifying versions happen outside of UI thread


  • iOS 8.0+
  • Xcode 8.0+
  • Swift 3.0


The easiest way to use Prince of versions in your project is using the CocaPods package manager.


See installation instructions for CocoaPods if not already installed

To integrate the library into your Xcode project specify the pod dependency to your Podfile:

platform :ios, '8.0'

pod 'PrinceOfVersions'

run pod install

pod install

JSON file

JSON file in your application has to follow Semantic Versioning and it has to look like this:

    "ios": {
        "minimum_version": "1.2.3",
        "latest_version": {
            "version": "2.4.5",
            "notification_type": "ALWAYS"
    "android": {
        "minimum_version": "1.2.3",
        "latest_version": {
            "version": "2.4.5",
            "notification_type": "ONCE"
    "meta": {
        "key1": "value1",
        "key2": "value2"

Depending on notification_type property, the user can be notified ONCE or ALWAYS. The library handles this for you, and if notification type is set to ONCE, it will notify you via newUpdate(version: String, isMandatory: Bool, metadata: [String: AnyObject]?) method only once. Every other time the library will return noUpdate for that specific version.
Key-value pairs under "meta" key are optional metadata of which any amount can be sent accompanying the required fields.


Full example application is available [here]().

Most common usage – loading from network resource

  1. Getting all data

    let url = URL(string: "")
        PrinceOfVersions().loadConfiguration(from: url) { (response) in
            switch response.result {
            case .success(let info):
                print("Minimum version: ", info.minimumRequiredVersion)
                print("Installed version: ", info.installedVersion)
                print("Is minimum version satisfied: ", info.isMinimumVersionSatisfied)
                print("Notification type: ", info.notificationType)
                if let latestVersion = info.latestVersion {
                    print("Is minimum version satisfied: ", latestVersion)
            case .failure(let error):
  2. Automatic handling update frequency

    let url = URL(string: "")
    PrinceOfVersions().checkForUpdates(from: url,
        newVersion: {
            (latestVersion, isMinimumVersionSatisfied, metadata) in
        noNewVersion: {
            (isMinimumVersionSatisfied, metadata) in
        error: {
            (error) in

Multiple targets

If your application has multiple targets you might need more than one JSON configuration file. If that is the case, do not forget to set a different URL for each target.


Feedback and code contributions are very much welcome. Just make a pull request with a short description of your changes. By making contributions to this project you give permission for your code to be used under the same license.

Latest podspec

    "name": "PrinceOfVersions",
    "version": "1.1.0",
    "summary": "Library checks for updates using configuration from some resource.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "Jasmin Abou Aldan": "[email protected]"
    "platforms": {
        "ios": "8.0"
    "source": {
        "git": "",
        "tag": "1.1.0"
    "source_files": "Versioner/**/*.{h,m,swift}",
    "frameworks": "UIKit",
    "pushed_with_swift_version": "4.0"

Pin It on Pinterest

Share This