A Swift replacement for Apple's Reachability with closure-based network monitoring for iOS, macOS, and tvOS.
Reachability.swift is a Swift library that monitors network connectivity changes on Apple platforms. It replaces Apple's original Reachability sample with a modern, closure-based API that detects when a device loses or regains network access and can differentiate between connection types like WiFi and cellular.
iOS, macOS, and tvOS developers who need to monitor network availability in their apps and respond to connectivity changes with clean, Swift-native code.
Developers choose Reachability.swift because it provides a more maintainable and Swift-idiomatic alternative to Apple's Reachability, with closure-based APIs that simplify network monitoring compared to delegate patterns or notification-heavy approaches.
Replacement for Apple's Reachability re-written in Swift with closures
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses Swift closures for network change events, making code cleaner and more intuitive than delegate patterns, as shown in the example where reachability.whenReachable triggers closures on the main queue.
Compatible with iOS 8.0+, macOS 10.9+, and tvOS 9.0+, covering a wide range of Apple devices and versions for versatile app development.
Differentiates between WiFi and cellular connections via the .connection property, useful for optimizing data usage in apps, as demonstrated in the switch cases.
Delivers all closures and notifications on the main queue by default, preventing UI threading issues and ensuring safe updates in response to network changes.
README specifies compatibility only up to iOS 12.0, macOS 10.14, and tvOS 12.0, which may not cover newer OS versions without updates, potentially requiring manual maintenance.
Requires keeping the Reachability instance in scope to avoid deallocation, as noted in examples, adding complexity to memory management in larger apps.
Focuses solely on reachability detection without advanced capabilities like network quality assessment, latency monitoring, or handling of complex network scenarios.