Skopelos is an open source Swift library from Alberto De Bortoli for working with Core Data built on the active record pattern.
Skopelos dramatically reduces the amount of boiler plate required to work with Core Data with a clean chainable syntax for reading and writing.
This example from the readme shows how one could read from a database using standard Core Data syntax:
NSManagedObjectContext *context = …;
[context performBlockAndWait:^{
<pre><code>NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSEntityDescription *entityDescription = [NSEntityDescription entityForName:NSStringFromClass(User)
inManagedObjectContext:context];
[request setEntity:entityDescription];
NSError *error;
results = [context executeFetchRequest:request error:&error];
</code></pre>
}];
return results;
And performing the same task with Skopelos:
let users = User.SK_all(context)
print(users)
}
You can find Skopelos on Github here.
A great library for working with Core Data using Swift.
Original article: Skopelos – Swift Core Data Library Reducing Boilerplate With An Active Record Style Syntax
©2016 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.
Reference source: iOS App Dev Libraries, Controls, Tutorials, Examples and Tools