Mantle makes it easy to write a simple model layer for your Cocoa or Cocoa Touch application. Mantle can still be a convenient translation layer between the API and your managed model objects.
本文使用mantle作data model,并使用其对coredata的interface创建数据持久化的过程。
操作过程很简单,就是数据的转换:
1.Manle data model
Mantle中用于持久化的方法:
// A MTLModel object that supports being serialized to and from Core Data as an
// NSManagedObject.
// The name of the Core Data entity that the receiver serializes to and
// deserializes from.
// Specifies how to map property keys to different keys on the receiver‘s
// +managedObjectEntity.
.h 文件
.m文件
2.coredata 持久化类
Coredata主要元素简要介绍
网上有很多图,但,还是觉得一本书上的这个图最好:
.h文件
.m文件
3.后台执行程序
Core Data with Mantle,布布扣,bubuko.com
原文地址:http://blog.csdn.net/xdrt81y/article/details/30633967