Bundles and Packages
Despite being distinct concepts, the terms “bundle” and “package” are frequently used interchangeably. Part of this is undoubtedly due to their similar names, but perhaps the main source of confusion is that many bundles just so happen to be packages (and vice versa).
→ nshipster.com/bundles-and-packages/
The article clarifies the distinction between bundles and packages on Apple platforms, often confused due to overlapping use cases. A bundle is a structured directory containing executable code and resources, like app bundles, framework bundles, or plug-ins, accessible via Bundle.main
for resources like Photo.jpg
or localised strings using NSLocalizedString
.
A package appears as a single file in Finder, identified by extensions like .app
or registered document types, and can be accessed programmatically with Bundle
, NSDocument
, UIDocument
, or FileWrapper
. Developers can check if a directory is a package using URL.isPackageKey
or Core Services’ UTTypeConformsTo
for extensions, or set the package bit via extended attributes.
The article emphasises how Swift and Foundation APIs leverage these abstractions to enhance developer productivity and user experience, enabling efficient management of code, resources, and localisation.
Category:
Tag:
Year: