Skip to content

Instantly share code, notes, and snippets.

@iraycd
Last active August 29, 2015 14:22
Show Gist options
  • Save iraycd/bbc5e50eb9d9f6e425ba to your computer and use it in GitHub Desktop.
Save iraycd/bbc5e50eb9d9f6e425ba to your computer and use it in GitHub Desktop.
Interface Builder (XIB) or Code when merging in a team environment

Was merging a consideration for going all code? Do you use XIBs just for layout and code the rest? Or, have you had any luck merging XIBs and over time you just get better at manually reading?

EDIT: My current approach is using it for strict layout (what it's really good at and painful to code) and setting all the options and data via code. I find code much easier to merge but laying out controls in code is tedious. Thoughts?

Was merging a consideration for going all code?

Yes, No, and "Portions Of". It depends on things like:

  • The people involved
  • the complexity of the UI
  • the quality of the implementation you need.
  • the expected lifetime of the implementation

But yes, it has been, and it often is when the case is just not trivial -- Otherwise, you just fight it by decomposing XIBs into smaller pieces. That can work pretty well (or not), depending on what you are faced with.

Do you use XIBs just for layout and code the rest?

Depends on a lot of things.

  • XIB-only has its restrictions, and is much like code duplication. I use it at times for prototyping, other times because that's what somebody else favored.
  • "A little of both" can require a lot of glue. At times, it can be pretty disorganized -- e.g. "where's that action really set?". Of course, this can also be used to achieve what some would consider a good balance of XIB and programmatic separation. The simpler the XIB is, the less often it will need to be adjusted, and less likely it will cause merge conflicts.
  • Code-only is my preference, but there are people who just prefer WYSIWYG, and people aren't very familiar writing UIs programmatically. As well, if quality, reusability, and maintainability not requirements (e.g. bang out a prototype), then code-only can be overkill.

Or, have you had any luck merging XIBs and over time you just get better at manually reading?

No real luck -- just by breaking them into smaller components. Unfortunately, the "Decompose Interface" option (from IB3) is not available in Xc4's editor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment