TestsTested | ✗ |
LangLanguage | SwiftSwift |
License | MIT |
ReleasedLast Release | Jun 2015 |
SPMSupports SPM | ✗ |
Maintained by Tribus Hannes.
These classes are supposed to be used inside your frameworks when you want to provide certain pro-features to customers that pay a license fee or limit the whole use od the framework to the simulator.
That's a bit complex, as CommonCrypto is not (yet) available directly to swift. So what you need to do is
module CommonCrypto [system] {
header "/usr/include/CommonCrypto/CommonCrypto.h"
export *
}
CommonCrypto
to the "Build Settings --> SwiftCompiler - Search Paths --> Import Paths"
# Usage// Set a License key (That will be provided by your customer)
THLicense.sharedLicense.setLicenseKey("db693f13bf2267c510a2e202afcca4067a16d8ed")
// Set a constant Salt
THLicense.sharedLicense.setSalt("123456")
// Only during development
//THLicense.sharedLicense.debugMode = true
// Check if the License is valid
if (THLicense.sharedLicense.isLicenseValid()) {
// continue with your framework execution
}
If you put it in debug mode it will show you in the log the possible valid license keys. Currently it uses the bundleId and the salt to create the keys and checks are performed in the following order
In that way you can sell licenses to all APPs in a company or just for a single App
...are really welcome. Maybe there is a better way of doing this checks, or it needs additional settings, so I'd like to improve it with your help.
Source code of this project is available under the standard MIT license. Please see the license file.