"rotation3DEffect" receives a tap gesture even though it is not visible on the screen.

When I tried to make Flipping Card with rotation3DEffect, I found that a Menu View nearby the Card not working.

So, I tried to find out what the problem is by making an example.


struct ContentView: View {

  @State var degree = 0.0

  var body: some View {

    ZStack {

      Spacer()

      Button(action: {

        print("Button Tapped")

      }) {

        Text("Button")

      }

      Rectangle()

        .fill(Color.green.opacity(0.3))

        .rotation3DEffect(Angle(degrees: degree), axis: (x: 0, y: 1, z: 0))

        .frame(maxWidth: .infinity, maxHeight: 300)

        .onTapGesture {

          withAnimation {

            if degree == 0 {

              degree = 90.0

            } else {

              degree = 0.0

            }

          }

        }

      Spacer()

    }

  }

}

In my example, when "Green View" is tapped, it rotates 90 degrees so it doesn't show up on the screen.

But if I tap again near where the "Green View" was, the "Green View" receive that tap gesture and the "Green View" goes back to where it was. Because "Green View" has taken the tap gesture, the button hidden behind “Green View” is never pressed.

This only happens when the view is rotated 90 degrees. 

If the view is rotated by 90.001 degrees or -90.001 degrees, not displayed on the screen, but in this case, the view does not receive the tap gesture.

I wonder if this is intentional.