Storyboards and SVN conflicts

前端 未结 4 728
-上瘾入骨i
-上瘾入骨i 2020-12-04 16:37

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 wo

相关标签:
4条回答
  • 2020-12-04 17:03

    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.

    0 讨论(0)
  • 2020-12-04 17:17

    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.


    Update

    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.

    0 讨论(0)
  • 2020-12-04 17:22

    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

    0 讨论(0)
  • 2020-12-04 17:26

    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.

    0 讨论(0)
提交回复
热议问题