Initializer

init(_:selection:content:)

Creates a picker that generates its label from a string.

Declaration 宣言

init<S>(_ title: S, selection: Binding<SelectionValue>, content: () -> Content) where S : StringProtocol
Available when Label is Text, SelectionValue conforms to Hashable, and Content conforms to View.

Parameters パラメータ

title

A string that describes the purpose of selecting an option.

selection

A binding to a property that determines the currently-selected option.

content

A view that contains the set of options.

Discussion 議論

This initializer creates a Text view on your behalf, and treats the title similar to init(_:). See Text for more information about localizing strings. このイニシャライザは、Textビューをあなたの代わりに作成します、そしてタイトルをinit(_:)と同じように扱います。Textを文字列のローカライズについてのさらなる情報として見てください。

To initialize a picker with a localized string key, use init(_:selection:content:) instead.

See Also 参照

Creating a Picker ピッカー(選び出し集)を作成する