I have main TabbarController which holds ViewController(A). From this A pushed another ViewController(B) using navigationController?.pushViewController From B pushed another ViewController(C) using navigationController?.pushViewController From C modally presented another ViewController(D). From D when use taps button , it should dismiss D and popToRootViewController .
I googled similar questions, but couldn't find solution yet.
How can I do this?
Create a protocol
In ViewController D, create a weak reference to the protocol
In ViewController C, conform to the protocol and popToRootVC in the function
Also in ViewController C, set ViewControllerD's delegate to self where you present the VC
At last, in ViewController D, in your dismiss function closure, call the delegate function