
- Check whether the APP is installed for the first time?
- 检测该APP是否为第一次安装?

dependencies: [
.package(url: "https://github.com/William-Weng/WWAppFirstInstall.git", .upToNextMajor(from: "1.0.1"))
]
函式 |
功能 |
insert(appId:) |
加入AppId到纪录之中 |
detect(appId:) |
检测该AppId是否安装过? |
reset(appId:) |
将安装过的记录删除 |
installTime(appId:) |
获取安装时间 (秒) |
dictionary() |
获取安装过的全记录 => [《AppId》:《安装时间》] |
clean() |
全记录清除 |
import UIKit
import WWPrint
import WWAppFirstInstall
final class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
demo()
}
}
private extension ViewController {
func demo() {
WWAppFirstInstall.shared.clean()
let appIdArray = [
"idv.william.Example1",
"idv.william.Example2",
"idv.william.Example3",
]
wwPrint("DICT => \(WWAppFirstInstall.shared.dictionary())")
appIdArray.forEach { appId in
_ = WWAppFirstInstall.shared.insert(appId: appId)
wwPrint("DICT => \(WWAppFirstInstall.shared.dictionary()!)")
}
appIdArray.forEach { appId in
wwPrint(WWAppFirstInstall.shared.installTime(appId: appId))
}
_ = WWAppFirstInstall.shared.reset(appId: appIdArray[1])
wwPrint("DICT => \(WWAppFirstInstall.shared.dictionary()!)")
}
}