Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:NIBArchive

From ReverseEngineering.wiki
Format
Platforms Platform:IOS
Magic 4E 49 42 41 72 63 68 69 76 65 ("NIBArchive")
Extensions .nib, .storyboardc contents
Endianness little-endian, 7-bit varints
On this wiki Facts · Code · Notes · Topics

The compact binary file inside compiled .nib files and storyboards (.storyboardc) of iOS 6 and later: magic "NIBArchive", four tables (objects, keys, values, class names) with varint indexes; it is the compiled form of an NSCoder object graph for UIKit.

Where it is

ibtool compiles a .xib to a .nib and a .storyboard to a .storyboardc directory holding Info.plist, one .nib per scene and view controller, and UIViewController-<id>.nib files. On iOS 6+ targets the nib is a NIBArchive; macOS nibs, and old iOS ones, are Format:NSKeyedArchiver archive binary plists (Format:Property list (binary bplist00)). Tell them apart by the first bytes: "NIBArchive" versus "bplist00".

Layout (nibsqueeze's NibArchive.md)

Header of 50 bytes: 10 bytes "NIBArchive"; u32 constant 1; u32 constant 9; then offset pairs: object count and objects offset, key count and keys offset, value count and values offset, class name count and class names offset. All u32 little-endian. (The two constants were observed as 1 and 9; the author says they may be versions.)

Varint: little-endian groups of 7 bits where the HIGH bit being set marks the LAST byte (the opposite of LEB128): 0-127 is one byte 0x80|v. The author only saw up to two bytes; longer forms are an unverified assumption.

  • Object: varint class-name index, varint index of its first value, varint value count.
  • Key: varint length, UTF-8 name, no terminator.
  • Value: varint key index, u8 type, payload. Types: 0 int8, 1 int16, 2 int32, 3 int64, 4 true, 5 false, 6 float32, 7 float64, 8 data (varint length + bytes), 9 nil, 10 object reference (u32 index into the object list).
  • Class name: varint length, varint count of extra int32 values (0 or 1 observed), those int32s, then the name string.

Reading one

For object i, take class = classNames[object.class], then read value_count values from values[object.firstValue]; each value gives a key name from the key table. Object-reference values point back into the object list, so the graph is rebuilt exactly as NSKeyedUnarchiver would. Class names (UIView, UILabel, UIImageView, UIStoryboardSegueTemplate...) and keys expose outlet/action names, image names and string literals, which tie a nib to the Objective-C selectors and class names in the binary (Technique:Objective-C runtime metadata).

Tools

nibsqueeze (Objective-C; no license file found in the repository, so reuse its code only after asking the author) shrinks nibs by merging equal objects and values. Unverified: other parsers exist (for example Python and Rust NibArchive readers); check their licences.

See also Format:Assets.car (compiled asset catalog), Format:IPA.

Code & repositories

  • https://github.com/matsmattsson/nibsqueeze @ 0fa59400588ac20417f0692b4e1d55d5403f7ab0 · license: none
    Nib size reducer whose NibArchive.md documents the NIBArchive layout (no licence file in the repository).
    Tested on: source read, not run: not built; NibArchive.md read · checked 2026-10-18; last activity 2020-01-08; no license: not reusable