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
1
vote
1 answer

Insert value from Mantle model to RealmDB

I have an issue: How can I save value from Mantle model to Realm database with a loop? my code below: MTLmodel *model = [MTLJSONAdapter modelOfClass:[MTLmodel class] fromJSONDictionary:jsonResponse error:&error]; FreefoodRealmdb* food =…
1
vote
1 answer

How to convert JSON string to MTLModel - Mantle

Is there any way in mantle to convert a JSON data to MTLModelObject directly, I have gone through the documentation and haven't found a simple way to do so. It seems there is only support for converting NSDictionary to MTLModelObjects and vice…
Ankur Teotia
  • 227
  • 1
  • 10
1
vote
0 answers

Objective-C Mantle Paging

I am using Mantle in my objective-c application, and able to fetch and display data. However, I am not able to figure out how to implement paging/pagination using Mantle. If I fetch data again, it over writes my previously fetched array. Anyone done…
jarhead483
  • 31
  • 4
1
vote
1 answer

Deserialize Mantle object using two JSON formats

Is there a way to construct a mantle object using two different JSON objects? For example, say there is an Address class and the following two JSON formats: { "street: "s", "city" : "city", "state" : "state", "zipcode" "12345" } { …
1192805
  • 988
  • 2
  • 10
  • 26
1
vote
1 answer

How can I customize the NSdictionary using Mantle?

I have the following json string: {"suit_id": 2427; "suits": "http://img.prettyyes.com/1137-4930-1446175512.jpeg;http://img.prettyyes.com/1137-7665-1446175512.jpeg;http://img.prettyyes.com/1137-4783-1446175512.jpeg"} So when use mantle to parse the…
user2507194
  • 175
  • 4
  • 13
1
vote
1 answer

Parse JSON with Mantle which has Root Keys

I try to parse the JSON I get from a REST-Webservice. Seat.json: {"seat":{ "row":1, "seatNr":1, "seatId":5782}} My MTLModel (This does not work. Because there is a seat in front of the json fields.) + (NSDictionary…
jussi
  • 2,166
  • 1
  • 22
  • 37
1
vote
1 answer

Mantle ignore key in JSON

I've been trying to ignore a key inside a dictionary when creating my mantle model. Let's say that the json contains: { prop1:"my prop", prop2:"my prop2" } initially I have a model with class MyModel: MTLModel, MTLJSONSerializing { …
SergioM
  • 1,595
  • 1
  • 15
  • 27
1
vote
0 answers

Simplified Core Data Stack using Mantle, Overcoat, and Magical Record in union

I've designed a core data stack based on this blog post (in Swift) where I have two NSManagedObjectContext instances, a Main Queue Context (NSMainQueueConcurrencyType) and a Private Queue Context (NSPrivateQueueConcurrencyType) where the main…
barndog
  • 6,975
  • 8
  • 53
  • 105
1
vote
1 answer

Mantle iOS: How to create class model with variable key

I have a JSON dictionary that looks like this: { "111": {"dates" : [], "members" : []}, "112": {"dates" : [], "members" : []}, "113": {"dates" :…
mikywan
  • 1,495
  • 1
  • 19
  • 38
1
vote
2 answers

Strings with spaces failed to convert as NSURLs - Mantle

Would like to know is there anyway that we could fix failing converting a string with space to NSURL in Mantle? I'm getting below Mantle error: Error Domain=MTLTransformerErrorHandlingErrorDomain Code=1 "Could not convert string to URL"…
Dhammini F.
  • 339
  • 3
  • 17
1
vote
1 answer

How to map an array of arrays in Mantle

Anybody got an idea of how to map this response to a mantle object? I need to get these to an NSArray of custom classes. But the Mantle documentation has no mention on how to do this. Thanks in advance. [ [ { "plu_id":…
melaka
  • 699
  • 7
  • 23
1
vote
1 answer

How to auto map to mantle model class in case of envelop response with overcoat?

I am using mantle for model mapping and overcoat for network request. Overcoat auto map the result to model, but when there is envelope response, I am able to get custom Overcoat response. But problem is the Overcoat response is NSCFDictionary…
live_alone
  • 159
  • 1
  • 11
1
vote
1 answer

How to make a single variable based on NSDictionary parameters?

Data from the server { "type": "reward", "stamp_pos": "1", "reward_id": "350", "reward_title": "dfddffd", "reward_cost": "1", "reward_cost_text": "Stamp Reward", "reward_tnc": "12pm between Monday - Thursday.", …
ninja2code
  • 23
  • 3
1
vote
0 answers

JSON Mapping any inner objects using Mantle

If I am getting a response like this { "objects" : [ { "a" : val1, "b" : val2, }, { "a" : val1, "b" : val2, } ] } Then how do get the objects…
Puneet
  • 291
  • 1
  • 5
  • 15
1
vote
0 answers

How to map an inner object that's changing based on the endpoint request with GitHub Mantle?

I have the following scenario: a web service that provides responses wrapped in the same object (described later) the inner object can be completely different based on the endpoint being called I am using GitHub's Mantle to do the model mapping in…
Valerio Santinelli
  • 1,592
  • 2
  • 27
  • 45