0

I have an app that has a begin journey activity and a choose category activity. I want to make it that after the user presses the start journey button he won't be able to return there or be able with a certain button.

2 Answers2

0

Set the next viewController as the root viewController as described here: How to set the rootViewController with Swift, iOS 7

Joseph Beuys' Mum
  • 2,395
  • 2
  • 24
  • 50
0

It seems like you’re looking for the root view of the app to be changed to the beginning of the journey, rather than the initial home screen. This can be done by setting the rootViewController property of the app’s main window, UIApplication.shared.keyWindow.

This can be done using the following code block:

let viewController = JourneyViewController()
guard
let window = UIApplication.shared.keyWindow
    else {
        return
    }
window.rootViewController = viewController

Please note, I work in Xcode 11 beta with iOS 13. My apologies if this doesn’t work with older versions of iOS/OS X.

ntrupin
  • 454
  • 8
  • 13