anchorPreference(key:value:transform:)
Sets a value for the specified preference key, the value is a function of a geometry value tied to the current coordinate space, allowing readers of the value to convert the geometry to their local coordinates.
Declaration
nonisolated func anchorPreference<A, K>(key _: K.Type = K.self, value: Anchor<A>.Source, transform: @escaping (Anchor<A>) -> K.Value) -> some View where K : PreferenceKey
Parameters
- key:
The preference key type.
- value:
The geometry value in the current coordinate space.
- transform:
The function to produce the preference value.
Return Value
A new version of the view that writes the preference.