Skip to main content

preference_key

Function preference_key 

Source
pub fn preference_key() -> &'static Conformance
Expand description

A PreferenceKey conformance whose Value is Swift.Int.

A preference key is an identity, never a value: SwiftUI instantiates the Value, not the key. So the key can be any nominal type, and this borrows SwiftUI.Spacer rather than synthesizing a type descriptor of its own.

Not a stdlib type, though — Swift.Int is the obvious candidate and it does not work. Registering a conformance for it leaves swift_conformsToProtocol still reporting none, presumably because the runtime resolves stdlib types by a path that does not consult registered records. A framework type registers and resolves normally.