Get Updates By E-mail 

Article Written By:
Johann Dowa

Open Source iOS Objective-C Categories For Fast, Easy, Clean, Threaded Disk I/O


I’ve mentioned using NSOperation/NSOperationQueue to speed up your apps, and posted a tutorial on the basics of using  Grand Central Dispatch.

Today I came across a library, EDStorage from Andrew Sliwinski was created to eliminate the need for the large amounts of boilerplate code required to run iOS I/O code in a background thread.

EDStorage does all the NSOperation/NSOperationQueue handling for you in the background providing categories for NSData and UIImage.

Here’s an example from the ReadMe demonstrating how easy it is to persist a UIImage to the cache directory:

- (void)doSomething
UIImage *image = [UIImage imageNamed:@"keyboardCat.png"];

[image persistToCache:^(NSURL *url, NSUInteger size) {
NSLog(@"FTW!: %@ | %d bytes", url, size);
} failure:^(NSError *error) {
NSLog(@"UH OH: %@", error);

As you can see the library provides a very nice, clean syntax and in addition to persisting to the cache directory you can persist to the temp directory.

You can download the EDStorage categories along with an example on Github here.

A nice clean library for fast and easy handling of disk I/O.


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.