interestingibis
11/27/2019 - 9:16 PM

Updating Observable Object

class MyClass: ObservableObject {
    
    public let objectWillChange = ObservableObjectPublisher()
    
    var myValue: Bool!
    
    func changeValue(to newValue: Bool) {
        myValue = newValue
        
        // When updating object, call following to publish
        objectWillChange.send()
    }
    
}