init(_:isOn:)
Creates a toggle that generates its label from a localized string key.
Declaration
nonisolated init(_ titleKey: LocalizedStringKey, isOn: Binding<Bool>)Parameters
- titleKey:
The key for the toggle’s localized title, that describes the purpose of the toggle.
- isOn:
A binding to a property that indicates whether the toggle is on or off.
Discussion
This initializer creates a Text view on your behalf, and treats the localized key similar to init(_:tableName:bundle:comment:). See Text for more information about localizing strings.