Generic Instance Method

transformPreference(_:_:)

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

Declaration

func transformPreference<K>(_ key: K.Type = K.self, _ callback: @escaping (inout K.Value) -> Void) -> some View where K : PreferenceKey

See Also

Setting View Preferences

func preference<K>(key: K.Type, value: K.Value) -> View

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