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
3
votes
1 answer

How to write good base classes for iOS projects?

I've been developed apps for iOS for sometime and find that there are many repeating tasks. So I want to write base classes that the upcoming projects will subclass, so that it will cost less time and more easily to track code across projects. The…
onmyway133
  • 45,645
  • 31
  • 257
  • 263
3
votes
2 answers

Mantle - MTLJSONSerializing two value for the same propertie

I call an api which can have differents interface for the same value "id" : "id", "_id" or "pId". But currently, it's works for only the first : @"id": @"_id". the other are ignored. JSON object:{ "pId" : 192039, "name" : "test} IOS…
Damien Romito
  • 9,801
  • 13
  • 66
  • 84
3
votes
2 answers

Serializing a nested data structure of MTLModel subclasses to JSON

I got a problem concerning the Mantle framework from Github. I want to do the following @interface ClassA : MTLModel @property(strong, non-atomic) ClassB *instanceOfB; @end @implementation ClassA + (NSDictionary…
GorillaPatch
  • 5,007
  • 1
  • 39
  • 56
3
votes
1 answer

How do I include a custom framework (GitHub's Mantle) into my iOS 6 project?

I want to use Github's Mantle framework in my iOS application. I am using XCode 4.5 and iOS SDK 6. How do I go about doing so? This is the framework: https://github.com/github/Mantle
Fahim
  • 202
  • 2
  • 12
2
votes
1 answer

how to process BOOL in Mantle?

I have MyModel inheriting from MTLModel (using the GitHub Mantle pod). MyModel.h @interface MyModel : MTLModel @property (nonatomic, assign, readonly) BOOL *nsfw; @end in MyModel.m, I have tried + (NSValueTransformer…
0xxxD
  • 181
  • 10
2
votes
1 answer

Combine multiple keys into single property using Mantle

I am receiving multiple keys for Latitude and Longitude in the JSON body for a request. { ... latitude: "28.4949762000", longitude: "77.0895421000" } I would like to combine them into a single CLLocation property while converting them into my…
ZeMoon
  • 20,054
  • 5
  • 57
  • 98
2
votes
1 answer

How to string to primitive type in Mantle?

I am making application using Mantle with iOS 9.1 class SKUser: MTLModel, MTLJSONSerializing { var userId:NSNumber = -1 var firstName:String = "" var lastName:String = "" var country:String! = "" var address:String! = "" …
Jasmin
  • 794
  • 7
  • 18
2
votes
1 answer

How to build Mantle v2 for iOS 7.0?

my project currently targets iOS 7.1 and up. I have built Mantle along with Carthage as described on the Mantle's GitHub site. But I get the following error when building my project: ld: embedded dylibs/frameworks are only supported on iOS 8.0 and…
salocinx
  • 3,715
  • 8
  • 61
  • 110
2
votes
2 answers

Object from JSON with Mantle: ignore a property

My app creates some ObJC objects from JSON. Things were working fine, until I added a new property to my ObjC model class, which doesn't have a counterpart in JSON. I've configured the mapping as follows: + (NSDictionary…
TotoroTotoro
  • 17,524
  • 4
  • 45
  • 76
2
votes
1 answer

Implementing MTLModel shows error parsing json dictionary

The error messages go like this: *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key user.' And here's the…
quantumpotato
  • 9,637
  • 14
  • 70
  • 146
2
votes
0 answers

Handling ignored properties in Mantle

I need to have one property which is not present in JSON but it need to be set when I try to use this Model Object. I think it'd be easier to show you the example... Here is my sample JSON: [{ "name" : "Safari", "key" : "safari", …
cojoj
  • 6,405
  • 4
  • 30
  • 52
2
votes
1 answer

iOS Mantle Overcoat mapping array of entity ID

I am using Overcoat and Mantle. Our JSON from our REST server returns something like: { results:[{ id: 123, eventName: @"ABC" ... private_users: [50, 37, 24] },{ id: 124, …
Zhang
  • 11,549
  • 7
  • 57
  • 87
2
votes
1 answer

JSON missing dictionary (mantle)

I'm trying to conver this JSON to a model: [ { "status": "Top-up done", "amount": "25.00", "amount_ex_vat": "20.66", "executed_on": "2014-07-28 20:21:33", "method": "Bancontact/Mister Cash", …
user1007522
  • 7,858
  • 17
  • 69
  • 113
1
vote
1 answer

How to declare optional property in Mantle?

Specific situation detail: In my current photo app, There are such situation : allow user experience first without log in, but no have some field(e.g:voted,purchased ,etc) in the JSON responded from backend. If user logged in, the field is added in…
0xxxD
  • 181
  • 10
1
vote
0 answers

Mapping Firebase lists to objects with Mantle

I'm looking for an effective way to map Firebase lists to custom Objective-C objects with Mantle. Firebase doesn't really have a concept of arrays, so every item in a list has an explicit id. A list in Firebase of type event appears something like…