Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

iOS-Controls/TOReachability

Open more actions menu
 
 

Repository files navigation

TOReachability

CI Version Carthage compatible GitHub license PayPal

A lightweight, unit-tested class that detects network status changes on iOS.

TOReachability is a small Objective-C class that can be used to detect when the current device changes its network status; between Wi-Fi, cellular, or none.

It based on, but is a completely new implementation of Apple's Reachability class. Compared to Reachability, apart from being properly name-spaced for Objective-C, it has been cleaned up to use modern Objective-C conventions, removes since deprecated features, and removes much of the unnecessary code Apple included.

While TOReachability only currently includes the most basic of functionality, it is definitely open to PRs when and if anyone has additional functionality they would like.

Features

  • Fully-unit tested.
  • Integrated with CocoaPods and Carthage.
  • Reactively executes callback logic whenever the network status of the current status changes.
  • Callback choices include blocks, delegates and NSNotification.
  • For cases where only Wi-Fi is needed, an option may be set to ignore cellular status changes.
  • Fully-bridged and tested to work in Swift.

Minimum Requirements

  • iOS 11.0
  • tvOS 11.0
  • macOS 10.13
  • Xcode 14.0

Installation Instructions

CocoaPods
pod 'TOReachability'
Carthage
github "TimOliver/TOReachability"
Manual Installation
Simply move the `TOReachability` folder to your Xcode project and import it.

Sample Code

Objective-C

TOReachability *reachability = [TOReachability reachabilityForInternetConnection];

reachability.statusChangedHandler = ^(TOReachabilityStatus newStatus) {
        NSLog(@"Network Status Changed!");
};

[reachability start];

Swift

let reachability = Reachability.forInternetConnection()

reachability.statusChangedHandler = { newStatus in
    print("Network Status Changed!")
}

reachability.start()

Credits

Developed by Tim Oliver as a component for iComics.

Device mockup by Mockups Design.

License

TOReachability is licensed under the MIT License, please see the LICENSE file.

About

A lightweight, unit-tested class that detects network status changes on iOS.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Objective-C 80.1%
  • Ruby 16.5%
  • Swift 3.4%
Morty Proxy This is a proxified and sanitized view of the page, visit original site.