Swiftpack.co - ezoushen/Crush as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by ezoushen.
ezoushen/Crush 0.10.1
Code with Core Data in a Swifty way
⭐ī¸ 32
🕓 1 week ago
iOS macOS watchOS tvOS
.package(url: "https://github.com/ezoushen/Crush.git", from: "0.10.1")


Enhance the development experience with CoreData by providing greater type-safety and intuitive functionality


🕹ī¸ Take full control of your CoreData management.
🧑‍đŸ’ģ 100% managed code, no code generation required.
📖 Free from Xcode GUI, and human-friendly diff records on git.


Make sure you've declared Crush as your dependency before getting started

let package = Package(
  dependencies: [
      url: "https://github.com/ezoushen/Crush",
      from: "TARGET_VERSION"
  targets: [
      name: "<your-target-name>",
      dependencies: [


Only three steps to start using Crush

1. Define your schema

class Todo: Entity {
    var title = Value.String("title") // A required string property named "title"

    var memo = Value.String("memo") // An optional string property named "memo"

    var finished = Value.Bool("finished")

    var parent = Relation.ToOne<Todo>("parent") // An optional relationship to another Todo

    var children = Relation.ToMany<Todo>("children")

2. Create your DataContainer

let container = try DataContainer.load(
    storages: .sqlite(url: targetURL), 
    dataModel: DataModel(name: "V1", [ Todo() ]))

3. Start coding đŸ”ĨđŸ”ĨđŸ”Ĩ

try container.startSession().sync { context in
    let todo = context.create(Todo.self)
    todo.title = "Hello Crush"
    try context.commit()


Swift DocC style documentation is available here


If you want to contribute to the project, please feel free to open a pull request/issue.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics