Initializer
init(_:tableName:bundle:icon:flipIcon:appearance:style:isFullWidth:action:)
Creates a button with a localized text and icon, looking up the key in the given bundle.. A raw string can also be given to be displayed.
- iOS 15.0+
- macOS 13.0+
- tvOS 16.0+
- visionOS 1.0+
- watchOS 11.0+
@MainActor init(_ key: LocalizedStringKey, tableName: String? = nil, bundle: Bundle = .main, icon: Image, flipIcon: Bool = false, appearance: OUDSButton.Appearance = .default, style: OUDSButton.Style = .default, isFullWidth: Bool = false, action: @escaping () -> Void)
Parameters
- key
A LocalizedStringKey used to look up the text in the given bundle, or a raw String to display
- tableName
The name of the .strings file, or nil for the default
- bundle
The bundle in which to look up the localized string. Defaults to Bundle.main.
- icon
An image which shoud contains an icon
- flipIcon
Default set to false, set to true to reverse the image (i.e. flip vertically)
- appearance
The button appearance, default set to .default
- style
The button style, default set to .default
- isFullWidth
Flag to let button take all the screen width, set to false by default.
- action
The action to perform when the user triggers the button
Discussion
// Use localizable
OUDSButton(LocalizedStringKey("validate_button"), bundle: Bundle.module, icon: Image("ic_checkmark"), appearance: .strong) { }