plane.firstMaterial?.diffuse.contents blocking all interactions

I am currently working with ARKit for one of my apps right now. I ran into this one weird issues and I have been stuck on it for a while.

The app has a bottom tray with 4 tabs total. The 2nd tab is where the ARKit component is. In the ARKit tab, the app is supposed to be able to scan a QR code and display a custom view as an overlay on top of the QR code. I was able to achieve that by doing something like this. plane.firstMaterial?.diffuse.contents = self.imageDisplayView. I got as far as having the app smart enough to scan different QR codes and display different kind of custom views, etc.

Here is where it gets weird, once the app scans the QR code and display a custom view, I can click on one of the buttons in the bottom tray to navigate away from the ARKit tab, but after that, the whole entire app locks up and nothing is clickable anymore.

I have tried calling session.pause() in viewDidDisappear and not calling it and it doesn't make any difference.

Any advice would help. Thank you

plane.firstMaterial?.diffuse.contents blocking all interactions
 
 
Q