Search code examples
iosswiftuiviewtouchviewcontroller

Make presented view controller to ignore and pass through touch events


edit: I want to make this view independent to be reusable.

The question explains itself. I have searched, but didn't find any answers, even if the question seems to be common.

I have two view controllers VC1 and VC2. My code is like:

VC1.present(VC2, animated: true)

Then, I need my VC2 to totally ignore all touches and pass them through.

Good example is AppStore rating success alert (attached). You can scroll even when alert is presented, I need the same behavior. enter image description here


Solution

  • You should use an UIView and just overlay it over your VC1. Then the VC1 stays scrollable even when the UIView is presented