PreferenceKey

public protocol PreferenceKey : AnyPreferenceKey

A named value produced by a view.

A view with multiple children automatically combines its values for a given preference into a single value visible to its ancestors.

  • The type of value produced by this preference.

    Declaration

    Swift

    associatedtype Value
  • The default value of the preference.

    Declaration

    Swift

    static var defaultValue: Self.Value { get }
  • Combines a sequence of values by modifying the previously-accumulated value with the result of a closure that provides the next value.

    Declaration

    Swift

    static func reduce(value: inout Self.Value, nextValue: () -> Self.Value)