Example
class Demo {
var anInt: Int = 0 {
didSet {
print("anInt was set to: \(anInt)", terminator: "; \n")
}
}
}
var myObject = Demo()
let cancellable = (0...2).publisher
.assign(to: \.anInt, on: myObject)
Example
class Demo {
var anInt: Int = 0 {
didSet {
print("anInt was set to: \(anInt)", terminator: "; \n")
}
}
}
var myObject = Demo()
let cancellable = (0...2).publisher
.assign(to: \.anInt, on: myObject)