Skip to content

jmah/xibition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 

Repository files navigation

xibition — Readable diffs for XIB files

About

xibition is a lossy, human-readable converter for Xcode / Interface Builder XIB (and NIB) files. It is designed for use with git's textconv feature to provide nicer diffs of interface files.

xibition doesn't aim to present every attribute of every object. Instead, it aims for output that's easily skimmed visually.

Output is generated for the following object properties: names, labels, titles, frames (positions), tool tips, actions, outlets, and bindings. All other properties (font and text settings, etc.) are condensed into a SHA1 hash (attributes_sha1) to show when they change, but without an additional 10–30 lines per object.

Installation

xibition depends on the Ruby Gems escape and plist. (I'd really like be independent of escape, if someone is able to contribute.)

Add the following to your gitconfig (I recommend the global one, ~/.gitconfig):

[diff "xibition"]
    textconv = /path/to/xibition
    cachetextconv = true
    xfuncname = "^(@interface[ \t].*)$\n^[0-9 |-]*----\\+ (.+)$"

Then, in a gitattributes file (.git/info/attributes, /etc/gitattributes, or .gitattributes):

*.xib   diff=xibition

While you're there, add one for Objective-C context headers:

*.m     diff=objc

Example Output

With xibition

diff --git a/en.lproj/PBASessionDocument.xib b/en.lproj/PBASessionDocument.xib
index 341e562..8932bd3 100644
--- a/en.lproj/PBASessionDocument.xib
+++ b/en.lproj/PBASessionDocument.xib
@@ -82,10 +82,17 @@ Text Field Cell - Text Cell
    5|   6|100304|100303|100294|100298|100299|100302| Attributes: a0119822941fea83fa27a7f77724c621feab09fa
    5|   6|100304|100303|100294|100298|
    5|   6|100304|100303|100294|100298|------+ Table Column - Value
-   5|   6|100304|100303|100294|100298|100300| Attributes: d1db9fd61d74733954093554cc0475bd8ca5ccb2
+   5|   6|100304|100303|100294|100298|100300| Attributes: 6fcea276383d412fd2234242de57311706f5922a
    5|   6|100304|100303|100294|100298|100300|
    5|   6|100304|100303|100294|100298|100300| value: (100305| Message Headers - Dictionary Controller).arrangedObjects.value
    5|   6|100304|100303|100294|100298|100300|
+   5|   6|100304|100303|100294|100298|100300| editable: (100318| Messages - Tree Controller).selection
+   5|   6|100304|100303|100294|100298|100300|     NSMultipleValuesPlaceholder = 0
+   5|   6|100304|100303|100294|100298|100300|     NSNoSelectionPlaceholder = 0
+   5|   6|100304|100303|100294|100298|100300|     NSNotApplicablePlaceholder = 0
+   5|   6|100304|100303|100294|100298|100300|     NSNullPlaceholder = 0
+   5|   6|100304|100303|100294|100298|100300|     NSValueTransformerName = PBAMessageIsRequest
+   5|   6|100304|100303|100294|100298|100300|
    5|   6|100304|100303|100294|100298|100300|------+ Text Field Cell - Text Cell
    5|   6|100304|100303|100294|100298|100300|100301| Attributes: a0119822941fea83fa27a7f77724c621feab09fa
    5|   6|100304|100303|
@@ -445,10 +452,9 @@ Messages - Tree Controller
 100318| contentArray: (-2| File's Owner).messages
 
 ------+ Message Headers - Dictionary Controller
-100305| Attributes: 119fba4fb04d11d0ced6946471ac31fe5acf24ec
+100305| Attributes: e4572161b7dc83b4b720b9d211afc2d9b2b309e8
 100305|
 100305| contentDictionary: (100318| Messages - Tree Controller).selection.allHTTPHeaderFields
-100305|     NSConditionallySetsEditable = false
 
 ------+ Interpreted Fields - Tree Controller
 100053| Attributes: 8ebce06afa6947ce6516527a699c01f51b683a71

Without xibition

This is the same commit as above. You can disable conversion by passing --no-textconv to git diff (or git log, etc.).

diff --git a/en.lproj/PBASessionDocument.xib b/en.lproj/PBASessionDocument.xib
index 341e562..8932bd3 100644
--- a/en.lproj/PBASessionDocument.xib
+++ b/en.lproj/PBASessionDocument.xib
@@ -2,13 +2,13 @@
 <archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
 	<data>
 		<int key="IBDocument.SystemTarget">1070</int>
-		<string key="IBDocument.SystemVersion">11A390</string>
-		<string key="IBDocument.InterfaceBuilderVersion">1510</string>
-		<string key="IBDocument.AppKitVersion">1110.91</string>
-		<string key="IBDocument.HIToolboxVersion">544.00</string>
+		<string key="IBDocument.SystemVersion">11A419</string>
+		<string key="IBDocument.InterfaceBuilderVersion">1530</string>
+		<string key="IBDocument.AppKitVersion">1115.2</string>
+		<string key="IBDocument.HIToolboxVersion">549.00</string>
 		<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
 			<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
-			<string key="NS.object.0">1510</string>
+			<string key="NS.object.0">1530</string>
 		</object>
 		<array key="IBDocument.IntegratedClassDependencies">
 			<string>NSMatrix</string>
@@ -316,6 +316,7 @@
 																	</object>
 																	<int key="NSResizingMask">3</int>
 																	<bool key="NSIsResizeable">YES</bool>
+																	<bool key="NSIsEditable">YES</bool>
 																	<reference key="NSTableView" ref="666981949"/>
 																</object>
 															</array>
@@ -414,16 +415,13 @@
 																<string key="NSFrameSize">{505, 17}</string>
 																<reference key="NSSuperview" ref="677073926"/>
 																<reference key="NSWindow"/>
-																<reference key="NSNextKeyView" ref="221544145"/>
+																<reference key="NSNextKeyView" ref="150240800"/>
 																<reference key="NSTableView" ref="626158917"/>
 															</object>
-															<object class="_NSCornerView" key="NSCornerView" id="221544145">
-																<reference key="NSNextResponder" ref="563558642"/>
+															<object class="_NSCornerView" key="NSCornerView">
+																<nil key="NSNextResponder"/>
 																<int key="NSvFlags">-2147483392</int>
 																<string key="NSFrame">{{411, 0}, {16, 17}}</string>
-																<reference key="NSSuperview" ref="563558642"/>
-																<reference key="NSWindow"/>
-																<reference key="NSNextKeyView" ref="150240800"/>
 															</object>
 															<array class="NSMutableArray" key="NSTableColumns">
 																<object class="NSTableColumn" id="77071068">
@@ -586,7 +584,6 @@
 													<reference key="NSBGColor" ref="847445910"/>
 													<int key="NScvFlags">4</int>
 												</object>
-												<reference ref="221544145"/>
 											</array>
 											<string key="NSFrameSize">{505, 219}</string>
 											<reference key="NSSuperview" ref="438416439"/>
@@ -597,7 +594,6 @@
 											<reference key="NSHScroller" ref="763140228"/>
 											<reference key="NSContentView" ref="150240800"/>
 											<reference key="NSHeaderClipView" ref="677073926"/>
-											<reference key="NSCornerView" ref="221544145"/>
 											<bytes key="NSScrollAmts">QSAAAEEgAABBmAAAQZgAAA</bytes>
 										</object>
 										<object class="NSCustomView" id="309295333">
@@ -1617,6 +1613,7 @@
 				<string key="NSTreeContentChildrenKey">responseMessages</string>
 			</object>
 			<object class="NSDictionaryController" id="735985140">
+				<bool key="NSEditable">YES</bool>
 				<bool key="NSPreservesSelection">YES</bool>
 				<bool key="NSFilterRestrictsInsertion">YES</bool>
 				<array key="NSSortDescriptors">
@@ -2039,22 +2036,6 @@
 				</object>
 				<object class="IBConnectionRecord">
 					<object class="IBBindingConnection" key="connection">
-						<string key="label">value: arrangedObjects.key</string>
-						<reference key="source" ref="908225424"/>
-						<reference key="destination" ref="735985140"/>
-						<object class="NSNibBindingConnector" key="connector">
-							<reference key="NSSource" ref="908225424"/>
-							<reference key="NSDestination" ref="735985140"/>
-							<string key="NSLabel">value: arrangedObjects.key</string>
-							<string key="NSBinding">value</string>
-							<string key="NSKeyPath">arrangedObjects.key</string>
-							<int key="NSNibBindingConnectorVersion">2</int>
-						</object>
-					</object>
-					<int key="connectionID">100308</int>
-				</object>
-				<object class="IBConnectionRecord">
-					<object class="IBBindingConnection" key="connection">
 						<string key="label">value: arrangedObjects.value</string>
 						<reference key="source" ref="249399347"/>
 						<reference key="destination" ref="735985140"/>
@@ -2155,26 +2136,6 @@
 					<int key="connectionID">100324</int>
 				</object>
 				<object class="IBConnectionRecord">
-					<object class="IBBindingConnection" key="connection">
-						<string key="label">contentDictionary: selection.allHTTPHeaderFields</string>
-						<reference key="source" ref="735985140"/>
-						<reference key="destination" ref="6038189"/>
-						<object class="NSNibBindingConnector" key="connector">
-							<reference key="NSSource" ref="735985140"/>
-							<reference key="NSDestination" ref="6038189"/>
-							<string key="NSLabel">contentDictionary: selection.allHTTPHeaderFields</string>
-							<string key="NSBinding">contentDictionary</string>
-							<string key="NSKeyPath">selection.allHTTPHeaderFields</string>
-							<object class="NSDictionary" key="NSOptions">
-								<string key="NS.key.0">NSConditionallySetsEditable</string>
-								<boolean value="NO" key="NS.object.0"/>
-							</object>
-							<int key="NSNibBindingConnectorVersion">2</int>
-						</object>
-					</object>
-					<int key="connectionID">100328</int>
-				</object>
-				<object class="IBConnectionRecord">
 					<object class="IBOutletConnection" key="connection">
 						<string key="label">messagesOutlineView</string>
 						<reference key="source" ref="512844837"/>
@@ -2451,6 +2412,61 @@
 					</object>
 					<int key="connectionID">100416</int>
 				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBBindingConnection" key="connection">
+						<string key="label">contentDictionary: selection.allHTTPHeaderFields</string>
+						<reference key="source" ref="735985140"/>
+						<reference key="destination" ref="6038189"/>
+						<object class="NSNibBindingConnector" key="connector">
+							<reference key="NSSource" ref="735985140"/>
+							<reference key="NSDestination" ref="6038189"/>
+							<string key="NSLabel">contentDictionary: selection.allHTTPHeaderFields</string>
+							<string key="NSBinding">contentDictionary</string>
+							<string key="NSKeyPath">selection.allHTTPHeaderFields</string>
+							<int key="NSNibBindingConnectorVersion">2</int>
+						</object>
+					</object>
+					<int key="connectionID">100417</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBBindingConnection" key="connection">
+						<string key="label">value: arrangedObjects.key</string>
+						<reference key="source" ref="908225424"/>
+						<reference key="destination" ref="735985140"/>
+						<object class="NSNibBindingConnector" key="connector">
+							<reference key="NSSource" ref="908225424"/>
+							<reference key="NSDestination" ref="735985140"/>
+							<string key="NSLabel">value: arrangedObjects.key</string>
+							<string key="NSBinding">value</string>
+							<string key="NSKeyPath">arrangedObjects.key</string>
+							<int key="NSNibBindingConnectorVersion">2</int>
+						</object>
+					</object>
+					<int key="connectionID">100419</int>
+				</object>
+				<object class="IBConnectionRecord">
+					<object class="IBBindingConnection" key="connection">
+						<string key="label">editable: selection</string>
+						<reference key="source" ref="249399347"/>
+						<reference key="destination" ref="6038189"/>
+						<object class="NSNibBindingConnector" key="connector">
+							<reference key="NSSource" ref="249399347"/>
+							<reference key="NSDestination" ref="6038189"/>
+							<string key="NSLabel">editable: selection</string>
+							<string key="NSBinding">editable</string>
+							<string key="NSKeyPath">selection</string>
+							<dictionary key="NSOptions">
+								<integer value="0" key="NSMultipleValuesPlaceholder"/>
+								<integer value="0" key="NSNoSelectionPlaceholder"/>
+								<integer value="0" key="NSNotApplicablePlaceholder"/>
+								<integer value="0" key="NSNullPlaceholder"/>
+								<string key="NSValueTransformerName">PBAMessageIsRequest</string>
+							</dictionary>
+							<int key="NSNibBindingConnectorVersion">2</int>
+						</object>
+					</object>
+					<int key="connectionID">100425</int>
+				</object>
 			</array>
 			<object class="IBMutableOrderedSet" key="objectRecords">
 				<array key="orderedObjects">
@@ -3362,7 +3378,7 @@
 			<nil key="activeLocalization"/>
 			<dictionary class="NSMutableDictionary" key="localizations"/>
 			<nil key="sourceID"/>
-			<int key="maxID">100416</int>
+			<int key="maxID">100425</int>
 		</object>
 		<object class="IBClassDescriber" key="IBDocument.Classes">
 			<array class="NSMutableArray" key="referencedPartialClassDescriptions">

License

xibition is under an MIT license. The full text is in the LICENSE.txt file.

About

Readable diffs for XIB files

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages