diff --git a/CHANGELOG.md b/CHANGELOG.md index fc00fee..1d56000 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## [Unreleased] +## [1.2.1] + +### Added + +- SwiftUI `currentPath` example. + +### Fixed + +- Availability to the main class. + ## [1.2.0] - 2021-12-06 ### Added diff --git a/README.md b/README.md index 29ed984..f4d99e5 100644 --- a/README.md +++ b/README.md @@ -22,9 +22,26 @@ if Reachability.shared.currentPath.isReachable { } else { print("No internet") } - ``` +### SwiftUI + +```swift +import SwiftUI +import Reachability + +struct SomeView: View { + @ObservedObject var reachability = Reachability.shared + + var body: some View { + if reachability.currentPath.isReachable { + // Show some data loaded from the internet + } else { + Text("No internet connection") + } + } +} +``` ### Using Combine diff --git a/Sources/Reachability.swift b/Sources/Reachability.swift index 5718ea9..b87ce6c 100644 --- a/Sources/Reachability.swift +++ b/Sources/Reachability.swift @@ -9,7 +9,7 @@ import Foundation import Combine import Network -@available(macOS 10.13, iOS 13.0, tvOS 13.0, watchOS 6.0, *) +@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) public final class Reachability: ObservableObject { public static let shared = Reachability()