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