A simple UIView that will appear on top of your Screen when the there is no Internet Connection.
dependencies: [
.package(url: "https://github.com/Valerio69/SwiftConnectivityStatusBar.git", .upToNextMajor(from: "1.0.2"))
]
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()
}
}