DEV Community

Oluwasanmi Aderibigbe
Oluwasanmi Aderibigbe

Posted on

1 1

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)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay