Generic Instance Method

preference(key:value:)

Sets a value to return for the given preference key when accessed by ancestors.

Declaration

func preference<K>(key _: K.Type = K.self, value: K.Value) -> some View where K : PreferenceKey

See Also

Setting View Preferences

func transformPreference<K>(K.Type, (inout K.Value) -> Void) -> View

Sets a callback to return a value for the given preference key when accessed by ancestors.