项目作者: Alecrim

项目描述 :
核心数据变得简单。
高级语言: Swift
项目地址: git://github.com/Alecrim/AlecrimCoreData.git
创建时间: 2014-08-03T19:44:44Z
项目社区:https://github.com/Alecrim/AlecrimCoreData

开源协议:MIT License

关键词:
swift coredata

下载


AlecrimCoreData

Version
Language: swift
Platforms
License: MIT
Author: Vanderlei Martinelli

A powerful and elegant Core Data framework for Swift.

Usage

Beta version. New docs soon…

Simple do that:

  1. let query = persistentContainer.viewContext.people
  2. .where { \.city == "Piracicaba" }
  3. .orderBy { \.name }
  4. for person in query.dropFirst(20).prefix(10) {
  5. print(person.name, person.address)
  6. }

Or that:

  1. persistentContainer.performBackgroundTask { context in
  2. let query = context.people
  3. .filtered(using: \.country == "Brazil" && \.isContributor == true)
  4. .sorted(by: .descending(\.contributionCount))
  5. .sorted(by: \.name)
  6. if let person = query.first() {
  7. print(person.name, person.email)
  8. }
  9. }

After that:

  1. import AlecrimCoreData
  2. extension ManagedObjectContext {
  3. var people: Query<Person> { return Query(in: self) }
  4. }
  5. let persistentContainer = PersistentContainer()

And after your have created your matching managed object model in Xcode, of course. ;-)

Contribute

If you have any problems or need more information, please open an issue using the provided GitHub link.

You can also contribute by fixing errors or creating new features. When doing this, please submit your pull requests to this repository as I do not have much time to “hunt” forks for not submitted patches.

  • master - The production branch. Clone or fork this repository for the latest copy.
  • develop - The active development branch. Pull requests should be directed to this branch.

Contact the author

License

AlecrimCoreData is released under an MIT license. See LICENSE for more information.