NIB2CIB(1)

NAME
nib2cib - convert Interface Builder files to Cappuccino cib files

SYNOPSIS
nib2cib --watch [options] [directory]
nib2cib [options] [input [output]]
nib2cib [--version | -h | --help]

DESCRIPTION
nib2cib converts an Interface Builder file into a Cappuccino cib file that can be loaded into a Cappuccino application.

There are two main converting modes in which nib2cib can be used: watch mode and single mode.

  Watch Mode
The easiest way to use nib2cib is in watch mode. This is done by using the syntax:

    nib2cib --watch [options] [directory]

If directory is omitted, a "Resources" directory in the current working directory is watched, and if no "Resources" directory exists, the current working directory is watched.

If directory is passed, is not a path to a "Resources" directory, and there is a "Resources" directory within directory, then that "Resources" directory is watched. Otherwise directory is watched. This allows you to pass the path to your application directory instead of its "Resources" directory.

In watch mode, nib2cib goes into an infinite loop and monitors the watched directory for changes to xib/nib files. There are three types of changes nib2cib will respond to:

add, modify
    When a new xib/nib file is detected or an existing xib/nib file is modified, it is converted into a cib file with the same base name if there is no corresponding cib file with a later modification time.

delete
    When a xib/nib file is deleted, the corresponding cib file is deleted as well.

Ordinarily in watch mode nib2cib will only display a log line for each file that is added, modified or deleted, and a confirmation when the corresponding cib has been generated or deleted. You can use the -v option in watch mode to display more detailed information when a cib is generated.

  Single Mode
In single mode, you convert a single file xib/nib file into a cib. The only advantages of using single mode over watch mode are:

-   You may want to view verbose output temporarily to debug the conversion, or use different options for different source files.

-   You can specify an output name that is not based on the input name.

Most of the time watch mode will be sufficient, but if you do need to use single mode, nib2cib tries to make it as easy as possible. If you navigate to your application directory and invoke:

    nib2cib

this will look for "MainMenu.xib" or "MainMenu.nib" in the current directory and then in a "Resources" directory within the current directory, if such a directory exists. Since these are the default names used in Cappuccino, this usage covers the default case with no extra work.

If your xib/nib file is not named "MainMenu.xib" or "MainMenu.nib", or you want to run nib2cib from a directory other than the application directory or its "Resources" directory, you can specify an input path:

    nib2cib path

Note that path does not need the ".xib" or ".nib" extension, since that is assumed. If you were to invoke:

    nib2cib foo

this would look for "foo.xib" and "foo.nib" in the current directory and in a "Resources" directory within the current directory. The output of nib2cib in this case would be "foo.cib" in the same directory as the source file.

If you want nib2cib to generate a cib file with a different base name or in a different directory than the input file, you may also specify an output path:

    nib2cib input output

As with input filenames, you do not need to add the ".cib" extension to the output path, this is assumed.

  Themes
To do its conversions accurately, nib2cib needs to access the themes you use. If you are using the standard Aristo theme, there is nothing extra to do.

If you are using a custom default theme, usually you specify this using a CPDefaultTheme item in your application's Info.plist. In this case nib2cib will read the theme name from the Info.plist. If you set the default theme programmatically and not in the Info.plist, then you should use the --default-theme option to specify the theme name.

If you are loading additional themes in your code using:

    [[CPThemeBlend alloc] initWithContentsOfURL:]

then you should inform nib2cib about it by passing the theme names as --theme name options, one for each theme that you load.

Themes are searched for in the Resources, $CAPP_BUILD/Debug and $CAPP_BUILD/Release directories.

COMMON OPTIONS
The following options are available in watch mode or single mode:

-v, --verbose
    Displays more information about the internal workings of nib2cib. This can be set multiple times to increase the amount of information displayed. If passed once, general information is displayed. If passed more than once, detailed information about individual view conversions is displayed.

-R path
    NOTE: This option is for the most part no longer necessary.

    Specifies the path (relative or absolute) to a directory from which images and custom themes are retrieved. Formerly it was necessary to use this when your xib/nib contained references to images, but now nib2cib infers the "Resources" directory from the input file, so usually you will not need to use this option.

--default-theme name
    Specifies the name of the default theme used by your application. This is only necessary if you are not using Aristo and you have not specified the default theme in your application's Info.plist. For more information see Themes above.

-t, --theme name
    Specifies the name of an additional theme to load. May be used multiple times. For more information, see Themes above.

--config path
    Specifies the path to an Info.plist file from which to read configuration information about your application, such as the system font and default theme. Ordinarily you do not need to use this option, as nib2cib uses the Info.plist in the application directory, which is inferred from the input file.

-F  Specify the path of a framework to load before converting. This is only useful if:

    -   Your IB files use classes from the framework.

    -   Those classes need to serialize/deserialize more data than their superclasses.

    -   Those classes implement encodeWithCoder: and initWithCoder:.

    This option may be used multiple times to load multiple frameworks.

--quiet
    Tells nib2cib to output nothing. This is useful if you are using nib2cib in a shell script and are only interested in the return value.

--version
    Prints the current version of nib2cib and immediately exits. nib2cib in a shell script and are only interested in the return value.

-h, --help
    Displays nib2cib usage and options.

RETURN VALUES
nib2cib returns 0 for a successful conversion and >0 if an error occurred.