When I adding or removing element in names
array, no any result. following the code.
Could you give and advice?
class SomeClass: NSObject {
@objc var names = ["A", "B", "C"]
var cancellable: AnyCancellable?
override init () {
self.cancellable = names.publisher
.sink { name in
print("name: \(name)")
}
}
}
let someClass = SomeClass()
someClass.names.removeLast()
// === results ===
// name: A
// name: B
// name: C
1 post - 1 participant