Search code examples
swiftuitabbarcontrolleruistoryboardsegueunwind-segue

Unwind segue results in black screen? UITabBarController with embedded VCs and segues


I have the following hierarchy for my app: enter image description here

UITabBarController, first tab is a BrowseVC (another UIViewController). BrowseVC has a SegmentedControl, each of which will show a version of the PersonVC (another VC with a UICollectionView in the ContentView). They are each loaded with a lazy instantiation like this article. Tapping a cell in the PersonVC will show PersonDetailsVC via a modal segue.

I'm attempting to put a "Back" button on the PersonDetailsVC to get back to the PeopleVC collection view. I thought I'd have to put the unwind segue in the UITabBarController, however, while it is called just fine (a print statement shows it "works"), the view is black.

Using the Xcode view debugger, the PeopleVC is in the hierarchy on the left, but I've no idea where it is physically. Xcode View Debugger

For this configuration, which VC should the unwind be located in? I've tried putting in the BrowseVC and the PeopleVC but it would seem logical that the TabBarController would need to reload all of the content? Is there a best practice for this scenario? I can't imagine this is very unique at all. What gotcha(s) might I be missing?

TIA!


Solution

  • Apparently it is the modal presentation that is killing the unwind capability. Other presentation methods work fine. Disappointing.