I have some data that I want to switch between a table view and a map view. In the past I have just put everything onto one view controller. But I think this will get really messy because I will have many subviews for two separate views all on one view controller. So I would have to hide one view to edit the other. (Unless this is normal?)
I think my preferred option would be one view controller with 2 subviews, and here is what I have thought about so far...
I tried using a view container, which separates out a
UIView
with an embedded segue, but it seems as though it can only have one segue connected to it, and I needed two (for table and map). It was hard to find good example material using this view container.I then thought about using nibs. I started IOS programming after storyboards, so I have never used nibs, yet, but this might be a good situation? Make two
UIView
nibs that can be loaded into the view controller.I could just use my one view controller, make two views inside it, one that holds all the table view subviews, and one that holds all the map view subviews. Like I said, though, this makes editing the view tougher.
So my question, what is a good way to create a view that uses the same data, but can toggle views without making the storyboard view controller bloated?
I thought about popping and pushing on the navigation stack as well to 'toggle' the views, but I think the views are on the same level, and the navigation stack doesn't make sense.