Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to avoid Xcode gratuitous edits to storyboard files?

Tags:

xcode

xib

When I navigate to one of my xib files, Xcode marks the file as touched. Undo and revert have no effect. Saving seems to do no harm, but the glitch causes me frequent additional git work.

Has anyone else seen this or have an idea about something in my MainWindow.xib that would cause it?

Edit in 2019 - still happening!

like image 552
danh Avatar asked May 05 '11 15:05

danh


2 Answers

Apple says it's a known issue:

This is a follow up to Bug ID# 9847336. After further investigation it has been determined that this is a known issue, which is currently being investigated by engineering. This issue has been filed in our bug database under the original Bug ID# 9056156. The original bug number being used to track this duplicate issue can be found in the State column, in this format: Duplicate/OrigBug#.

like image 155
danh Avatar answered Nov 18 '22 08:11

danh


After attempting many different solutions to get around this extremely annoying bug, I've found one method that works (it is certainly not a "fix", but a workaround).

Lock controllers when you're done with them.

Select a view controller in a storyboard, open the Identity inspector, and at the bottom in the Document section, you'll see a Lock dropdown. Select "All Properties" from the lock drop down.

If you do this for all of the controllers giving you issues (or just all of the controllers in general, even), you'll notice when you open the storyboard, Xcode will still modify the frames of various elements, but then immediately undo the changes.

This then leads to the development cycle being:

  1. Unlock a view controller
  2. Perform any necessary changes
  3. Lock the view controller
  4. Commit

Locking also works on a view-by-view case if that suits your needs better.

The bug has been around for quite some time now and it doesn't appear to be getting fixed any time soon, so unfortunately this will have to suffice for now.

like image 15
Adam Eisfeld Avatar answered Nov 18 '22 08:11

Adam Eisfeld