One Logo Pool Ball
SwiftUICore · IOS API REFERENCE

EnvironmentObject

struct · iOS 13.0+ · SDK 27.1

@MainActor @frozen @propertyWrapper @preconcurrency struct EnvironmentObject<ObjectType> where ObjectType : ObservableObject

A property wrapper type for an observable object that a parent or ancestor view supplies. An environment object invalidates the current view whenever the observable object that conforms to <doc://com.apple.documentation/documentation/Combine/ObservableObject> changes. If you declare a property as an environment object, be sure to set a corresponding model object on an ancestor view by calling its ``View/environmentObject(_:)`` modifier. > Note: If your observable object conforms to the <doc://com.apple.documentation/documentation/Observation/Observable> protocol, use ``Environment`` instead of `EnvironmentObject` and set the model object in an ancestor view by calling its ``View/environment(_:)`` or ``View/environment(_:_:)`` modifiers.

Members (0)

This type has no directly callable members in this snapshot. See the framework’s skipped declarations for unsupported APIs.

Skipped declarations

3 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

EnvironmentObject.wrappedValue

This declaration needs Swift generic type arguments. (no canonical witness for ObjectType)

EnvironmentObject.projectedValue

The containing type needs Swift generic type arguments. (no canonical witness for ObjectType)

EnvironmentObject.init()

The containing type needs Swift generic type arguments. (no canonical witness for ObjectType)

All SwiftUICore types →