RGAppVersion 0.1.2

RGAppVersion 0.1.2

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最新发布2016年11月
SwiftSwift 版本3.0
SPM支持 SPM

Roman Gille 维护。



  • Roman Gille

RGAppVersion

一个简单的类,用于访问 iOS 应用版本和跟踪应用更新。

安装

只需将 RGAppVersion.swift 拖入您的项目中。

或者如果您使用 CocoaPods,将以下代码添加到 Podfile 中

pod 'RGAppVersion'

用法

RGAppVersion.currentVersion() 返回应用当前版本,RGAppVersion.lastVersion() 返回应用最后一次启动的版本。

// Print the current installed app version.
print(RGAppVersion.currentVersion().combinedVersion)

// Print the last installed app version.
print(RGAppVersion.lastVersion())

// React on a new installation.
if RGAppVersion.appIsFreshInstalled() {
    print("New installation")
}

// React on app update.
if RGAppVersion.appWasUpdated() {
    print("App update from \(RGAppVersion.lastVersion()!.combinedVersion) to \(RGAppVersion.currentVersion().combinedVersion)")
}

请注意,当您第一次使用 RGAppVersion 时,它将始终识别为全新安装。