Button
public struct Button : View
extension Button: Renderable
A view that can be tapped by the user to trigger some action.
-
Declaration
Swift
public var viewStore: ViewValues -
Creates an instance that triggers an
action.Declaration
Swift
public init(action: @escaping () -> Void, @ViewBuilder label: () -> View)Parameters
actionThe action to perform when the button is triggered.
labelThe visual representation of the button
-
Performs the primary action.
Declaration
Swift
public func trigger() -
Declaration
Swift
public var body: View { get } -
Creates an instance with a
Textvisual representation.Declaration
Swift
public init(_ title: String, action: @escaping () -> Void)Parameters
titleThe title of the button.
actionThe action to perform when the button is triggered.
-
Declaration
Swift
public func updateView(_ view: UIView, context: Context) -
Declaration
Swift
public func createView(context: Context) -> UIView
View on GitHub
Button Structure Reference