do we no longer need @environmentobject and other property wrappers? are @environment, @state and @bindable enough?
Generated on 8/2/2024
1 search
The property wrappers @environmentObject
, @state
, and @binding
are still relevant and necessary in SwiftUI. The new improvements and features introduced at WWDC 2024, such as the entry macro, make it easier to work with environment values and other state management tools, but they do not replace the existing property wrappers.
For example, the entry macro simplifies the process of conforming to EnvironmentKey
and extending EnvironmentValues
, but it does not eliminate the need for @environmentObject
or other property wrappers. These wrappers are fundamental to managing state and dependencies in SwiftUI.
To learn more about these improvements, you can check out the session What’s new in SwiftUI (13:25).
Relevant Sessions
A Swift Tour: Explore Swift’s features and design
Learn the essential features and design philosophy of the Swift programming language. We’ll explore how to model data, handle errors, use protocols, write concurrent code, and more while building up a Swift package that has a library, an HTTP server, and a command line client. Whether you’re just beginning your Swift journey or have been with us from the start, this talk will help you get the most out of the language.
Enhance your UI animations and transitions
Explore how to adopt the zoom transition in navigation and presentations to increase the sense of continuity in your app, and learn how to animate UIKit views with SwiftUI animations to make it easier to build animations that feel continuous.
SwiftUI essentials
Join us on a tour of SwiftUI, Apple’s declarative user interface framework. Learn essential concepts for building apps in SwiftUI, like views, state variables, and layout. Discover the breadth of APIs for building fully featured experiences and crafting unique custom components. Whether you’re brand new to SwiftUI or an experienced developer, you’ll learn how to take advantage of what SwiftUI has to offer when building great apps.
What’s new in SwiftUI
Learn how you can use SwiftUI to build great apps for any Apple platform. Explore a fresh new look and feel for tabs and documents on iPadOS. Improve your window management with new windowing APIs, and gain more control over immersive spaces and volumes in your visionOS apps. We’ll also take you through other exciting refinements that help you make expressive charts, customize and layout text, and so much more.
What’s new in Xcode 16
Discover the latest productivity and performance improvements in Xcode 16. Learn about enhancements to code completion, diagnostics, and Xcode Previews. Find out more about updates in builds and explore improvements in debugging and Instruments.