Best pratice between storyboard xib/nib pure programming [closed]

允我心安 提交于 2019-12-04 13:12:15

I'd vote against using storyboards. They're just like the usual eyecandy stuff, that looks pretty with toy examples in WWDC presentations, but in real-life scenarios it rarely does the right thing... Storyboards force you to make unfortunate architectural decisions ( see: http://doing-it-wrong.mikeweller.com/2013/06/ios-app-architecture-and-tdd-1.html ), and as your project goes on, storyboards quickly evolve into a horrible mess of viewcontrollers and segues, not to mention the problems with merging storyboards... Been there, done that. With vim. It was painful...

In fact, I've been working on a project for 6 months, which started out using storyboards, and now development came to a point where I'd consider (if the deadline wouldn't be close) splitting the whole stuff into individual XIB's, if not pure code.

You should only use storyboards if:

  • you're doing proof-of-concept apps / prototypes
  • you're planning with no more than 6 viewcontrollers
  • you'll be using simple stack-based navigation and nothing complex

I would still recommend using storyboards... you can have multiple storyboards per project if required and they can really reduce the amount of time it takes to create the UI. Also, if you are good with git, you can resolve conflicts pretty easily in most cases: http://blog.mugunthkumar.com/articles/avoiding-merge-conflicts-with-storyboards/

As for coding the UI, there are a few things that are best done in code... but to build the whole UI programmatically is like trying dig a hole with a spoon when you could be using shovel.

Using storyboard prevents two or more developers from working on different views at the same time, unless you use multiple storyboards.

Using .xib files, one per view controller enables one developer to work on say FirstViewController and its associated .xib, while another developer works on SecondViewController and its associated .xib. This way there is no overlap in what the different developers are doing, and one developer's changes will not wipe out the other's.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!