@Forever("todos") var todos = [Todo(title: "Feed the cat", isCompleted: true),
Todo(title: "Play with cat"),
Todo(title: "Get allergies"),
Todo(title: "Run away from cat"),
Todo(title: "Get a new cat")]
struct Todo: Codable {
var title: String
var isCompleted = false
}
@Forever("counter") var counter = 1
Thanks #1.
class ViewController: UIViewController {
@Forever("counter") var counter = 1
var cancellables = Set<AnyCancellable>()
override func viewDidLoad() {
super.viewDidLoad()
_counter.sink(receiveValue: { value in
print(value)
})
.store(in: &cancellables)
}
//...
}
@DontDie("name") var name = "Potato"
@DontLeaveMe("todo") var todo = Todo(...)
@BePersistent("a") var b = true
Platform | Version |
---|---|
iOS | 13.0 or later |
macOS | 11.0 or later |
watchOS | 6.0 or later |
tvOS | 13.0 or later |
In Xcode, File → Add Packages… → Paste https://github.com/jiachenyee/forever
in the search field.