测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布最新发布 | 2016年11月 |
SwiftSwift 版本 | 3.0 |
SPM支持 SPM | ✗ |
由 Roman Gille 维护。
一个简单的类,用于访问 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 时,它将始终识别为全新安装。