DPPReachability

DPPReachability is a library built on top of Reachability by Toni Million. It manages the reachability of network either Wifi or WAN. With DPPReachability you don't have to create multiple Reachability instances classes inside every ViewController or use [UIApplication sharedApplication] to share object through different classes instead you can use a single object through different classes.

The class maintains all advantages of Reachability.

How to use

Copy DPPreachability directory into your project. DPPReachability should be istantiated only once. To istantiate a class, you should invoke DPPReachability *reachManager = [DPPReachability sharedInstance];

And then invoke the method

- (void)setupReachibilityManagerUrl:(NSString*)url reachableOnWAN:(BOOL)reachOnWan

Above method should be called only once.

I suggest to setup your DPPReachability inside AppDelegate, particularly in method

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

In every class where you need to check connection, you can retrieve Singleton and then check the BOOL property isReachable that indicate when connection is available or not.

It's also possibile to use Blocks when the OS losts or retrieves the connection, to accomplish some operations. You set Blocks once per class when DPPReachability is used, invoking the method

- (void)setupReachableBlock:(DPPReacheableBlock)reachBlock unreachableBlock:(DPPUnreacheableBlock)unreachBlock

The reachableBlock will be called every time the connection goes up. The unreachableBlock will be called every time the connection goes down.

License

The MIT License (MIT)

Copyright (c) 2014 Dario Pizzuto

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.