Jon Arrien

Tag: iOS

Alcatraz.io

Alcatraz is an open-source package manager for Xcode. It lets you discover and install plugins, templates and color schemes without the need for manually cloning or copying files. It installs itself as a part of Xcode and it feels like home.

[cc lang=”bash]
curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh
[/cc]

MagicalRecord

The more I jutted into the wonderful world of ruby, I found more and more weary to manage CoreData API. Everytime you want to create a simple query, you need to define the request, the predicate and the sorting descriptors.

This could be an example query to retrieve people sorted by name:

[cc lang=”objc”]
NSFetchRequest *request = [NSFetchRequest fetchRequestWithEntityName:@”Person”];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@”1==1″];
[request setPredicate:predicate];

NSSortDescriptor * firstNameSort = [[NSSortDescriptor alloc] initWithKey:@”first_name” ascending:YES];
request.sortDescriptors = @[firstNameSort]];

NSError *error = nil;
NSArray *people = [context executeFetchRequest:request error:&error];
[/cc]

MagicalRecord instead, integrates active record pattern like in Rails and I think the difference is remarkable:

[cc lang=”objc]
NSPredicate *predicate = [NSPredicate predicateWithFormat:@”1==1″];
NSArray *people = [Person findAllSortedBy:@”first_name” ascending:YES withPredicate:predicate]
[/cc]

MagicalRecord at Github

Goodbye IB, Hello Teacup

Interesting video about how to build forms in RubyMotion without using Interface Builder and without the need of creating complex datasources for your tableviews.

RestKit Framework

Recently I had to develop an iOS App that consumes lots of REST services and I was looking for an easier way to manage remote object synchronization. I founded RestKit,  a framework that works on top of well known AFNetworking library.

Mapping example:

[cc lang=”objc” tab_size=”2″ lines=”40″]

RKEntityMapping *carMapping = [RKEntityMapping mappingForEntityForName:@”Car” inManagedObjectStore:_objectStore];
[carMapping addAttributeMappingsFromDictionary:@{ @”car.id” : @”sid”,
@”car.model” : @”model”,
@”car.hp” : @”hp”
}];
[/cc]

You can find more information on project’s README file.

Copyright © 2017 Jon Arrien

Theme by Anders NorenUp ↑