Search code examples
swiftinternals

'removeChild' is inaccessible due to 'internal' protection level


'removeChild' is inaccessible due to 'internal' protection level Extra argument 'in' in call

removeChild(bottomSheet)
addChild(bottomSheet, in: view)

Solution

  • That's not the method you are looking for. This is how you remove a child view controller from it's parent:

        viewController.willMove(toParent: nil)
        viewController.view.removeFromSuperview()
        viewController.removeFromParent()
    

    It looks like you're trying to remove bottomSheet, so replace viewController in my code with that.