Instance Method インスタンスメソッド

environmentObject(_:)

Supplies an ObservableObject to a view subhierarchy.

Declaration 宣言

func environmentObject<T>(_ object: T) -> some View where T : ObservableObject

Parameters パラメータ

object

the object to store and make available to the view’s subhierarchy.

Discussion 議論

The object can be read by any child by using EnvironmentObject.