

Mantle: a Model Framework for Objective-C - kronawetter
https://github.com/blog/1299-mantle-a-model-framework-for-objective-c

======
natesm
What's with the categories? They don't seem to be used in either of the
primary .m files (cmd+f "mtl"), so they aren't really needed. Do one thing
well.

If you want to make a higher order function library, that's fine, but I don't
see what it has to do with mapping data to JSON, and I don't think that users
of the library should have to get a bunch of modifications to the standard
container classes to get the nice model class. Why not split it into two
libraries?

------
aaronbrethorst
This looks cool. Data modeling in Cocoa has, historically, been kind of
terrible. It doesn't look like there's a solid story for persistence yet,
though (i.e. writing data to sqlite). Is that accurate or am I missing
something?

~~~
weaksauce
I don't see storage integration as a default. The example talks about having
free conformance to the NSCoding interface so you can archive it that way if
you don't need the relational baggage. [1] and [2]

Though, there is nothing stopping you from writing your own layer that uses
the models here to read and write to another backing store like sqlite.

1\.
[https://developer.apple.com/library/mac/#documentation/Cocoa...](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Archiving/Articles/creating.html#//apple_ref/doc/uid/20000949-BABGBHCA)

2\. [http://www.raywenderlich.com/1914/how-to-save-your-app-
data-...](http://www.raywenderlich.com/1914/how-to-save-your-app-data-with-
nscoding-and-nsfilemanager)

------
grey-area
Wouldn't it make more sense for the first comparison in the docs to be with
core data? It is the point of reference in cocoa for model data and
persistence and is much simpler than the example given, so ignoring it till
the end seems a little disingenuous... Looks interesting though, I'm off to
read further.

~~~
refulgentis
In addition, their comments about Core Data multithreading are flat out wrong.
The whole point of queued contexts in iOS 5/OS X 10.7 was to do _away_ with
the whole mess of passing IDs between threads. It works quite well, although
as always, there is a vocal minority who never completely grokked Core Data
and hate on it when they encounter bugs in their implementation along the way.

