Contents

init(_:systemImage:sources:selection:content:currentValueLabel:)

Creates a picker bound to a collection of bindings that accepts a custom current value label and generates its label from a string.

Declaration

nonisolated init<C, S>(_ title: S, systemImage: String, sources: C, selection: KeyPath<C.Element, Binding<SelectionValue>>, @ViewBuilder content: () -> Content, @ViewBuilder currentValueLabel: () -> some View) where C : RandomAccessCollection, S : StringProtocol, C.Element == Binding<SelectionValue>

Parameters

  • title:

    A string that describes the purpose of selecting an option.

  • systemImage:

    The name of the image resource to lookup.

  • sources:

    A collection of values used as the source for displaying the Picker’s selection.

  • selection:

    The key path of the values that determines the currently-selected options. When a user selects an option from the picker, the values at the key path of all items in the sources collection are updated with the selected option.

  • content:

    A view that contains the set of options.

  • currentValueLabel:

    A view that represents the current value of the picker.