Main Title
Welcome to the documentation page for RealReachability, a library that allows developers to easily determine the reachability status of a device in iOS applications. Whether you need to check if the device is connected to a Wi-Fi network, cellular data, or not connected at all, RealReachability provides a simple solution. This documentation will guide you through the installation process, usage instructions, and showcase the available features of RealReachability.
Table of Contents
Installation
- Open your Xcode project and navigate to the target’s settings.
- Select the “General” tab and scroll down to “Linked Frameworks and Libraries”.
- Click on the “+” button to add a new framework.
- Select “Add Other…” and navigate to the downloaded RealReachability library.
- Click “Open” to add the library to your Xcode project.
- In your Xcode project, navigate to the file where you want to use RealReachability.
- Import the RealReachability library:
- You’re now ready to start using RealReachability!
import RealReachability
Usage
- Initialize a RealReachability object:
- Determine the reachability status:
- Observe reachability changes:
let reachability = RealReachability.sharedInstance()
if reachability.isReachable() {
print("Device is reachable.")
} else {
print("Device is not reachable.")
}
reachability.startNotifier()
NotificationCenter.default.addObserver(self, selector: #selector(reachabilityChanged), name: .realReachabilityChanged, object: nil)
@objc private func reachabilityChanged(notification: Notification) {
let status = reachability.currentReachabilityStatus().description
print("Reachability status changed: \(status)")
}
Features
- Determine Reachability Status: Check if the device is reachable or not.
- Monitor Reachability Changes: Observe and respond to changes in the device’s reachability status.
- Specific Reachability Types: Determine the type of reachability (e.g., Wi-Fi, cellular data).
- Handle Network Changes: Detect network changes and respond accordingly.
Conclusion
This concludes the documentation for RealReachability. You should now have a good understanding of the installation process, how to use RealReachability in your iOS applications, and the features it provides. If you encounter any issues or have further questions, please refer to the official documentation or reach out to our support team.