vvit
11/3/2016 - 2:58 PM

UI.swift

// Check if a view controller is popped from navigation stack (either by `popViewController` or interactive transition)
// Method 1
override func didMove(toParentViewController parent: UIViewController?) {
    super.didMove(toParentViewController: parent)
    if parent == nil { // parent is `nil` when the vc is popped
    }
}

// Method 2
override func viewDidDisappear(animated: Bool) {
    super.viewDidDisappear(animated)    
    if self.isBeingDismissed() || self.isMovingFromParentViewController() {
    }
}