Swift 5 iOS13 - Segue to another Storyboard or unconnected View Controller without creating Card View

二次信任 提交于 2019-12-11 15:19:55

问题


keyWindow is also deprecated in iOS 13 thus making me find another solution for this problem.

With the current updates with Swift 5.1, iOS 13, and Xcode 11 the code below when used creates the "card view" so users can easily swipe down and return to the previous view. Yet, the problem is that if a user logs in or logs out when using the code below the user can return to the login screen or main app after logging out which is problematic. What is the best way to segue users between storyboards or unconnected view controllers to where it does not create the "card view"? The problem with the "Work around solution" is that keyWindow is deprecated. It works yet looking for a official solution.

Old way to segue between storyboards and unconnected view controllers

let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Start")
self.present(vc, animated: true, completion: nil)

Work around solution

let vc = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "homeVC") as! UITabBarController 
UIApplication.shared.keyWindow?.rootViewController = vc

回答1:


If you really like the “old way” just keep using it but add a line setting the modalPresentationStyle of vc to .fullScreen.



来源:https://stackoverflow.com/questions/58151928/swift-5-ios13-segue-to-another-storyboard-or-unconnected-view-controller-witho

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!