6

Why git add & amp; removes the Storyboard & lt; classes & gt; Many t...

 2 years ago
source link: https://www.codesd.com/item/why-git-add-removes-the-storyboard-classes-many-times.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Why git add & amp; removes the Storyboard & lt; classes & gt; Many times?

advertisements

When saving the storyboard and committing the changes to git, the chances are good that the whole <classes> section will be removed from or added to source control (git). I am using git on the command line, not the XCode integrated UI.

First it looks like this:

+    <classes>
+        <class className="CPTGraphHostingView" superclassName="UIView">
+            <source key="sourceIdentifier" type="project" relativePath="./Classes/CPTGraphHostingView.h"/>
+        </class>
...
+    </classes>

And in the next commit it looks like that:

-    <classes>
-        <class className="CPTGraphHostingView" superclassName="UIView">
-            <source key="sourceIdentifier" type="project" relativePath="./Classes/CPTGraphHostingView.h"/>
-        </class>
...
-    </classes>

Why is that, and, more importantly: how can I stop that?


(this answer is based personal experience, and is not a formal one)

The classes section in the .storyboard xml file lists all the view controllers you have in your project in order to

  1. Allow the Assistant Editor show the right source file when you select a UI element in the Interface Builder, and
  2. Allow the Identity Inspector (right panel) to present options for Custom Class.

I guess this section is a cache, being retired when both of the two uses listed above haven't been used for a while.

The fact that this section turned up in the first place implies it is safe to ignore, since it is auto-generated on need. If you already have it committed, and subsequently have it appear as removed on diff, open the Identity Inspector, drop-down the list of classes available under Custom Class, and see how the whole section exists once again.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK