TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Apr 2015 |
Maintained by Nevyn Bengtsson, Nevyn Bengtsson.
by Joachim Bengtsson [email protected]
In my quest to write the most succinct, short and readable code humanly possible, I've written a few tools to help me. These tools are elaborately described on my blog, but in short:
Defines macros for creating your standard containers and "POD" objects (NSNumber, NSString, ...). I've always had such a file copy-pasted between projects, but this particular iteration is very much inspired by the excellent Jens Alfke's CollectionUtils, plus some ARC fixes and fixes. Unsung heroes: $castIf, $notNull.
A KVO observation needs to be registered and deregistered at the right points. You have this as a concept, but you have no object representing this concept. That sucks. SPKVONotificationCenter gives you an object to represent the concept of a KVO observation that you can manage like any other object; and the world is a nice place to live again.
On top of that, SPDepends experiments with magic, letting you subscribe to say three different KVC key paths on two different objects and getting a callback when anything changes, all in a line or two:
$depends(@"alarm", lock, @"locked", sensor, @"adjacentPeople", @"isOn", self, @"isOn", ^{
if(lock.locked && sensor.adjacentPeople.count > 0 && sensor.isOn && selff.isOn)
[selff triggerAlarm];
})
I find that this really brings out the power in KVO in a way only Bindings have done previously.