Questions tagged [github-mantle]

Model framework for Cocoa and Cocoa Touch by GitHub

Mantle is a model framework for Cocoa and Cocoa Touch created and maintained by Justin Spahr-Summers at GitHub.

Mantle allows developers to quickly and easily write a simple model layer for their applications by providing them such tools, as:

  • Automatic two-way JSON serialization
  • Automatic two-way NSManagedObject serialization
  • Exception handling
  • Versioning support

Resources:

Questions tagged under should be directly connected with Mantle. If your project is using Mantle but the question is not connectet with it, don't add this tag to yor question.

91 questions
27
votes
5 answers

How to specify child objects type in an NSArray with Mantle

If I have a dictionary like { name: "Bob", cars: [ { make: "ford", year: "1972" }, { make: "mazda", year: "2000" } ], } and two models like: @interface CarModel : MTLModel @property (nonatomic, strong) NSString *make; @property…
Mr Rogers
  • 6,091
  • 2
  • 32
  • 34
19
votes
0 answers

JSONModel vs github Mantle Frameworks

I am building an application that requires a lot of JSON data handling. After going over different frameworks, I am down to JSONModel (https://github.com/icanzilb/JSONModel) and github Mantle (https://github.com/github/Mantle) due to their rich…
Yas Tabasam
  • 10,517
  • 9
  • 48
  • 53
18
votes
4 answers

How to omit null values in JSON Dictionary using Mantle?

I have MyModel inheriting from MTLModel (using the GitHub Mantle pod). MyModel.h #import @interface MyModel : MTLModel @property (nonatomic, copy, readonly) NSString *UUID; @property (nonatomic, copy) NSString…
matths
  • 760
  • 9
  • 19
14
votes
3 answers

Substituting JSON null values in Mantle

I'm using Mantle to parse some JSON which normally looks like this: "fields": { "foobar": 41 } However sometimes the value of foobar is null: "fields": { "foobar": null } This causes MTLValidateAndSetValue to throw an…
Andrew Ebling
  • 10,175
  • 10
  • 58
  • 75
9
votes
2 answers

Mantle and Core Data - update instead of delete/create

Is there a way in mantle to update an existing record in core data instead of always create new ones? This blog post looks promising, but I don't find the method updateWithJSON: somewhere in Mantle. Right now, I'm doing the following: MantleObject…
swalkner
  • 16,679
  • 31
  • 123
  • 210
8
votes
5 answers

Validating each property before returning object

While using Mantle, is there a possibility to before returning the object we are creating (on this case via JSON) to verify that X and Y properties are not nil? Imagine this class: @interface Person : MTLModel…
Rui Peres
  • 25,741
  • 9
  • 87
  • 137
7
votes
2 answers

Mantle property class based on another property?

How can I use Github Mantle to choose a property class based on another property in the same class? (or in the worse case another part of the JSON object). For example if i have an object like this: { "content": {"mention_text": "some text"}, …
pj4533
  • 1,701
  • 4
  • 17
  • 38
7
votes
2 answers

Mapping array of objects inside parent object - Mantle iOS

I have some json data that looks something like this: { items: [ { // object 1 aProperty: "aValue", anotherProperty: "anotherValue", anObjectProperty: {} …
Jeff
  • 1,800
  • 8
  • 30
  • 54
7
votes
2 answers

How to set default value in iOS Mantle model subclass

@interface Entity () @property (assign) int searchTotalPagesAll; @property (assign) int searchTotalPagesIdeas; @end @implementation Entity + (NSDictionary *)JSONKeyPathsByPropertyKey { return @{ @"Id": @"entity.id_entity", …
omarojo
  • 1,197
  • 1
  • 13
  • 26
7
votes
2 answers

Using Mantle with Core Data - NSSet and NSArray

I need your help with something, as I can't get my head around this. I'm using Mantle together with CoreData in iOS. I have relationships defined that look as follows: Post 1:N Comment When I pull the data from my REST Service, I create a Mantle…
Elysium
  • 155
  • 1
  • 10
6
votes
2 answers

The best library for mapping Core Data

as a developer I face with processing data each day. The common thing that I need to process the raw data to the object (NSManagedObject). So I am using AFNetworking for getting data from the remote server and as a result of AFNetworking work I have…
Matrosov Oleksandr
  • 25,505
  • 44
  • 151
  • 277
6
votes
1 answer

MTLModels within MTLModels?

I have a web service that returns a JSON of an object, and within that object there is a list of other objects. How can I get Mantle to create an object for each one of these nested objects, rather than giving me a dictionary for each one of them?
meisel
  • 2,151
  • 2
  • 21
  • 38
6
votes
3 answers

How to add GitHub's Mantle to Xcode using CocoaPods

I have added GitHub's Mantle project to a iOS 6 project using CocoaPods: $ pod search Mantle $ vim Podfile // here I added pod 'Mantle' $ pod install // this installs Mantle 1.0 Then I have added the ($inherited) variable to the Header Search…
elitalon
  • 9,191
  • 10
  • 50
  • 86
5
votes
2 answers

Mantle/Mantle.h file not found.

I have added Mantle framework version 2.0 from cocoapods. The mantle files got added into my project and header search path also shows the reference. However I am getting this error repeatedly. I have removed pods and reinstalled, but in vain.
Kaey
  • 4,615
  • 1
  • 14
  • 18
5
votes
1 answer

iOS Mantle + Overcoat

I'm looking at the Overcoat library which from what I gather is a library that extends the Mantle library. Mantle: https://github.com/Mantle/Mantle/ Overcoat: https://github.com/gonzalezreal/Overcoat The Mantle and Overcoat github pages keeps…
Zhang
  • 11,549
  • 7
  • 57
  • 87
1
2 3 4 5 6 7