Latest 2.0.4
Homepage https://github.com/willowtreeapps/WillowTreeReachability
License MIT
Platforms ios 8.0, tvos 9.0

Build Status

by WillowTree, Inc. We’re hiring! Come join our team!

Simple Swift class for monitoring network reachability. This class uses a subscription model to notify listeners of network status changes. Multiple listeners may be added to a single Reachability instance.

Installation

CocoaPods:

pod 'WillowTreeReachability'

Carthage:

github "willowtreeapps/WillowTreeReachability" >= 2.0

Usage

To start Reachability, begin by initializing the class to check for either host reachability or general reachability as shown below:

import WillowTreeReachability

// Reachability for specific host
let reachability = Monitor(withURL: NSURL(string: "http://www.willowtreeapps.com")!)

// General internet Reachability
let reachability = Monitor()

Please note that WillowTreeReachability uses optional initializers and if there is an error creating the reachability connection, then nil is returned.

Asynchronous Notifications

WillowTreeReachability utilizes asynchronous network status monitoring to update the application of network changes. The notifier can be started by calling startMonitoring and adding a subscriber through the addReachabilitySubscriber function. An example is shown below.

reachability?.start()

reachabilitySubscription = reachability?.addSubscription(using: self)

}

The subscription should be held strongly by the callee to keep the subscription active.

Stopping Reachability

In order to properly clean up when stopping the reachability notifications, the stop function should be called.

Latest podspec

{
    "name": "WillowTreeReachability",
    "version": "2.0.4",
    "summary": "Simple Swift class for monitoring network reachability.",
    "description": "Simple Swift class for monitoring network reachability. This class uses a subscription model to notify listeners of network status changes. Multiple listeners may be added to a single Reachability instance.",
    "homepage": "https://github.com/willowtreeapps/WillowTreeReachability",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "WillowTree, Inc.",
    "platforms": {
        "ios": "8.0",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/willowtreeapps/WillowTreeReachability.git",
        "tag": "2.0.4"
    },
    "source_files": [
        "Reachability",
        "Sources/**/*.{swift}"
    ],
    "ios": {
        "frameworks": [
            "MobileCoreServices",
            "SystemConfiguration"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This