swift – In IOS 14, Dismissing a Presented View Controller Not Working, But in IOS 15, and 16 Working Fine

0
234


This is How I Present ViewController,

 func navigateToRegistrationPage(){
            // 1
            let storyboard = UIStoryboard(name: "EkycRegistrationMain", bundle: 
                                          Bundle(identifier: DK_BUNDLEIDENTIFIER))
            // 2
            let controller = storyboard.instantiateViewController(withIdentifier: 
                                             "SplashScreenVC") as! SplashScreenVC
            let navigationController = UINavigationController(rootViewController: 
                                                                      controller)
            // 4
            self.present(navigationController, animated: true, completion: nil)
        }

and This is How I Dismiss

  class EkycInit: NSObject {
    
    var initiatedVC : UIViewController?

    public static let shared  = EkycInit()

    private override init() {
        super.init()
    }

    public func stopEKYC() {
        initiatedVC?.dismiss(animated: true, completion: nil)
    }

}

clicking on Login Button ViewController Should Dismiss

@IBAction func loginButtonClicked(_ sender: UIButton) {
        EkycInit.shared.stopEKYC()
}

This Code Works fine in IOS 15+