Storyboards and SVN conflicts
This is a problem we never had to deal with until storyboards were introduced – Whenever there was a chance of conflict in UI, we just made sure that no 2 developers ever worked on the same XIB file simultaneously. The reason we refrained from resolving XIB conflicts is that there may be problematic side-effects (XIB is represented in XML format so there isn’t a “good” way to merge 2 versions).
Now we are facing this issue because all of our UI elements are within the same .storyboard file – prevention of simultaneous work on any 2 UI elements in the project makes working in parallel very difficult.
Any suggestions as to how to tackle this issue? Thanks in advance for your efforts.
4 Solutions Collect From Internet About “Storyboards and SVN conflicts”
Break up your storyboard into multiple storyboards.
There is no reason for your app to contain only one storyboard. Break your storyboard up into module storyboards. You can use
+storyboardWithName:bundle: to load storyboard modules.
See: UIStoryboard Best Practices for other good storyboard ideas.
It’s important to note this is not a complete solution to the problem. In the same way you cannot completely avoid the possibility of merge conflicts in source code decomposing a giant class into smaller modules, you can’t avoid the possibility storyboard merge conflicts either. The idea is to reduce the likelihood until it becomes a manageable problem.
There will alway be tricky merge situations in a large codebase. A properly decomposed solution will reduce the number of conflicts and minimize the number of lock out needed.
Here’s something I came up with when I was just messing around, trying to find a solution.
If you right click your storyboard file in Xcode and navigate to “Open As” you’ll see that there are multiple options – the default is “Interface Builder – iOS Storyboard”. However, you can also select “source code”.
If you open storyboard up in source code mode, it’s possible to make changes (although kind of a pain). But you can add code from other storyboards and make changes in your own – I haven’t used SVN but with a git repository I can view other versions of the storyboard and copy code in.
I wouldn’t say that this is a great solution – I’ve had some trouble with Xcode randomly crashing when I try to reopen the storyboard in IB. Sometimes pasting code in works, sometimes it doesn’t. A few times I had to change the
<scene> tag’s value. In my experience it’s pretty hit-or-miss but if you back up your files before you try anything it might work.
If it does work, let me know – I’m interested in seeing whether a solution can be found to this problem.
Is this about merging XML files?
Fortunately, SVN allows you to change the merge tool you use to perform merging for different types of file. (eg tutorial for using P4Merge)
So now you just need to find a great tool for merging XML files (good luck 🙂 )
there’s WinMerge (with the DisplayXMLFiles prefilter), or diffxml, or XMLMerger or a java xmlmerge tool
You can also have a look at a modern source code management tool. Git for example has intelligent merge features. See this link for why you should consider upgrading your workflow.
- In Objective-C, what does a comma do when used as a statement separator?
- Why the “Use of undeclared type UITableView” happened in Swift?
- Switch statement for imported NS_OPTIONS (RawOptionSetType) in Swift?
- What is “self” used for in Swift?
- Multiple buttons connected buttons best practise
- load local image into UIWebView
- How to properly set run paths, search paths, and install names?
- Declaring instance variables in iOS – Objective-C
- Getting wrong playback state in MP Music Player Controller in ios 5
- Physicsbody doesn't adhere to node's anchor point
- How to use stringWithContentsOfURL:encoding:error:?
- Refresh UIwebview without any shaking?
- Why write 1,000,000,000 as 1000*1000*1000 in C?
- ld: library not found for -lIOKit.A clang xcode
- Navigate to a specific UIViewController after receiving a NSNotification