Swiftpack.co - Package - Valerio69/SwiftConnectivityStatusBar

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()
    }
}

Github

link
Stars: 1

Used By

Total: 0