swiftuiviewcontrollerios13xcode11uimodalpresentationstyle

Google & Facebook Login Controllers presenting modally in Xcode 11 iOS 13


I have updated the pods to the latest version and

Overriden the method

override func present(_ viewControllerToPresent: UIViewController,
                      animated flag: Bool,
                      completion: (() -> Void)? = nil) {
  viewControllerToPresent.modalPresentationStyle = .fullScreen
  super.present(viewControllerToPresent, animated: flag, completion: completion)
}

All other controllers are presenting full screen but Google and Facebook Login are still presenting as page sheet.

How Do I present them full screen as earlier ?

Facebook Login Screenshot Google Login Screenshot

Thanks in advance!

Updated

I found a workaround. If I set my LoginViewController as rootViewController of the window then they present full screen, but if I present them from a UINavigationController, then they present modally.

    func showSignUpScreen() {
      let controller:SignUpViewController =   UIStoryboard.instantiateViewController(storyboardName: .loginSignup, viewControllerIdetifier: "SignUpViewController") 
      self.navigationController?.interactivePopGestureRecognizer?.isEnabled = false

      //Presents full Screen
      UIApplication.shared.delegate?.window??.rootViewController = controller

      //Presents Modally
      self.navigationController?.pushViewController(controller, animated: false)
}

But I can't always present as Tab Bar gets hidden when presented on window. I need tab bars to show other screens which don't require login.

Tab Bar Presented on window


Solution

  • following extension for showing safari view in full screen mode

    import SafariServices
    
    extension  SFSafariViewController {
        override open var modalPresentationStyle: UIModalPresentationStyle {
            get { return .fullScreen}
            set { super.modalPresentationStyle = newValue }
        }
    }