OverlayButton

@MainActor
public struct OverlayButton<BaseShape, Content> : View where BaseShape : View, Content : View

A customizable overlay button that takes a view as a base shape and returns it as an overlay, so that it can be customized (e.g frame for tappable area) without interfering with layout of surrounding objects.

  • Declaration

    Swift

    @MainActor
    public init(
    	action: @escaping () -> Void,
    	@ViewBuilder baseShape: @escaping () -> BaseShape,
    	@ViewBuilder decoration: @escaping (BaseShape) -> Content
    )

    Parameters

    baseShape

    A closure that returns the base shape of the button.

    decoration

    A closure that takes the base shape as a parameter and returns the decorated content.

    action

    A closure representing the action to be performed when the button is tapped.

  • Declaration

    Swift

    @MainActor
    public var body: some View { get }