Last active
January 9, 2022 19:57
-
-
Save adamzarn/723fec6c6af9f42ad8d65ada9c350252 to your computer and use it in GitHub Desktop.
UIViewController Extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension UIViewController { | |
func showViewController(withIdentifier identifier: String, storyboardName: String = "Main") { | |
DispatchQueue.main.async { | |
let storyboard = UIStoryboard(name: storyboardName, bundle: nil) | |
let viewController = storyboard.instantiateViewController(withIdentifier: identifier) | |
self.view.window?.setRootViewController(viewController) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment