ImageTextButton
public struct ImageTextButton : View
A button that displays an image and/or text, and performs an action when tapped.
Important
This is a Public Preview API. It may be changed or removed at any time.-
Initializes the button with both text and an image.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public init(_ text: String, imageName: ImageName, _ action: @escaping () -> ())
Parameters
text
The text to display in the button.
imageName
The name of the image to display in the button.
action
The action to perform when the button is tapped.
-
Initializes the button with optional text.
Important
This is a Public Preview API. It may be changed or removed at any time.Declaration
Swift
public init(_ text: String?, _ action: @escaping () -> ())
Parameters
text
The optional text to display in the button.
action
The action to perform when the button is tapped.
-
Initializes the button with an image.
Declaration
Swift
public init(_ imageName: ImageName, _ action: @escaping () -> ())
Parameters
imageName
The name of the image to display in the button.
action
The action to perform when the button is tapped.
-
The content and behavior of the view.
Declaration
Swift
public var body: some View { get }