Its a blog!

I’m back baby!

And as a first post I’d like to point you to a new project of mine over on github called Reachability.

Its basically a ‘drop in’ replacement for the old Apple reachability, however it takes advantage of Grand Central Dispatch and Blocks to make your life a heckuvalot easier!

using it couldn’t be easier, see the example below:

// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];

// set the blocks 
reach.reachableBlock = ^(Reachability*reach)
{
    NSLog(@"REACHABLE!");
};

reach.unreachableBlock = ^(Reachability*reach)
{
    NSLog(@"UNREACHABLE!");
};

// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];

In addition your old code that uses NSNotificationCenter will continue to work too!

3 months ago on November 13th, 2011 at 1:54 pm | Permalink