Hi everyone! I've encountered an issue while developing an app using SwiftUI and could use some help or suggestions. It seems that there's a conflict between using PasteButton and a background gesture simultaneously.
Xcode: 14.3.1
var body: some View {
VStack(spacing: 25) {
Button("button") {
debugPrint("tap button")
}
PasteButton(payloadType: String.self, onPaste: { _ in
debugPrint("tap PasteButton")
})
}
.background(.yellow)
.onTapGesture {
debugPrint("tap background")
}
}
In the code snippet above, when I tap the Button, it displays tap button.
However, when I tap the PasteButton, it shows tap background
. Strangely, if I long-press for a second and then release, it displays tap PasteButton
.
From the view hierarchy perspective, Button and PasteButton both appear at the top level. The only peculiar aspect is that upon screen generation, the PasteButton doesn't immediately appear; it gradually emerges with an animation after approximately 0.5 seconds.
If anyone has experience or thoughts on handling this PasteButton and background gesture issue in SwiftUI, I'd greatly appreciate your input. Thanks so much!