Is there a function to terminate the UIviewcontroller like in Android?

In android, you can call the method finish()

and the activity is closed. Is there something similar in fast?

+3


source to share


2 answers


Not really. In iOS land, you have to more explicitly call viewController.dismissViewControllerAnimated(true, completion: nil)

if your view controller is modal, or one of the various firing methods in the UINavigationController if your viewController was clicked on the screen.

In Swift 3, this function:



viewController.dismiss(animated: true)

      

+8


source


Simple elegant solution, write below line to close the current view controller



self.dismiss(animated: true, completion: nil)

      

+1


source







All Articles