Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


GopiKrishna Saripuri
GopiKrishna Saripuri
1,123 Points

How to handle hierarchical master/details view in iOS using swift.

I've basic understanding/hands on with iOS development. I'm looking for tutorial/help with developing a master/detail application with hierarchical data, the flow is similar to the iPad settings app looks like,

I want to display the available categories in master view and if I select a particular category, on the detail view I want to display the list of available items, if I pick one item in the detail I want to display its details. Also looking to add support for adding new elements from the details view and edit/delete support. Could you help me with example or how to proceed.

1 Answer

You could use buttons that have IBActions with the segue programmed to take the view from the master to the detail view. Have a button per view. This would only allow for the user to go from master -> detail. If the user wanted to go to another detail, then the user would have to go back to the master view first.

Or you could have a menu bar, which would allow the user to go from any view to any other view.