UPGRADE YOUR SKILLS: Learn advanced Swift and SwiftUI on Hacking with Swift+! >>

Split View Controller questions (master/detail)

Forums > iOS

I want to implement a split viewcontroller in my app, where the master and detail views both interact with each other.

Questions:

  1. I want to do it programatically using UIKit, so no storyboards and I'm looking to find some good information/resources on how to do this
  2. As I understand Apple recommends the split viewcontroller to be the root viewcontroller for the app, not sure why. I my app that can't be the case, I start out with a collection view and selecting an item should go to the split view scene. Any ideas on how to implement a split view controller not as the root view controller? Can I replace it mid app and change it back again when I want to navigate back to the collectionview again?

Basicly, any ideas, tips, resources on the above is really welcome!

3      

I already know how to do it in code, now i need to find a way to have it mid app, not as the root viewcontroller. Or any other ideas of two viewcontrollers side by side interacting with each other. And it must be adaptive too, so the right viewcontroller may or may not be initially visible, deping on size class / traitcollection ...

Anyone any tips, nudges ... ?

3      

Why not have the split view as root controller and program it so that it shows the collection view when launched (hiding the master ) and then upon interaction with the detail view ( the collection view) it would show the master? Or I am misunderstanding?

3      

@multitudes Thanks for the suggestion. But I'm afraid that doesn't work well with my app flow. I am now think of having a container viewcontroller with two child viewcontrollers to see if that works out ...

I am looking at this: https://github.com/dmytro-anokhin/split-or-flip, but that also assumes root. I really don't understand why this needs to be the root viewcontroller. Gonna try and implement it ...

3      

Hacking with Swift is sponsored by RevenueCat

SPONSORED Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.

Learn more here

Sponsor Hacking with Swift and reach the world's largest Swift community!

Archived topic

This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.