Search code examples
iosswiftuiviewcontrollercontainers

Swift - ContainerView covering ViewController


I have a ViewController and a containerView. The problem is that my containerView is covering my ViewController so I can't click the buttons inside my ViewController.

enter image description here

I know I can self.view.sendSubviewToBack(containerView) but that doesn't solve my problem because I actually want the containerView(bottomBar + settingsButton) to be visible on the foreground.

Is there any way I can have the containerView on top of my ViewController and still be able to click the buttons inside my ViewController?


Solution

  • You need to reverse the containment , the vc that have the addButton and the bottom bar should hold the other vc and by this you can control the visibility of the childVC ( the one the pop out when you click add ) by sending it back to what you need it visible above it