init(_:value:format:)
Creates a labeled informational view from a formatted value.
Declaration
init<F>(_ titleKey: LocalizedStringKey, value: F.FormatInput, format: F) where F : FormatStyle, F.FormatInput : Equatable, F.FormatOutput == StringParameters
- titleKey:
The key for the view’s localized title, that describes the purpose of the view.
- value:
The value being labeled.
- format:
A format style of type
Fto convert the underlying value of typeF.FormatInputto a string representation.
Discussion
This initializer creates a Text label on your behalf, and treats the localized key similar to init(_:tableName:bundle:comment:). See Text for more information about localizing strings.
Form {
LabeledContent("Age", value: person.age, format: .number)
LabeledContent("Height", value: person.height,
format: .measurement(width: .abbreviated))
}