All Projects → dmytro-anokhin → core-data-model-description

dmytro-anokhin / core-data-model-description

Licence: MIT license
Declarative way to describe a Core Data model in code.

Programming Languages

swift
15916 projects

Projects that are alternatives of or similar to core-data-model-description

Carekit
CareKit is an open source software framework for creating apps that help people better understand and manage their health.
Stars: ✭ 2,142 (+3470%)
Mutual labels:  swift-package-manager, core-data, swift5
Corestore
Unleashing the real power of Core Data with the elegance and safety of Swift
Stars: ✭ 3,254 (+5323.33%)
Mutual labels:  swift-package-manager, coredata, core-data
BetterMappable
Better Mappable through Property Wrappers using ObjectMapper
Stars: ✭ 26 (-56.67%)
Mutual labels:  swift-package-manager, swift5
EKAstrologyCalc
Astrology Calculator calculates moon's rise/set times, moon Age, moon phases and Zodiac Sign for location and time
Stars: ✭ 31 (-48.33%)
Mutual labels:  swift-package-manager, swift5
MMActionSheet
An actionSheet view implement with pure swift
Stars: ✭ 25 (-58.33%)
Mutual labels:  swift-package-manager, swift5
Shift
Light-weight EventKit wrapper.
Stars: ✭ 31 (-48.33%)
Mutual labels:  swift-package-manager, swift5
SETabView
SETabView is a TabBar with simple yet beautiful animations that makes your apps look cool!
Stars: ✭ 53 (-11.67%)
Mutual labels:  swift-package-manager, swift5
Hippolyte
HTTP Stubbing in Swift
Stars: ✭ 109 (+81.67%)
Mutual labels:  swift-package-manager, swift5
Sync
JSON to Core Data and back. Swift Core Data Sync.
Stars: ✭ 2,538 (+4130%)
Mutual labels:  coredata, core-data
Cloudcore
Framework that enables syncing between iCloud (CloudKit) and Core Data
Stars: ✭ 146 (+143.33%)
Mutual labels:  swift-package-manager, coredata
Swift-FFDB
a Object/Relational Mapping (ORM) support to iOS and MacOS .Since SwiftFFDB is build on top of FMDB.
Stars: ✭ 22 (-63.33%)
Mutual labels:  swift-package-manager, swift5
SwiftGradients
Useful extensions for UIViews and CALayer classes to add beautiful color gradients.
Stars: ✭ 15 (-75%)
Mutual labels:  swift-package-manager, swift5
JSONPreview
🎨 A view that previews JSON in highlighted form, it also provides the ability to format and collapse nodes.
Stars: ✭ 21 (-65%)
Mutual labels:  swift-package-manager, swift5
TVToday
iOS TV Shows app with TMDb Api. RxSwift, MVVM, Clean Architecture. Tuist + Swift Package Manager
Stars: ✭ 27 (-55%)
Mutual labels:  swift-package-manager, swift5
Combinative
UI event handling using Apple's combine framework.
Stars: ✭ 106 (+76.67%)
Mutual labels:  swift-package-manager, swift5
Match3Kit
Library for simple Match3 games.
Stars: ✭ 38 (-36.67%)
Mutual labels:  swift-package-manager, swift5
NYTimes-iOS
🗽 NY Times is an Minimal News 🗞 iOS app 📱 built to describe the use of SwiftSoup and CoreData with SwiftUI🔥
Stars: ✭ 152 (+153.33%)
Mutual labels:  coredata, swift5
Bettersegmentedcontrol
An easy to use, customizable replacement for UISegmentedControl & UISwitch.
Stars: ✭ 1,782 (+2870%)
Mutual labels:  swift-package-manager, swift5
Table
CLI tables in Swift
Stars: ✭ 53 (-11.67%)
Mutual labels:  swift-package-manager, swift5
PagedLists
Paginated UITableView and UICollectionViews for iOS.
Stars: ✭ 69 (+15%)
Mutual labels:  swift-package-manager, swift5

CoreDataModelDescription

Declarative way to describe a Core Data model in code. Swifty Core Data model 🙂

Usage

Use CoreDataModelDescription to describe your model. Sample code describes this model:

Image of Author, Publication, and Article model

Assuming you already defined Author, Publication, and Article subclasses of NSManagedObject.

let modelDescription = CoreDataModelDescription(
    entities: [
        .entity(
            name: "Author",
            managedObjectClass: Author.self,
            attributes: [
                .attribute(name: "name", type: .stringAttributeType)
            ],
            relationships: [
                .relationship(name: "publications", destination: "Publication", toMany: true, deleteRule: .cascadeDeleteRule, inverse: "author", ordered: true)
            ]),
        .entity(
            name: "Publication",
            managedObjectClass: Publication.self,
            attributes: [
                .attribute(name: "publicationDate", type: .dateAttributeType),
                .attribute(name: "numberOfViews", type: .integer64AttributeType, isOptional: true)
            ],
            relationships: [
                .relationship(name: "author", destination: "Author", toMany: false, inverse: "publications")
            ]),
        .entity(
            name: "Article",
            managedObjectClass: Article.self,
            parentEntity: "Publication",
            attributes: [
                .attribute(name: "text", type: .stringAttributeType)
            ])
    ]
)

let model = modelDescription.makeModel()

Motivation

Motivation and creating this package described in my article Core Data and Swift Package Manager.

This package is still on early stage of development. Please submit issues for missing functionality. Pull requests are more than welcome.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].