Skip to content

vetrek/SwiftConnectivityStatusBar

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftConnectivityStatusBar

A simple UIView that will appear on top of your Screen when the there is no Internet Connection.

Installation

Usage

Swift Package Manager

dependencies: [
    .package(url: "https://github.com/Valerio69/SwiftConnectivityStatusBar.git", .upToNextMajor(from: "1.0.2"))
]

Example

Within the SceneDelegate class you can start the monitor when the app is in Foreground and stop it when in Background.

import SwiftConnectivityStatusBar

class SceneDelegate: UIResponder, UIWindowSceneDelegate {
    func sceneWillEnterForeground(_ scene: UIScene) {
        SCStatusBar.shared.startMonitor()
        // OR using a custom style
        SCStatusBar.shared.style = SCStatusBarStyle(statusString: "Custom String",
                                                    backgroundColor: UIColor.green.withAlphaComponent(0.5))
        SCStatusBar.shared.startMonitor()
    }

    func sceneDidEnterBackground(_ scene: UIScene) {
        SCStatusBar.shared.stopMonitor()
    }
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages