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

本秂侑毒 提交于 2019-12-21 20:38:45

问题


Being new to ios programming,
I started of course with storyboard then I have read that it has its limitation when multiple developer comes to work on the same app, so I switched to pure code. But I guess xib / nib might be a good compromise.
Can you give me a more mature point of view?

Thanks a lot for your lights


回答1:


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



回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/18903752/best-pratice-between-storyboard-xib-nib-pure-programming

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