A lightweight persistence layer for Swift that stores structs, classes, and basic types with simple packing/unpacking.
Pantry is a lightweight persistence layer for Swift that allows developers to easily store and retrieve structs, classes, and basic data types like strings and integers. It solves the problem of simple local storage and caching in iOS apps without requiring complex setup or external dependencies. The library provides a clean API for packing and unpacking data, making it accessible for quick implementation.
iOS developers using Swift who need a straightforward way to cache data or persist user settings and objects locally without heavy frameworks. It’s particularly useful for those building apps that require temporary storage or offline data retention.
Developers choose Pantry for its simplicity and minimal boilerplate, enabling rapid integration of persistence features. Unlike heavier alternatives, it focuses on ease of use with a clear API, automatic variable persistence, and compatibility with Swift’s type system, making it a go-to for lightweight storage needs.
The missing light persistence layer for Swift
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
By conforming to the Storable protocol, developers can persist custom structs and classes with less code than manual UserDefaults handling, as shown in the README's struct example with init and toDictionary methods.
Pantry allows setting expiration times on stored data, such as .Seconds(60 * 10) for a 10-minute cache, making it ideal for temporary caching scenarios like session tokens or API responses.
Using Swift's get/set, variables can automatically persist values across app restarts via simple property wrappers, reducing manual save/load calls for common use cases.
Supports structs, classes, arrays, enums with raw types, and nested structs/classes out of the box, enabling flexible storage without extra configuration.
The README explicitly states Pantry will not be supported going forward, recommending Swift's Codable instead, making it a risky choice for new or long-term projects.
It does not support nested arrays, which can hinder complex data models, and lacks advanced features like querying or migrations found in heavier persistence layers.
Pantry is compatible only with Swift 3, with no updates for newer Swift versions, rendering it outdated and potentially incompatible with modern iOS toolchains.