
- Use the "property wrapper" to make an enhanced version of Keychain, so that Keychain can be as convenient as UserDefaults.
- 利用「屬性包裝器」做成Keychain加強版,讓Keychain也能跟UserDefaults一樣方便。

dependencies: [
.package(url: "https://github.com/William-Weng/WWKeychain.git", .upToNextMajor(from: "1.0.4"))
]
import UIKit
import WWPrint
import WWKeychain
final class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
keychainTest()
}
/// WWKeychain測試
func keychainTest() {
let urlString = "https://developer.apple.com/videos/play/wwdc2019/262/"
let newValue = "https://www.appcoda.com.tw/app-security/"
@WWKeychain("PASSWORD") var password: String?
password = urlString
wwPrint(password)
password = newValue
wwPrint(password)
password = nil
wwPrint(password)
}
}