A model framework for Cocoa and Cocoa Touch that simplifies JSON serialization and persistence.
Mantle is a model framework for Cocoa and Cocoa Touch applications that simplifies the creation and management of model objects. It eliminates boilerplate code for JSON serialization/deserialization, NSCoding, NSCopying, and equality implementations, making it easier to work with REST APIs and persistent data.
iOS and macOS developers building applications that consume JSON APIs and need robust model layers without the complexity of Core Data.
Developers choose Mantle because it dramatically reduces repetitive code, provides a clean declarative API for JSON mapping, and handles common model tasks automatically while remaining lightweight compared to full ORM solutions.
Model framework for Cocoa and Cocoa Touch
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
MTLModel provides default implementations for NSCoding, NSCopying, and equality methods, eliminating repetitive boilerplate code as shown in the GHIssue example.
The +JSONKeyPathsByPropertyKey method allows clean, declarative mapping between properties and JSON keys, with support for nested keys and custom transformers.
Handles schema evolution with hooks like -decodeValueForKey:withCoder:modelVersion:, preventing breaking changes when model interfaces are updated.
Built-in transformers for dates, URLs, and enums enable bidirectional JSON conversion, simplifying serialization back to JSON as demonstrated in the updatedAt example.
Built in Objective-C, it requires bridging in Swift projects and lacks idiomatic Swift features like type-safe Codable, making integration feel outdated.
Each property needing custom transformation requires explicit method implementations (e.g., +<key>JSONTransformer), adding boilerplate for complex models.
Mantle doesn't provide data storage; developers must manually use NSKeyedArchiver or integrate with Core Data, as admitted in the Persistence section.