In android you can call the method finish()
and the activity closes. Is there something similar in swift?
Not quite. In iOS land you have to more explicitly call viewController.dismissViewControllerAnimated(true, completion: nil)
if your view controller is a modal or one of the various dismissal methods on UINavigationController if your viewController was pushed on to the screen.
In Swift 3 this function is:
viewController.dismiss(animated: true)
Simple Elegant Solution, write the below line to dismiss your current View Controller
self.dismiss(animated: true, completion: nil)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With