I have a ViewController that need to display in two places.
In first place, the VC need to present and dismiss using a cancel button in its navigation bar.
In second place, the VC need to push to a navigation stack(its presented modally too) and cannot close (user have to use the back button in navigation stack).
I can display the VC in both places correctly but cannot use the close button properly. When I add the cancel bar button item to the VC, it appears in both scenarios. How can I show the cancel button when the VC is presented and hide it when the VC is pushed?
Using isBeingPresented you can manage your cancel button,