2

I would like to have a List with an overlay that does not interfere with the tap reception in SwiftUI.

I have attempted to use an .overlay as such;

struct TestView: View {
    var body: some View {
        List(0..<30){
            Text("Item \($0)")
        }.overlay(LinearGradient(gradient: Gradient(colors: [.purple, .clear]), startPoint: .bottom, endPoint: .center))
    }
}

However, this results in the list not being scrollable (or if using NavigationLinks, not clickable).

How can I have an overlay (or Z-Stack element for that matter) not receive any taps?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Isaiah
  • 1,852
  • 4
  • 23
  • 48
  • With `.allowsHitTesting(false)` works for tappable controls (like Button), but for `List` and `ScrollView` does not work. – Asperi Dec 25 '19 at 11:13

0 Answers0