CoreDataDandy alternatives and similar libraries
Based on the "Core Data" category.
Alternatively, view CoreDataDandy alternatives based on common mentions on social networks and blogs.
-
PrediKit
An NSPredicate DSL for iOS, OSX, tvOS, & watchOS. Inspired by SnapKit and lovingly written in Swift. -
Skopelos
A minimalistic, thread safe, non-boilerplate and super easy to use version of Active Record on Core Data. Simply all you need for doing Core Data. Swift flavour. -
JustPersist
DISCONTINUED. JustPersist is the easiest and safest way to do persistence on iOS with Core Data support out of the box. It also allows you to migrate to any other persistence framework with minimal effort. -
CloudCore
Robust CoreData-CloudKit synchronization, including offline queuing, relationships, private, shared and public databases, field-level deltas, encrypted values, maskable attributes, cacheable assets, and more. -
SLRESTfulCoreData
Objc naming conventions, autogenerated accessors at runtime, URL substitutions and intelligent attribute mapping -
CWCoreData
DISCONTINUED. Additions and utilities to make it concurrency easier with the Core Data framework. -
Cadmium
A Swift framework that wraps CoreData, hides context complexity, and helps facilitate best practices.
SaaSHub - Software Alternatives and Reviews
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of CoreDataDandy or a related project?
README
[header](header.png)
Introduction
Core Data Dandy is a feature-light wrapper around Core Data that simplifies common database operations.
Feature summary
- Initializes and maintains a Core Data stack.
- Provides convenience methods for saves, inserts, fetches, and deletes.
- Maps json into NSManagedObjects via a lightweight API.
- Deserializes NSManagedObjects into json
Installation
Carthage
github "fuzz-productions/CoreDataDandy" ~> 0.6.1
CocoaPods
pod 'CoreDataDandy', '0.6.1'
Usage
All standard usage of Core Data Dandy should flow through CoreDataDandy's sharedDandy. More advanced users, however, may find its various components useful in isolation.
Bootstrapping
CoreDataDandy.wake("ModelName")
Saving and deleting
Save with or without a closure.
Dandy.save()
Dandy.save { error in
// Respond to save completion.
}
Delete with or without a closure.
Dandy.delete(object)
Dandy.delete(object) {
// Respond to deletion completion.
}
Destroy the contents of the database. Called, for example, to recover from a failure to perform a migration.
Dandy.tearDown()
Fetching
Fetch all objects of a given type.
Dandy.fetch(Gossip.self)
Fetch an object corresponding to an entity and primaryKey value.
Dandy.fetchUnique(Hat.self, identifiedBy: "bowler")
Fetch an array of objects filtered by a predicate.
Dandy.fetch(Gossip.self, filterBy: NSPredicate(format: "topic == %@", "John Keats"))
Insertions and updates
Insert object of a given type.
Dandy.insert(Gossip.self)
Insert or fetch a unique a object from a primary key.
Dandy.insertUnique(Slander.self, identifiedBy: "WILDE")
Upsert a unique object, or insert and update a non-unique object.
Dandy.upsert(Gossip.self, from: json)
Upsert an array of unique objects, or insert and update non-unique objects.
Dandy.batchUpsert(Gossip.self, from: json)
Mapping finalization
Objects requiring custom mapping finalization should adopt the MappingFinalizer
protocol. The protocol has a single function, finalizeMapping(_:)
.
extension Conclusion: MappingFinalizer {
func finalizeMapping(of json: [String : AnyObject]) {
if var content = content {
content += "_FINALIZED"
self.content = content
}
}
}
Serialization
Serialize a single object.
Serializer.serialize(gossip)
Serialize an array of objects.
Serializer.serialize([byron, wilde, andre3000])
Serialize an object and its relationships.
Serializer.serialize(gossip, including: ["purveyor"])
Serialize an object and its nested relationships.
Serializer.serialize(gossip, including: ["purveyor.hats.material, purveyor.predecessor"])
xcdatamodel decorations
CoreDataDandy supports four xcdatamodel attributes. All decorations are declared and documented in DandyConstants.
@primaryKey
Add this decoration to the entity's userInfo to specify which property on the entity functions as its primaryKey.
@mapping
Add this decoration to a property to specify an alternate mapping for this property. For instance, if a property is named "abbreviatedState," but the json value for this property is found at the key "state," add @mapping : state to the abbreviatedState's userInfo.
@false
Use this decoration in conjunction with the @mapping keyword to disable mapping to the property. For instance, if your entity has an attribute named "secret" that you'd prefer to map yourself, add @mapping : @false to secret's userInfo.
@singleton
Add this decoration to an entity's userInfo if there should never be more than one instance of this entity in your database. This decoration may be useful for objects like Tokens and CurrentUsers, though it's primarily included to suggest the kind of decorations that may be added in the future.
Warnings
To receive console warnings in Swift projects, add the entry -D DEBUG in your project's build settings under Swift Compiler - Custom Flags.
*Note that all licence references and agreements mentioned in the CoreDataDandy README section above
are relevant to that project's source code only.