Git Product home page Git Product logo

datamodelkit's Introduction

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

datamodelkit's People

Contributors

poissonballon avatar trpl avatar

Stargazers

Francesco avatar David Bonnet avatar Wildine Anthony avatar Sacha DSO avatar Florian Gabach avatar Gaël Foppolo avatar Damien Martin avatar Vincent Saluzzo avatar  avatar Felipe Ricieri avatar Carabineiro avatar

Watchers

James Cloos avatar Carabineiro avatar  avatar

Forkers

carabina

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.