[SOLVED] Swift: Function Called when Back is pressed

Issue

I would like to perform some actions when a user presses the “Back” button on my Navigation Controller. Is there a Swift function that is called when this happens?

enter image description here

Solution

override func viewWillDisappear(animated: Bool) {
// Do Your Lines of Code ... 
}

Everytime when back button or Done is pressed or a view is popped out this function is called.. you need to override this..

Answered By – Abdul Waheed

Answer Checked By – Clifford M. (BugsFixing Volunteer)

Leave a Reply

Your email address will not be published.