Example showing how to implement a usable expiring beta to macOS apps.
That's because you frequently will want to modify
BetaExpiration.swift. The library code has a hard-coded expiration date. You will want to change this with ongoing releases. To make this a Carthage or CocoaPods library would be useless.
There are two variants that'll work:
- You can copy the files from the library over to your project.
- You can check the whole project out (as a git submodule, for example) and include it as a sub-project in your app.
Whatever you do, it's important that you can easily change the expiration date in
- Hard code a new expiration date in
BetaExpiration.expiresAt. You can compute the date by running the unit tests and looking at the console output.
- Change the alert in
BetaExpiration.guardExpiration()to show your e-mail address.
AppDelegate. This will display an alert and quit the app if the beta period is over.
- Optional: Decorate your app window with useful information for your beta testers, see below.
The decoration is achieved by adding a
NSTitlebarAccessoryViewController to the window. The format is as follows:
β v1.2.0 (107) - 23 days left ^ ^ ^ | | |__ = (today - expiration date) | | | |__ build number | |__ version
You get all of this by calling
hostBundle should be your app's main
Bundle because that'll include version and build number information.
Copyright (c) 2017 Christian Tietze. Distributed under the MIT License.