测试已测试 | ✗ |
语言语言 | SwiftSwift |
许可证 | MIT |
发布上次发布 | 2017年11月 |
SwiftSwift 版本 | 4.0 |
SPM支持 SPM | ✓ |
由 Allan Vialatte 维护。
依赖于 | |
SWXMLHash | = 4.2.5 |
FileKit | = 5.0.0 |
DataModelKit 是一个简单且轻量级的框架,用于解析和读取 *.xcdatamodel 文件。它提供 API 以导航和探索 DataModel
它在 DataModelGen 工具中使用。(即将推出)
import DataModelKit
static let path = "Project/Ressources/Sample.xcdatamodel"
let model = try? DataModel(with: DataModelKitTests.pathTest)
print(model.entities)
EasyRealm 通过 CocoaPods、Carthage 和 SPM 提供。
use_frameworks!
pod "DataModelKit"
github 'PoissonBallon/DataModelKit'
dependencies: [
.package(url: "https://github.com/PoissonBallon/DataModelKit.git", .upToNextMinor(from:"1.0.0"))
],
DataModelKit 提供了一些具有属性的结构,以exploite您的 DataModel
它是您 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
}
public struct Entity {
public let name: String ///
public let userInfos: [UserInfo]
public let attributes: [Attribute]
public let relationships: [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
}
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]
}
DataModelKit 在 MIT 许可证下可用。有关更多信息,请参阅 LICENSE 文件。