-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refresh Documentation ahead of new release (#28)
- Loading branch information
1 parent
6180579
commit dca94e0
Showing
9 changed files
with
372 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
Sources/NetworkReachability/NetworkReachability.docc/Comparison.md
This file was deleted.
Oops, something went wrong.
32 changes: 32 additions & 0 deletions
32
Sources/NetworkReachability/NetworkReachability.docc/GettingStarted.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Getting Started with NetworkReachability | ||
|
||
Choose between the two APIs included with NetworkReachability | ||
|
||
## Overview | ||
|
||
NetworkReachability consists of two main classes, ``NetworkMonitor`` and ``ReachabilityMonitor`` | ||
|
||
``NetworkMonitor`` is built on Apple's [Network](https://developer.apple.com/documentation/network) framework. As such, it requires iOS 12 and returns [`NWPath`](https://developer.apple.com/documentation/network/nwpath) types. | ||
|
||
``ReachabilityMonitor`` is built on [SystemConfiguration](https://developer.apple.com/documentation/systemconfiguration), and returns a ``Reachability`` struct which wraps [``SCNetworkReachabilityFlags``](https://developer.apple.com/documentation/systemconfiguration/scnetworkreachabilityflags) | ||
|
||
These APIs are very similar, and can generally be used interchangeably. Like Apple's APIs, ``ReachabilityMonitor`` offers a synchronous & asynchronous APIs, and is capable of throwing errors. ``NetworkMonitor`` monitor is simpler and more powerful, but does not offer a reliable synchronous API. | ||
|
||
| API | Single Value | Observing Values | Throws Errors | Minimum OS | | ||
| ------------------ | ------------ | ----------------- | ------------- | --------------------------------------- | | ||
| ``NetworkMonitor`` | Async | Async | No | iOS 12, macOS 10.14, watchOS 5, tvOS 12 | | ||
| ``Reachability`` | Sync | Async | Yes | iOS 11, macOS 10.13, watchOS 4, tvOS 11 | | ||
|
||
I recommend that you use ``NetworkMonitor`` as it both simpler and more robust, unless you need to target iOS 11 or you absolutely need a synchronous API. | ||
|
||
Both APIs still offer the same observability mechanisms: | ||
|
||
* [Delegation](https://developer.apple.com/library/archive/documentation/General/Conceptual/DevPedia-CocoaCore/Delegation.html) | ||
* [Closures](https://docs.swift.org/swift-book/LanguageGuide/Closures.html) | ||
* [NotificationCenter](https://developer.apple.com/documentation/foundation/notificationcenter) | ||
* [Swift Concurrency](https://docs.swift.org/swift-book/LanguageGuide/Concurrency.html) | ||
* [Combine](https://developer.apple.com/documentation/combine) | ||
|
||
To learn more about ``NetworkMonitor``, see the <doc:NetworkMonitorGuide>. | ||
|
||
To learn more about ``ReachabilityMonitor``, see the <doc:ReachabilityMonitorGuide> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.