Skip to content

❌📱 A little swift Internet error status indicator using ReachabilitySwift

License

Notifications You must be signed in to change notification settings

ezefranca/EFInternetIndicator

Repository files navigation

EFInternetIndicator

CI Status Version License Platform

Requirements

  • Xcode 8.0+
  • iOS 8.3+

WARNING : It's not work on simulator. #1

Installation

CocoaPods

You can use CocoaPods to install EFInternetIndicator by adding it to your Podfile:

use_frameworks!
pod 'EFInternetIndicator'

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Usage example

To start monitoring internet status in a single UIViewController you just need add the InternetStatusIndicable protocol and start monitoring with startMonitoringInternet()

import UIKit
import EFInternetIndicator

class ViewController: UIViewController, InternetStatusIndicable {
    
    var internetConnectionIndicator:InternetViewIndicator?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.startMonitoringInternet()
    }
}

Also, you can customize indicator using custom parameters:

func startMonitoringInternet(backgroundColor:UIColor, style: MessageView.Layout, textColor:UIColor, message:String, remoteHostName: String)

If you want all yours UIViewControllers monitoring internet you can create a abstract class like:

import UIKit
import EFInternetIndicator

class EFViewController: UIViewController, InternetStatusIndicable {
    
    var internetConnectionIndicator:InternetViewIndicator?
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.startMonitoringInternet()
    }
}

class SecondViewController: EFViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }   
}

// Override properties when you want 
class MagicViewController: EFViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        self.startMonitoringInternet(backgroundColor:UIColor.blue, style: .StatusLine, textColor:UIColor.white, message:"No magic on internet here :(", remoteHostName: "magic.com")
    }   
}

Author

ezefranca, ezequiel.ifsp@gmail.com

Acknowledgments

License

EFInternetIndicator is available under the MIT license. See the LICENSE file for more info.

About

❌📱 A little swift Internet error status indicator using ReachabilitySwift

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published