An object that wraps, or contains, Interface Builder nib files.
- iOS 4.0+
- Mac Catalyst 13.0+
- tvOS 9.0+
UINib object caches the contents of a nib file in memory, ready for unarchiving and instantiation. When your application needs to instantiate the contents of the nib file it can do so without having to load the data from the nib file first, improving performance. The
UINib object can automatically release this cached nib data to free up memory for your application under low-memory conditions, reloading that data the next time your application instantiates the nib. Your application should use
UINib objects whenever it needs to repeatedly instantiate the same nib data. For example, if your table view uses a nib file to instantiate table view cells, caching the nib in a
UINib object can provide a significant performance improvement.
When you create a
UINib object using the contents of a nib file, the object loads the object graph in the referenced nib file, but it does not yet unarchive it. To unarchive all of the nib data and thus truly instantiate the nib your application calls the
instantiate method on the
UINib object. The steps that the
UINib object follows to instantiate the nib’s object graph are described in detail in Resource Programming Guide.