0

I updated to Swift 5 and now whenever I open my app, the main screen appears as some sort of pop up and when you swipe down, it closes and presents a blank screen, messing up the app. Any idea on how to fix this? I don't even know where to begin to look.

Here's an image of the screen:

enter image description here

For the blank screen in the back, here is the code that I use to determine what screen should be on top. As mentioned before, In previous versions, the screen never appears as something that could just be dropped down.

class MainNavigationController: UINavigationController {

override func viewDidLoad() {
    //Sets the background to Indexed Green.
    view.backgroundColor = Colors.indexedPrimary

    //Checks to see if the user is logged in.
    if isLoggedIn() {
        perform(#selector(showApp), with: nil, afterDelay: 0.01)
    } else {
        //Show the logInController if the user isn't logged in already/
        //The missing piece.
        perform(#selector(showLogInController), with: nil, afterDelay: 0.01)
    }
}


//LoggedIn Function
fileprivate func isLoggedIn() -> Bool{
   return UserDefaults.standard.isLoggedIn()
}


//Shows the app if the user is logged in.
@objc func showApp(){
    let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let vc: UITabBarController = storyboard.instantiateViewController(withIdentifier: "TabBarController") as! UITabBarController
    self.present(vc, animated: true, completion: nil)
}


//Show the loginController if the user isn't logged in already.
@objc func showLogInController(){
    let loginScreen: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
    let viewcontrol: UIViewController = loginScreen.instantiateViewController(withIdentifier: "NewUsersScreenViewController") as UIViewController
    self.present(viewcontrol, animated: true, completion: nil)
}

}

Vandal
  • 708
  • 1
  • 8
  • 21
  • 1
    This is how iOS 13 works. It has nothing to do with the version of Swift. – rmaddy Oct 17 '19 at 01:08
  • [View Controller Presentation Changes in iOS 13](https://medium.com/@hacknicity/view-controller-presentation-changes-in-ios-13-ac8c901ebc4e) – MadProgrammer Oct 17 '19 at 01:10
  • 1
    if you want to disable the swipe to dismiss feature, whenever you present a new viewController add viewController.isModalInPresentation = true before presenting. – Frankenxtein Oct 17 '19 at 10:46

0 Answers0