I am making a basic app that lets users sign up and login and they will be directed to the main page which has horizontal scrolling and paging enabled. The main view has 3 views which you can swipe left or right to go to the other pages. Here is the code where I set the root view controller. NOTE: Only if the user has logged in this view controller will be displayed.
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
FirebaseApp.configure()
window = UIWindow(frame: UIScreen.main.bounds)
let homeScreen = MainScreen()
let navBar = UINavigationController(rootViewController: homeScreen)
window?.rootViewController = navBar
window?.makeKeyAndVisible()
return true
}
}
I want to display the main page once the user logs in, but the main page doesn't get displayed. Here is the code when the user taps on the login button, I've only given the necessary code:
// User found and verified, go to main page
let mainPage = MainScreen()
self.navigationController?.pushViewController(mainPage, animated: true)
The pushViewController doesn't work.