Contents

transformAnchorPreference(key:value:transform:)

Sets a value for the specified preference key, the value is a function of the key’s current value and 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 transformAnchorPreference<A, K>(key _: K.Type = K.self, value: Anchor<A>.Source, transform: @escaping (inout K.Value, Anchor<A>) -> Void) -> 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.

See Also

Setting preferences based on geometry