Get Updates By E-mail 

Article Written By:
Johann Dowa

Skopelos – Swift Core Data Library Reducing Boilerplate With An Active Record Style Syntax

  •  
  •  
  •  
  •  
  •  

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:

__block NSArray *results = nil;

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:&amp;error];
</code></pre>

}];

return results;

And performing the same task with Skopelos:

SkopelosClient.sharedInstance.read { context in
    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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments