Latest 0.0.1
Homepage https://github.com/smartwalle/KICoreDataManager
License MIT
Platforms ios , requires ARC
Frameworks CoreData
Authors

一个用于快速集成CoreData的工具库

集成步骤:

1、创建DataModel(用默认名称Model就好,如果需要用特殊的名称,需要调用KICoreDataManager里面的setupWithModelName:dbSavePath方法进行配置),并添加Entity(比如 User)

2、根据Entity创建NSManagedObject subclass

3、如果需要用到NSFetchedResultsController,则需要为每个NSManagedObject subclass添加一个类方法+ (NSString *)defaultSortAttribute (可选)

4、在需要操作的地方导入KICoreDataManager.h文件

添加一条数据

NSManagedObjectContext *context = [[KICoreDataManager sharedInstance] createManagedObjectContext];

User *user = [User objectsWithContext:context]

user.age = ..

user.name = …

[context commitUpdate];

详见Sample Code

Pods

<<<<<<< HEAD
pod ‘KICoreDataManager’

pod 'KICoreDataManager', :git => "https://github.com/smartwalle/KICoreDataManager.git"

ed73daaf4bc5a83d5c66eaa63202a53ce1f712dc

Latest podspec

{
    "name": "KICoreDataManager",
    "version": "0.0.1",
    "summary": "KICoreDataManager.",
    "description": "KICoreDataManagern =================nn u4e00u4e2au7528u4e8eu5febu901fu96c6u6210CoreDatau7684u5de5u5177u5e93nnn u96c6u6210u6b65u9aa4:nnn 1u3001u521bu5efaDataModeluff08u7528u9ed8u8ba4u540du79f0Modelu5c31u597duff0cu5982u679cu9700u8981u7528u7279u6b8au7684u540du79f0uff0cu9700u8981u8c03u7528KICoreDataManageru91ccu9762u7684setupWithModelName:dbSavePathu65b9u6cd5u8fdbu884cu914du7f6euff09uff0cu5e76u6dfbu52a0Entityuff08u6bd4u5982 Useruff09nn 2u3001u6839u636eEntityu521bu5efaNSManagedObject subclassnn 3u3001u5982u679cu9700u8981u7528u5230NSFetchedResultsControlleruff0cu5219u9700u8981u4e3au6bcfu4e2aNSManagedObject subclassu6dfbu52a0u4e00u4e2au7c7bu65b9u6cd5+ (NSString *)defaultSortAttribute uff08u53efu9009uff09nn 4u3001u5728u9700u8981u64cdu4f5cu7684u5730u65b9u5bfcu5165KICoreDataManager.hu6587u4ef6nnn u6dfbu52a0u4e00u6761u6570u636enn NSManagedObjectContext *context = [[KICoreDataManager sharedInstance] createManagedObjectContext];nn User *user = [User objectsWithContext:context]nn user.age = ..nn user.name = ...nn ...nn [context commitUpdate];nnn u8be6u89c1Sample Code",
    "homepage": "https://github.com/smartwalle/KICoreDataManager",
    "license": "MIT",
    "authors": {
        "SmartWalle": "[email protected]"
    },
    "platforms": {
        "ios": null
    },
    "source": {
        "git": "https://github.com/smartwalle/KICoreDataManager.git",
        "tag": "0.0.1"
    },
    "source_files": "KICoreDataManager/KICoreDataManager/*.{h,m}",
    "exclude_files": "Classes/Exclude",
    "frameworks": "CoreData",
    "requires_arc": true
}

Pin It on Pinterest

Share This