Deprecator automatically handles version checking against a hosted JSON file and handles soft and hard deprecation of old release builds of your app.
Branch: master
Clone or download
Pull request Compare This branch is 12 commits ahead of togethera:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Deprecator.xcodeproj
Deprecator
DeprecatorTests
.gitignore
README.md

README.md

Deprecator

BuddyBuild

Deprecation handler for iOS

Deprecator automatically handles version checking against a hosted JSON file and handles soft and hard deprecation of old release builds of your app.

  • Hard/Soft deprecation
  • Built-in UI
  • Internationalisation
  • Informative errors

Install

github "reddavis/Deprecator-iOS"

Example

Let’s initialize the Deprecator:

self.deprecator = Deprecator(deprecationURL: url, currentBuildNumber: 47)
self.deprecator.delegate = self

and a few data source and delegate methods:

// MARK: DeprecatorDelegate

func didFind(deprecation: Deprecator.Deprecation, isRequired: Bool, in deprecator: Deprecator)
{
    deprecation.present(in: self.rootViewController, language: "fr")
}

func didFail(with error: Deprecator.DataError, in deprecator: Deprecator)
{
    //…
}

func didNotFindDeprecation(in deprecator: Deprecator)
{
    //…
}

To trigger a check for deprecations:

self.deprecator.checkForDeprecations()

Deprecator JSON

The JSON file should look like

{
    "meta": {
        "version": 1
    },
    "minimum_update": {
        "build_number": 48,
        "default_language": "en",
        "url": "https://red.to",
        "strings": {
            "en": {
                "title": "englishTitle",
                "update_action_title": "englishUpdateTitle",
                "message": "englishMessage"
            },
            "fr": {
                "title": "frenchTitle",
                "update_action_title": "frenchUpdateTitle",
                "message": "frenchMessage"
            }
        }
    },
    "preferred_update": {
        "build_number": 61,
        "default_language": "de",
        "url": "https://red.to",
        "strings": {
            "en": {
                "title": "englishTitle",
                "update_action_title": "englishUpdateTitle",
                "cancel_action_title": "englishCancelTitle",
                "message": "englishMessage"
            },
            "fr": {
                "title": "frenchTitle",
                "update_action_title": "frenchUpdateTitle",
                "cancel_action_title": "frenchCancelTitle",
                "message": "frenchMessage"
            },
            "de": {
                "title": "germanTitle",
                "update_action_title": "germanUpdateTitle",
                "cancel_action_title": "germanCancelTitle",
                "message": "germanMessage"
            }
        }
    }
}

License

MIT License.