In order to fix this what I tried to do was use index that we use to set photoSelectorController and that seems to work the way I expect it to. The only issue I'm now having is that dismiss is not taking me back to home...
The code I am using is :
let cameraController = CameraController()
let navController = UINavigationController(rootViewController: cameraController)
present(navController, animated: true, completion: nil)
My code in cameraController is as follows :
class CameraController: UIViewController {
let dismissButton: UIButton = {
let button = UIButton(type: .system)
button.setImage("right_arrow_shadow"), for: .normal)
button.addTarget(self, action: #selector(handleDismiss), for: .touchUpInside)
return button
}()
@objc func handleDismiss() {
dismiss(animated: true, completion: nil)
}
override func viewDidLoad() {
super.viewDidLoad()
navigationController?.setNavigationBarHidden(true, animated: true)
view.addSubview(dismissButton)
dismissButton.anchor(top: view.topAnchor, left: nil, bottom: nil, right: view.rightAnchor, paddingTop: 12, paddingLeft: 0, paddingBottom: 0, paddingRight: 12, width: 50, height: 50)
}
}
Instead of moving back to the home tab it stays on the camera tab but only makes the tab bar, nav bar visible and sets a black background...
Basically what I am trying to do is implement your CameraController class (video 29) but make it appear from the tab bar instead of the nav bar.