/Chronicle

:watch: An iOS version compatibility checker. Force upgrades and recommend new versions.

Primary LanguageSwiftMIT LicenseMIT

Chronicle

An iOS version checker

Swift 4 iOS Platform Carthage Compatible License

Chronicle is a version compatibility checker for iOS applications.

How it works

  1. Host a properly formatted json file on your own server. Read more on formatting from the Payload.md.
  2. In the application:didFinishLaunchingWithOptions: (or likewise) method of your app's AppDelegate check for version compliance and handle accordingly.

Example

Chronicle provides 3 block callbacks which are all optional callbacks.

(1) Minimum version found, (2) recommended version found, (3) error occurred.

Example

Chronicle().checkForUpdates(from: url,
      requiredVersion: { (version, isMinimumVersionSatisfied, notificationType) in
        if notificationType == .once {
          if !isMinimumVersionSatisfied {
            print("""
                  Version \(version.version) is available.
                  You are required to download this version to continue using this application.
                  Visit \(version.storeUrl) to upgrade.
                  """)
          }
        },
        recommendedVersion: { (version, isMinimumVersionSatisfied, notificationType) in
            if !isMinimumVersionSatisfied {
              print("""
                    Version \(version.version) is available!
                    Attached message: \(version.message)
                    You should go and download it!
                    """)
            }

        }) { (error) in
            // Usually don't want to display anything to user at this point
        }

Check out the ChronicleExample build target for more.

Why Chronicle?

Obtaining current version info from the App Store directly is the best way to ensure your users are receiving notifications for app versions which actually exist.

However, this project serves as a force-upgrade module for you to modify the required versions at any time via a simple json file.

For example, this is useful if an API breaking change was implemented and users who run versions less than 2.0 would be hitting incorrect endpoints.

JSON Payload Format

A formatted JSON payload served via your own server.

License

Chronicle is available under the MIT license. See the LICENSE file for more info.