0

Back to XCode 5 and 6 times, putting all view controllers on to one single storyboard was not recommended, and my experience proved it: XCode became slow.

What is the situation today? Can XCode 9 handle this? Does Apple officially recommend to put everything into one singular storyboard?

Display Name
  • 4,502
  • 2
  • 47
  • 63

4 Answers4

1

As you like , sometimes you have to do this when number of view controllers in main storyboards increases also to divide app features when you app becomes larger and storyboard opens/saves slowly

Shehata Gamal
  • 98,760
  • 8
  • 65
  • 87
1

You should divide your storyboard in module wise. otherwise your project will take much time in a single change in storyboard.

My suggesion is you can use Storyboard Reference to connect via segue see example

https://www.raywenderlich.com/115697/ios-9-storyboards-tutorial-whats-new-in-storyboards

and if you don't want segue a better solution is have abstract method practice in your every viewcontroller to access from storyboard

Just like

//--------------------------------------------------------------------------------

// MARK: - Abstract Methods

//--------------------------------------------------------------------------------

public class func viewController () -> LoginVC {
    return StoryBoard.main.instantiateViewController(withIdentifier: StoryBoard.controller.LoginVC) as! LoginVC
}


//--------------------------------------------------------------------------------
// Now access it with  LoginVC.viewController() and do push or present whatever your operation you requred

I manage everything in constant file

public struct StoryBoard {

static let main = UIStoryboard.init(name: "Main", bundle: nil)

       struct controller {
           static let LoginVC   =   "LoginView"

         }

}
Prashant Tukadiya
  • 15,838
  • 4
  • 62
  • 98
1

In my opinion it's better to divide app in modules or something like "flows"; for example I usually create the Onboarding storyboard that contains login/registration stuff, or Settings storyboard that contains settings menu and submenu (which are all view controllers). Furthermore, I never create UITableViewCell or UICollectionViewCell in directly in storyboard, but I create a dedicated .xib file. I use the same @Prashant Tukadiya methods to handle View controller instantiation and storyboard handling (in a more generic way).

What is the situation today? Can XCode 9 handle this?

I worked on a project 1-2 years ago that contains all view controllers in a single storyboard, I recently opened it in XCode 9 and it's still a extremely slow.

Rico Crescenzio
  • 3,952
  • 1
  • 14
  • 28
1

I create different storyboards for divided logical units and pass references to them (Storyboard reference in XCode). It helps to keep them more organized. Also there is a nice library named R.swift on GitHub (see https://github.com/mac-cain13/R.swift) such as file with resources in Android. It parses all resources such as images, nibs, storyboards etc. and reduces possibilities of making mistakes when calling resources by name.

AnnGoro
  • 46
  • 1