I am stuck on this UI issue, working with SwiftUI and UIView.
Basically, overlay stops user interaction to follow through to the UIView.
Button(action: { print("hello") }){ Text("HERE") }
.overlay(
LinearGradient(
gradient: Gradient(colors: [.clear, Color.black.opacity(0.3)]),
startPoint: .top,
endPoint: .bottom
).allowsHitTesting(false))
Not working with UIView
struct ButtonView: UIViewRepresentable {
func makeUIView(context: Context) -> UIButton {
return UIButton(type: .close)
}
func updateUIView(_ uiView: UIButton, context: Context) {
}
}
ButtonView()
.overlay(
LinearGradient(
gradient: Gradient(colors: [.clear, Color.black.opacity(0.3)]),
startPoint: .top,
endPoint: .bottom
).allowsHitTesting(false))
Is anyone running into same trouble? Thanks!