Latest 1.1.0
Homepage https://github.com/PoissonBallon/DataModelKit
License MIT
Platforms ios 9.0, osx 10.11, tvos 10.0, watchos 3.0
Dependencies SWXMLHash, FileKit
Authors

DataModelKit

DataModelKit

Version
Carthage compatible
Platform
Build Status
Swift 4
codecov
License

DataModelKit is a simple and light framework to parse and read *.xcdatamodel files. It provides an API to navigate and explore DataModel

It’s used in DataModelGen tools. (available soon)

Usage

Init a DataModel Object

import DataModelKit

static let path = "Project/Ressources/Sample.xcdatamodel"
let model = try? DataModel(with: DataModelKitTests.pathTest)

print(model.entities)

Installation

EasyRealm is available through CocoaPods, Carthage and SPM.

CocoaPods

use_frameworks!

pod "DataModelKit"

Carthage


github 'PoissonBallon/DataModelKit'

SPM

 dependencies: [
    .package(url: "https://github.com/PoissonBallon/DataModelKit.git", .upToNextMinor(from:"1.0.0"))
  ],

API

DataModelKit provide somes structs with attribute to exploite your DataModel

DataModel

It is the root object of your DataModel


public struct DataModel {  
  public let path: Struct   /// Path of the original file.xcdatamodel
  public let entities: [Entity] /// Parsed model's entities
  public let documentVersion: String /// Version of file.xcdatamodel
  public let systemVersion: String /// System version of file.xcdatamodel
  public let minimumToolsVersion: String /// Minimum tools version of file.xcdatamodel
  public let lastSavedToolsVersion: String /// Last saved tools version of file.xcdatamodel
}

Entity

public struct Entity {
  public let name: String ///
  public let userInfos: [UserInfo]
  public let attributes: [Attribute]
  public let relationships: [Relationship]
}

Relationship

public struct Relationship {
  public let name: String
  public let destination: String
  public let inverse: String?
  public let userInfo: [UserInfo]
  public let toMany: Bool
  public let toOne: Bool
  public let optional: Bool
  public let syncable: Bool
  public let ordered: Bool
}

Attribute

public struct Attribute {
  public let name: String
  public let optional: Bool
  public let indexed: Bool
  public let defaultValue: String?
  public let type: String
  public let userInfos: [UserInfo]
}

Author

License

DataModelKit is available under the MIT license. See the LICENSE file for more info.

Other

Latest podspec

{
    "name": "DataModelKit",
    "version": "1.1.0",
    "summary": "DataModelKit is a simple and light framework for read and parse .xcdatamodel",
    "description": "DataModelKit is a simple and light framework for parse and read *.xcdatamodel files. It provides an API for navigate and explore DataModel",
    "homepage": "https://github.com/PoissonBallon/DataModelKit",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Allan Vialatte": "[email protected]"
    },
    "source": {
        "git": "https://github.com/PoissonBallon/DataModelKit.git",
        "tag": "1.1.0"
    },
    "social_media_url": "https://twitter.com/poissonballon",
    "platforms": {
        "ios": "9.0",
        "osx": "10.11",
        "tvos": "10.0",
        "watchos": "3.0"
    },
    "source_files": "Sources/**/*",
    "dependencies": {
        "SWXMLHash": [
            "4.2.5"
        ],
        "FileKit": [
            "5.0.0"
        ]
    },
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This