After various attempts, the final decision was to handle it using a workaround approach, by utilizing ZStack to place the background and PasteButton in different view stacks.
var body: some View {
ZStack {
Color.yellow
.frame(maxWidth: .greatestFiniteMagnitude, maxHeight: .greatestFiniteMagnitude)
.onTapGesture {
debugPrint("tap background")
}
VStack(spacing: 25) {
Button("button") {
debugPrint("tap button")
}
PasteButton(payloadType: String.self, onPaste: { _ in
debugPrint("tap PasteButton")
})
}
}
}
Topic:
UI Frameworks
SubTopic:
SwiftUI
Tags: