Provides a wrapper around NWPathMonitor to replace SCNetworkReachability.
These instructions will get you up and running with SLRNetworkMonitor.
Version | Minimum Xcode Version | Minimum macOS SDK | Minimum iOS SDK | Minimum tvOS SDK | Minimum watchOS SDK |
---|---|---|---|---|---|
2.0.2 -> Current | 12.0 | 10.14 | 12.0 | 12.0 | 6.0 |
2.0.0 -> 2.0.1 | 11.0 | 10.14 | 12.0 | 12.0 | 6.0 |
1.0.0 | 10.0 | 10.14 | 12.0 | 12.0 | N/A |
This library depends on a few system frameworks and libraries. If you have Modules and Link Frameworks Automatically enabled, then there isn't much that needs to be done. However, if you do not, you need to link against the Network
, Foundation
, & the CoreTelephony
(iOS only) frameworks. Additionally, both types of configurations must manually add libresolv
to the Link Binary With Libraries build phase.
This is the recommended installation method. Follow the instructions provided by Apple using this repository's URL.
You may download the latest binary from the releases page and then include it in your project.
If you want to build the library from source in your own project, you can either:
- Add the project as a submodule.
- Add the project as a subtree.
- Copy the source files directly into your project.
The submodule or subtree approaches are preferred over the copying of source files since you can easily obtain updates.
If you do not already have Carthage installed, you can install it via Homebrew:
brew install carthage
Once Carthage is installed, add SLRNetworkMonitor to your Cartfile
:
github "madsolar8582/SLRNetworkMonitor" ~> 2.0.0
Finally, run carthage
and take the resulting SLRNetworkMonitor.framework
and put it in your project.
If you do not already have CocoaPods installed, you can install it via Homebrew or you can install it via gem
:
brew install cocoapods
# OR
sudo gem install cocoapods # Note: sudo is required if you are installing to the system gemset
Once CocoaPods is installed, add SLRNetworkMonitor to your Podfile
or to your Podspec
as a dependency:
# Podfile
pod 'SLRNetworkMonitor', git: 'https://github.com/madsolar8582/SLRNetworkMonitor.git', tag: '2.0.0'
# Podspec
s.dependency 'SLRNetworkMonitor', git: 'https://github.com/madsolar8582/SLRNetworkMonitor.git', tag: '2.0.0'
To use this library, you need to create an instance of SLRNetworkMonitor
and then add an observer on the default Notification Center for the SLRNetworkMonitorNetworkStateDidChangeNotification
notification.
@import SLRNetworkMonitor;
- (void)someMethod
{
SLRNetworkMonitor *monitor = [SLRNetworkMonitor monitor];
self.networkMonitor = monitor;
[NSNotificationCenter.defaultCenter addObserver:self selector:@selector(handleNetworkStateChange:) name:SLRNetworkMonitorNetworkStateDidChangeNotification object:monitor];
[monitor startMonitoring];
}
-stopMonitoring
.
Additional documentation can be found on GitHub Pages.
Please read CONTRIBUTING for details on how to contribute.
Please read SUPPORT for details on how to get help with installation or usage.
This project is licensed under the LGPL v3 license.
Please read the CHANGELOG for details on the changes included in each release.
This project uses Semantic Versioning for versioning. For the versions available, see the releases page.
This project releases monthly if there are enough changes to warrant a release. However, if there are critical defects or inadvertent non-passive changes, a one-off release will be created for each impacted release series.
After a major version release, the older release series will stop receiving updates after 60 days and are then considered obsolete (and thus unsupported).