AlecrimCoreData
  • March 28, 2024

A powerful and elegant Core Data framework for Swift.

Usage


Beta version. New docs soon…

Simple do that:

let query = persistentContainer.viewContext.people
.where { \.city == “Piracicaba” }
.orderBy { \.name }

for person in query.dropFirst(20).prefix(10) {
print(person.name, person.address)
}

Or that:

persistentContainer.performBackgroundTask { context in
let query = context.people
.filtered(using: \.country == “Brazil” && \.isContributor == true)
.sorted(by: .descending(\.contributionCount))
.sorted(by: \.name)

if let person = query.first() {
print(person.name, person.email)
}
}

After that:

import AlecrimCoreData

extension ManagedObjectContext {
var people: Query<Person> { return Query(in: self) }
}

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.

GitHub


View Github

#coredata #database #ios #model #persistence
YOU MIGHT ALSO LIKE...
CameraBackground

Features Both front and back camera supported. Flash modes: auto, on, off. Countdown timer. Tap to focus. Pinch to zoom. Usage  

DKCamera

Description A light weight & simple & easy camera for iOS by Swift. It uses CoreMotion framework to detect device orientation, so ...

HorizonSDK-iOS

Horizon SDK is a state of the art real-time video recording / photo shooting iOS library. Some of the features ...

LLSimpleCamera

LLSimpleCamera: A simple customizable camera - video recorder control LLSimpleCamera is a library for creating a customized camera - video ...

RSBarcodes_Swift

RSBarcodes allows you to read 1D and 2D barcodes using the metadata scanning capabilities introduced with iOS 7 and generate ...