AppVersion是一个Swift Framework,适配Semantic Versioning 2.0.0版本号系统。
实现了如下协议:
- Equatable
- Comparable
- CustomStringConvertible
- StringLiteralConvertibleHashable
AppVersion可以传入用'.'分割的版本字符串来实例化:
let version = Version(versionStringWithDot: "1.0.0")
或者直接用'.'分割的版本字符串直接转化:
let version : Version = "1.0.0"
AppVersion支持互相间的比较:
let appVersion : Version = “1.2.3”
let newVersion : Version = getNewVersionFromAppStore()
if appVersion < newVersion {
// You need upgrade
}
AppVersion 支持 CocoaPods。你只需要在你的Podfile中加入下面的设置:
use_frameworks!
pod 'AppVersion'
- let version : Version = UIDevice.currentDevice().systemVersion
- Version.SystemVersion
- Version.AppVersion
- let version : Version = Version(bundlePath: "Alamofire.framework")
- version > "1.0.3"
Version is available under the MIT license. See the LICENSE file for more info.