iOS 17 @Observable and the Observation Framework

<p>WWDC 2023 introduced us to the new iOS-17<code>@Observable</code>&nbsp;property wrapper along with a cleaned-up&nbsp;<code>@State</code>&nbsp;that now supersedes the previous&nbsp;<code>@State</code>&nbsp;<code>@ObservedObject</code>,&nbsp;<code>@StateObject</code>. This is fantastic &mdash; it&rsquo;s always been a source of confusion for those starting on SwiftUI and a source of bugs (with various recommendations on what to use and when).</p> <p>All this feels like it&rsquo;s gone and we are left with the simple choice of&nbsp;<code>@Environment</code>,&nbsp;<code>@State</code>, and&nbsp;<code>@Bindable</code>&nbsp;with clean usage (in order: app-wide, view-wide, and binding to a parent). Love it!</p> <p>Let&rsquo;s take a quick look at how this works. You&rsquo;ll notice that tapping the button triggers a screen refresh to display the new value of&nbsp;<code>myString</code>. You also no longer need&nbsp;<code>@Published</code>. Fantastic!</p> <p><a href="https://betterprogramming.pub/ios-17-observable-and-the-observation-framework-152deaf8fc5e">Read More</a></p>