What is the difference between NIB and XIB Interface Builder file formats?

What is the difference between nib and xib in builder interface files?

+51
cocoa interface-builder
Sep 16 '10 at 11:58
source share
5 answers

According to Interface Builder version 3, a new file format (with the extension .xib) was added, which is functionally identical to .nib, except that it is stored in a flat file, which makes it more suitable for storage in version control systems and processing using tools like diff.

http://en.wikipedia.org/wiki/Interface_Builder#Design

+77
Sep 16 '10 at 12:01
source share

XIBs are flat files, not a collection. This facilitates the operation of SCM (source control) management systems. When you compile your application, the XIB compiles to a NIB file to be included in your application.

The compiled NIB that is included with the application is no longer editable in Interface Builder and much smaller than the equivalent XIB or old NIB file.

+18
Sep 26 '11 at 10:09
source share

Also, when you compile your project, the .xib file will be compiled into nib.

+13
Sep 16 '10 at 16:18
source share

The XIB file is basically the original document of the NIB file, the XIB can almost always be edited in Xcode (unless they are obsolete or corrupt). while newer NIBs are compressed and not applicable, older NIBs are packages that can be viewed with Xcode, The Bundled NIBs contain some source / archive files that include designable.nib , which is often just a renamed XIB file .




NIB = N xt I nterface B uilder (NXT = NextStep = NS)

XIB = X ml I nterface B uilder




Although the new NIB archive files are not available for most applications, including Xcode, they can still be unlocked. I found this free application called NibUnlocker on a CharlesSoft Web site that can potentially parse compressed Nib and export it as an XIB document. This application is still pretty buggy, but sometimes it is very accurate based on Nib content.

(NibUnlocker is a very inaccurate name, Nibs are not blocked, they are archived)




Click to download NibUnlocker




If you want to know a little more, you can read the additional information presented below regarding the NIB and XIB formats :

Nxt Interface Builder Anatomy:

Archived NIB s

A Compressed NIB file is a complex file to analyze, but it is not possible. The structure of these files is based on a list of compressed properties (starts with "bplist00"), and part of its contents is archived through NSKeyedArchiver. Since the NIB is formatted as a list of properties, this allows you to make a small hack: if you really change the Nib extension to .plist, for example. ArchivedNib.nib to ArchivedNib.plist In fact, you can open it in Xcode by treating it as a List of properties. When you look at Nib as a list of properties, you are likely to get some basic properties like $ version, $ objects, $ archiver and $ top.

Useful notes

A The CFKeyedArchiverUID object is actually a redirector; in {value = xx}, the value is the offset for the element in the $ objects array from the beginning of the array. eg. <CFKeyedArchiverUID 0x60800002bc20 [0x7fffef6b8c30]>{value = 29} , value = 29, the result will be the 29th element in the $ object array. In Objective-C, you can get this value from NSArray using this method:

 + (NSUInteger)valueForKeyedArchiverUID:(id)keyedArchiverUID { void *uid = (__bridge void*)keyedArchiverUID; NSUInteger *valuePtr = uid+16; return *valuePtr;} 

(I myself understood this using the Internet, and later used Hopper to parse NibUnlocker , and I noticed in its source code that it uses the same method, loading the NIB in NSDictionary and looking through all its connections, objects, etc. and writes new XIB )

as if it helped; -)

+11
Oct 08 '15 at 2:15
source share

Functionally, nothing but xib is a friendly source code format

+3
Sep 16 '10 at 12:02
source share



All Articles