{"id":18763743,"url":"https://github.com/dmytro-anokhin/core-data-model-description","last_synced_at":"2025-04-13T04:32:48.332Z","repository":{"id":46607522,"uuid":"202207270","full_name":"dmytro-anokhin/core-data-model-description","owner":"dmytro-anokhin","description":"Declarative way to describe a Core Data model in code.","archived":false,"fork":false,"pushed_at":"2021-10-17T08:40:55.000Z","size":45,"stargazers_count":73,"open_issues_count":2,"forks_count":9,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-10T08:46:31.983Z","etag":null,"topics":["core-data","coredata","swift","swift-package","swift-package-manager","swift5","xcode"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dmytro-anokhin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-08-13T18:59:30.000Z","updated_at":"2024-10-14T01:55:44.000Z","dependencies_parsed_at":"2022-09-12T18:51:33.555Z","dependency_job_id":null,"html_url":"https://github.com/dmytro-anokhin/core-data-model-description","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmytro-anokhin%2Fcore-data-model-description","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmytro-anokhin%2Fcore-data-model-description/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmytro-anokhin%2Fcore-data-model-description/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmytro-anokhin%2Fcore-data-model-description/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmytro-anokhin","download_url":"https://codeload.github.com/dmytro-anokhin/core-data-model-description/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248664189,"owners_count":21141911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["core-data","coredata","swift","swift-package","swift-package-manager","swift5","xcode"],"created_at":"2024-11-07T18:27:18.053Z","updated_at":"2025-04-13T04:32:48.097Z","avatar_url":"https://github.com/dmytro-anokhin.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CoreDataModelDescription\n\nDeclarative way to describe a Core Data model in code. Swifty Core Data model 🙂\n\n## Usage\n\nUse `CoreDataModelDescription` to describe your model. Sample code describes this model:\n\n![Image of Author, Publication, and Article model](https://miro.medium.com/max/1400/1*j7NgD-RplJ13E6j1Lzao0A.png)\n\nAssuming you already defined `Author`, `Publication`, and `Article` subclasses of `NSManagedObject`.\n\n```swift\nlet modelDescription = CoreDataModelDescription(\n    entities: [\n        .entity(\n            name: \"Author\",\n            managedObjectClass: Author.self,\n            attributes: [\n                .attribute(name: \"name\", type: .stringAttributeType)\n            ],\n            relationships: [\n                .relationship(name: \"publications\", destination: \"Publication\", toMany: true, deleteRule: .cascadeDeleteRule, inverse: \"author\", ordered: true)\n            ]),\n        .entity(\n            name: \"Publication\",\n            managedObjectClass: Publication.self,\n            attributes: [\n                .attribute(name: \"publicationDate\", type: .dateAttributeType),\n                .attribute(name: \"numberOfViews\", type: .integer64AttributeType, isOptional: true)\n            ],\n            relationships: [\n                .relationship(name: \"author\", destination: \"Author\", toMany: false, inverse: \"publications\")\n            ]),\n        .entity(\n            name: \"Article\",\n            managedObjectClass: Article.self,\n            parentEntity: \"Publication\",\n            attributes: [\n                .attribute(name: \"text\", type: .stringAttributeType)\n            ])\n    ]\n)\n\nlet model = modelDescription.makeModel()\n```\n\n## Motivation\n\nMotivation and creating this package described in my article [Core Data and Swift Package Manager](https://medium.com/@dmytro.anokhin/core-data-and-swift-package-manager-6ed9ff70921a).\n\nThis package is still on early stage of development. Please submit issues for missing functionality. Pull requests are more than welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmytro-anokhin%2Fcore-data-model-description","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmytro-anokhin%2Fcore-data-model-description","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmytro-anokhin%2Fcore-data-model-description/lists"}