DEV Community

Oluwasanmi Aderibigbe
Oluwasanmi Aderibigbe

Posted on

Day 80 of 100 days of SwiftUI

I just completed day 80 of 100 days of swiftui. I learnt about to use the swift result class and how manually publishing ObservableObject changes.

The swift result class is simply a class that is used to represent success or failure. It makes error handling easier because you have to handle all the cases explicitly.

Maually publishing observableobject changes is a simple as calling objectWillChange.send() in a property observer. For example, you can do this

var value = 0 {
    willSet {
        objectWillChange.send()
    }
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)