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

    action

    The action to perform when the button is triggered.

    label

    The 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 Text visual representation.

    Declaration

    Swift

    public init(_ title: String, action: @escaping () -> Void)

    Parameters

    title

    The title of the button.

    action

    The 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