2

I have two class A and B .

class A{ 

override func viewWillAppear(_ animated: Bool) { . 

print("")
}

     let myPost = self.storyboard?.instantiateViewController(withIdentifier: "Completed") as! Completed

        myPost.transitioningDelegate = self as? UIViewControllerTransitioningDelegate
        myPost.modalPresentationStyle = .custom

        self.present(myPost, animated: true, completion: nil)

}
class B{ . 

 dismiss(animated: true, completion: nil)
}

Here I am presenting class B from class A. But when I am dismissing class B the viewWillApper (in class A) is not calling. How to achive this?

Enrique Bermúdez
  • 1,587
  • 2
  • 8
  • 21
Manas Nayak
  • 143
  • 7
  • Can you please [edit] your question and post real, relevant code that actually replicates your issue. – rmaddy Jan 16 '19 at 23:55

1 Answers1

0

You can use viewdidload() or awakefromnib() to be called when you present other contollers like A from B or B from A

Nishant Pathania
  • 343
  • 1
  • 12
  • Hi Mayank in my case when i am comming back to B to A none of these ,viewdidload() or awakefromnib() is working – Manas Nayak Jan 17 '19 at 11:30
  • When you dismiss a controller the one behind has been loaded already. So if you want to perform any function on dismissal you can put it in the dismiss method or can use segue or push controller then view didLoad() will be called – Nishant Pathania Jan 17 '19 at 13:17