Change ViewController Programmatically


I need my program to switch to a different viewcontroller when a certain condition is met without the user having to press a button or take action. I understand that the way to do this, at least in Swift, is to use the present method, e.g.:

let storyBoard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let newViewController = storyBoard.instantiateViewController(withIdentifier: "newViewController") as! NewViewController
        self.present(newViewController, animated: true, completion: nil)

However, I can’t seem to access the present method from within my java classes. How do I switch to a new view controller?


As the parameters are not named in Java, Multi-OS Engine appends the parameters to the original Swift function name:

func someFunc(paramA: ..., paramB)

void someFuncParamAParamB(..., ...)

1 Like