nibarchive

Crates.ionibarchive
lib.rsnibarchive
version0.1.0
created_at2025-05-28 15:18:21.256707+00
updated_at2025-05-28 15:18:21.256707+00
descriptionNIB Archive decoder/encoder
homepage
repositoryhttps://github.com/michaelwright235/nibarchive
max_upload_size
id1692943
size43,424
Michael Wright (michaelwright235)

documentation

README

NIB Archive Decoder/Encoder

Decode and encode NIB Archive .nib files.

.nib files are mainly used by Interface Builder component of Xcode to encode .xib files. Both store information about creating a GUI for macOS and iOS applications. The difference is, .xib is a human-readable xml used only during development, and .nib is a compiled version of it.

There're two variations of .nibs. The first one is a NIB Archive (used by UIKit on iPhones since iOS 6) whose decoded structure somewhat resembles Cocoa Keyed Archive. This library is designed to work with these .nibs. The second one is actually a Cocoa Keyed Archive (used prior iOS 6). macOS uses both versions.

The file format has been described in detail in the nibsqueeze repository and this great article. You may also want to check the nibarchive repository – a NIB Archive parser written in Python.

Known issues

Some NIB Archives (presumably ones with a coder version of 10) have some extra bytes at the end of a file. Those bytes are not handled and their purpose is unknown yet.

Example

The following example prints all archive's objects and their values:

use nibarchive::*;

let archive: NIBArchive = NIBArchive::from_file("./foo.nib")?;

for (i, object) in 0..archive.objects().iter().enumerate() {
    let class_name = object.class_name(&archive.class_names()).name();
    println!("[{i}] Object of a class '{class_name}':");

    let values: &[Value] = object.values(&archive.values());
    for (j, value) in 0..values.iter().enumerate() {
        let key = value.key(&archive.keys());
        let inner_value = value.value();
        println!("-- [{j}] {key}: {inner_value:?}");
    }
}
Commit count: 29

cargo fmt