Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. iOS
  3. Reachability.swift

Reachability.swift

MITSwiftv5.2.4

A Swift replacement for Apple's Reachability with closure-based network monitoring for iOS, macOS, and tvOS.

GitHubGitHub
8.0k stars942 forks0 contributors

What is Reachability.swift?

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.

Target Audience

iOS, macOS, and tvOS developers who need to monitor network availability in their apps and respond to connectivity changes with clean, Swift-native code.

Value Proposition

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.

Overview

Replacement for Apple's Reachability re-written in Swift with closures

Use Cases

Best For

  • Detecting when an iOS app goes offline to show appropriate UI
  • Monitoring network changes to pause/resume background downloads
  • Differentiating between WiFi and cellular connections for data-heavy operations
  • Building network-aware features that adapt to connectivity changes
  • Replacing Apple's Reachability sample in Swift projects
  • Adding network status monitoring to macOS or tvOS applications

Not Ideal For

  • Apps requiring real-time network quality metrics like latency or bandwidth
  • Projects that need to monitor multiple network interfaces or VPN connections simultaneously
  • Cross-platform applications where consistent network monitoring across iOS, Android, and web is essential

Pros & Cons

Pros

Closure-Based API

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.

Broad Platform Support

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.

Connection Type Detection

Differentiates between WiFi and cellular connections via the .connection property, useful for optimizing data usage in apps, as demonstrated in the switch cases.

Main Thread Safety

Delivers all closures and notifications on the main queue by default, preventing UI threading issues and ensuring safe updates in response to network changes.

Cons

OS Version Limitations

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.

Scope Management Overhead

Requires keeping the Reachability instance in scope to avoid deallocation, as noted in examples, adding complexity to memory management in larger apps.

Basic Feature Set

Focuses solely on reachability detection without advanced capabilities like network quality assessment, latency monitoring, or handling of complex network scenarios.

Frequently Asked Questions

Quick Stats

Stars7,961
Forks942
Contributors0
Open Issues84
Last commit2 years ago
CreatedSince 2014

Tags

#apple-platforms#ios#tvos#network-monitoring#connectivity#swift#closure-based-api#macos#reachability

Built With

S
Swift

Included in

iOS51.7kSwift26.0k
Auto-fetched 1 day ago

Related Projects

AlamofireAlamofire

Elegant HTTP Networking in Swift

Stars42,395
Forks7,653
Last commit13 days ago
AFNetworkingAFNetworking

A delightful networking framework for iOS, macOS, watchOS, and tvOS.

Stars33,340
Forks10,599
Last commit3 years ago
ShadowsocksX-NGShadowsocksX-NG

Next Generation of ShadowsocksX

Stars32,864
Forks7,716
Last commit17 days ago
MoyaMoya

Network abstraction layer written in Swift.

Stars15,351
Forks1,993
Last commit3 months ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub