No description, website, or topics provided.
Swift Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
AZReachability.xcodeproj
AZReachability.xcworkspace
AZReachability
AZReachabilityNotificatons
Pods
Source
.gitignore
AZReachabilityNotificatons.podspec
LICENSE
Podfile
Podfile.lock
README.md

README.md

AZReachability Notifications

Alt text

Swift version Support Dependecy Manager Version License Platform

Features

  • Simple, one method integration
  • Reachability notification on status bar and under navigation bar

Installation

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate AZReachability Notifications into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
pod 'AZReachabilityNotificatons'
end

Then, run the following command:

$ pod install

Usage

Step 1

Import AZReachabilityNotificatons module in AppDelegate.swift and just call startNetworkReachabilityObserver

import UIKit
import AZReachabilityNotificatons

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    
    let reachAbilityManager = ReachabilityManager.manager
    
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        
        reachAbilityManager.startNetworkReachabilityObserver(notificationType: .OnStatusBar) //enum to detrmin notification type
        
        return true
    }

    func applicationWillTerminate(_ application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
        reachAbilityManager.stopNetworkReachability()
    }
}

Customization

  • To show notification on status bar
    reachAbilityManager.startNetworkReachabilityObserver(notificationType: .OnStatusBar) 

And for under Navigation bar

    reachAbilityManager.startNetworkReachabilityObserver(notificationType: .UnderNavigation)
  • To have custom Strings in notification and change notification background color use this
    reachAbilityManager.internetAvailableBackgroundColor = UIColor.green // internet connectd 
    reachAbilityManager.internetNotAvailableBackgroundColor = UIColor.red // internet is not connected 


    reachAbilityManager.internetAvailableText = "Internet Connected" // internet is not connected
    reachAbilityManager.internetNotAvailableText = "No Internet Connection" // internet is not connected

Done

Thats it, you successfully integrate AZReachabilityNotificatons

Dependencies

  • Alamofire
  • CWStatusBarNotification
  • Whisper

License

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

Author

Afroz Zaheer - (https://github.com/AfrozZaheer)