/AppVersion

Primary LanguageSwiftMIT LicenseMIT

AppVersion

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.3let newVersion : Version = getNewVersionFromAppStore()
if appVersion < newVersion {
    // You need upgrade
}

引入工程的方式

AppVersion 支持 CocoaPods。你只需要在你的Podfile中加入下面的设置:

use_frameworks!
pod 'AppVersion'

作者

卡爸,woshizilong@hotmail.com

Todo

  • let version : Version = UIDevice.currentDevice().systemVersion
  • Version.SystemVersion
  • Version.AppVersion
  • let version : Version = Version(bundlePath: "Alamofire.framework")
  • version > "1.0.3"

License

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