EPISODE · Jun 29, 2026 · 3 MIN
SwiftUI’s @State Is Now a Macro - What It Means for You
from Programming Tech Brief By HackerNoon · host HackerNoon
This story was originally published on HackerNoon at: https://hackernoon.com/swiftuis-state-is-now-a-macro-what-it-means-for-you. SwiftUI’s @State is now exposed as a macro. Learn what changed, how lazy initialization works, and how to use @State with @Observable models. Check more stories related to programming at: https://hackernoon.com/c/programming. You can also check exclusive content about #swift, #swiftui, #ios-app-development, #ios-development, #swift-programming, #apple, #swift-changes, #hackernoon-top-story, and more. This story was written by: @element. Learn more about this writer by checking @element's about page, and for more stories, please visit hackernoon.com. TL;DR: SwiftUI’s `@State` is now exposed as a macro, but everyday usage stays almost the same. The biggest practical change is lazy initialization: class instances stored in `@State`, such as `@Observable` view models, are created once for the lifetime of the view’s state storage instead of being re-created whenever the view struct is rebuilt.
Embed this episode
NOW PLAYING
SwiftUI’s @State Is Now a Macro - What It Means for You
No transcript for this episode yet
Similar Episodes
No similar episodes found.
Similar Podcasts
No similar podcasts found.