StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again

Overview

StatusBarOverlay

StatusBarOverlay Language: Swift 4.0

alt demo

StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It supports apps which hide the status bar and The Notch

Features

  • Just a few lines of code and StatusBarOverlay will automatically show & hide when internet connection is lost & regained
  • Support for apps that hide the status bar permanently
  • Support for the iPhone X Notch
  • Optionally you can choose to show the status bar anytime with custom text, eg for Debug or Demo modes
  • Optionally you can show a drop down message, below the status bar, with a click handle, great for nonintrusive alerts
  • Fully customisable colors & text

How to install

Add this to your CocoaPods Podfile

pod 'StatusBarOverlay'

How to use

In your Info.plist file set UIViewControllerBasedStatusBarAppearance = true

In your AppDelegate.didFinishLaunchingWithOptions() method set StatusBarOverlay.host to your server domain. StatusBarOverlay will use this to check connectivity

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

  StatusBarOverlay.host = "example.com"
        
  return true
}

If you use a common UIViewController subclass, add the following to it. All of view controllers show override these methods, so its best to use a common UIViewController subclass

import StatusBarOverlay // if StatusBarOverlay is in CocoaPod

extension CommonViewController {

  override var preferredStatusBarStyle: UIStatusBarStyle {
    return StatusBarOverlay.preferredStatusBarStyle
  }

  override var prefersStatusBarHidden: Bool {
    return StatusBarOverlay.prefersStatusBarHidden
  }

  override var preferredStatusBarUpdateAnimation: UIStatusBarAnimation {
    return StatusBarOverlay.preferredStatusBarUpdateAnimation
  }
}

Thats it. Run your app, try turning on and off airplane mode and the No Internet Connection bar will show and hide. On the simulator sometimes the hiding event isnt fired. All devices work normally

Dependencies

  • Reachability is required for the connectivity events

Get these while stocks last :)

A Codable extension to decode arrays and to catch & log all decoding failures https://github.com/IdleHandsApps/SafeDecoder

An elegant solution for keeping views visible when the keyboard is being shown https://github.com/IdleHandsApps/IHKeyboardAvoiding

Button styles that are centralied and reusable, and hooked up to InterfaceBuilder https://github.com/IdleHandsApps/DesignableButton

Author

It'd be great to hear about any cool apps that are using StatusBarOverlay

License

Distributed under the MIT License

You might also like...
A simple and awesome loading Activity Indicator(with block moving animation) for your iOS app.
A simple and awesome loading Activity Indicator(with block moving animation) for your iOS app.

BPBlockActivityIndicator BPBlockActivityIndicator is a clean and easy-to-use Activity Indicator meant to display the progress of an ongoing task on iO

A beautiful activity indicator and modal alert written in Swift (originally developed for my app DoodleDoodle) Using blur effects, translucency, flat and bold design - all iOS 8 latest and greatest
A beautiful activity indicator and modal alert written in Swift (originally developed for my app DoodleDoodle) Using blur effects, translucency, flat and bold design - all iOS 8 latest and greatest

SwiftSpinner SwiftSpinner is an extra beautiful activity indicator with plain and bold style. It uses dynamic blur and translucency to overlay the cur

Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.
Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView.

StepProgressView Step-by-step progress view with labels and shapes. A good replacement for UIActivityIndicatorView and UIProgressView. Usage let progr

A view class for iOS that makes uploading easy and beautiful.
A view class for iOS that makes uploading easy and beautiful.

SVUploader A view class for iOS that makes uploading easy and beautiful. Demo SVUploader is fully customizable - check out 2 demos. Installation Just

A clean and lightweight progress HUD based on SVProgressHUD, converted to Swift with the help of Swiftify.

IHProgressHUD IHProgressHUD is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS and tvOS. IHProgressHUD is based on

StatusBarOverlay will automatically show a
StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again

StatusBarOverlay will automatically show a "No Internet Connection" bar when your app loses connection, and hide it again. It supports apps which hide the status bar and The Notch

Easily hide and show a view controller's navigation bar (and tab bar) as a user scrolls
Easily hide and show a view controller's navigation bar (and tab bar) as a user scrolls

HidingNavigationBar An easy to use library (written in Swift) that manages hiding and showing a navigation bar as a user scrolls. Features Usage Custo

A simple class to check for internet connection availability in Swift.

Reach A simple class to check for internet connection availability in Swift. Works for both 3G and WiFi connections. Install Manually Add the Reach.sw

iOS UI library to show and hide an extension to your UINavigationBar
iOS UI library to show and hide an extension to your UINavigationBar

ADNavigationBarExtension is a UI library written in Swift. It allows you to show and hide an extension to your UINavigationBar Features Use Extensible

Dynamically hide / show cells of static UITableViewController

Dynamically hide / show cells of static UITableViewController, Swift Port of StaticDataTableViewController. Installation CocoaPods pod 'StaticTableVie

A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag
A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed flag

HidesNavigationBarWhenPushed A library, which adds the ability to hide navigation bar when view controller is pushed via hidesNavigationBarWhenPushed

iCloud Drive is Apple's essential connection between all your devices, Mac, iPhone, iPad, even your Windows PC.
iCloud Drive is Apple's essential connection between all your devices, Mac, iPhone, iPad, even your Windows PC.

iCloud Drive is Apple's essential connection between all your devices, Mac, iPhone, iPad, even your Windows PC.While the cost of storage seems expensive in comparison to other online storage services, its advantage is that it works natively across all your devices.

Log every incoming notification to view them again later, also includes attachments and advanced settings to configure

Vē Natively integrated notification logger Installation Add this repository to your package manager

🗂 Never use NSSearchPathForDirectoriesInDomains again
🗂 Never use NSSearchPathForDirectoriesInDomains again

AppFolder AppFolder is a lightweight framework that lets you design a friendly, strongly-typed representation of a directories inside your app's conta

Reliable Server Side Swift ✭ Make Apache great again!
Reliable Server Side Swift ✭ Make Apache great again!

mod_swift mod_swift is a technology demo which shows how to write native modules for the Apache Web Server in the Swift 3 programming language. The de

Count It, Never lose the count again
Count It, Never lose the count again

Count It Never lose the count again. Dead simple App with Apple Watch integration that lets you count anything. Laps while exercising. How many beers

compiler-driven, structured, type-safe source generation. never use gyb again!

factory 2022-09-10-a factory is a structured, type-safe source generation tool. It is intended to be a replacement for (and improvement over) the gyb

macOS status bar app to automatically fetch Git repositories.

Fetcher About macOS status bar app to automatically fetch Git repositories. License Project is released under the terms of the MIT License. Repository

Comments
  • Not detecting offline when airplane mode on before launching

    Not detecting offline when airplane mode on before launching

    Steps to reproduce

    1. Make sure the app process is stopped (force close if needed).
    2. Turn airplane mode on.
    3. Launch the app.
    4. Expect to see status "No internet connection", but nothing happens.
    5. Turn airplane mode off, then back on (while app's still running).
    6. Now status is visible.
    opened by avi-midtown 2
  • Layout constraints are broken in landscape mode.

    Layout constraints are broken in landscape mode.

    In landscape mode, you'll get warnings of the layout constraints. When I just remove StatusBarOverlay from my sample project, I didn't get the warnings. The status bar is hidden.

    iOS: 12.0.1 device: iPhone XS max

    `2018-10-24 10:54:48.322549+0900 testapp[5938:1838560] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x283dc85a0 UIButton:0x10be02960.width == 44 (active)>", "<NSLayoutConstraint:0x283dc97c0 H:|-(0)-[UIButton:0x10be02960] (active, names: '|':UIView:0x10be067d0 )>", "<NSLayoutConstraint:0x283dc9900 H:[UIButton:0x10be03150]-(0)-| (active, names: '|':UIView:0x10be067d0 )>", "<NSLayoutConstraint:0x283dc9950 H:[UIButton:0x10be02960]-(0)-[UIButton:0x10be03150] (active)>", "<NSLayoutConstraint:0x283dc9d60 H:[UIView:0x10be067d0]-(0)-| (active, names: '|':UIView:0x10be065f0 )>", "<NSLayoutConstraint:0x283dc9db0 H:|-(0)-[UIView:0x10be067d0] (active, names: '|':UIView:0x10be065f0 )>", "<NSLayoutConstraint:0x283de4410 'UIView-Encapsulated-Layout-Width' UIView:0x10be065f0.width == 0 (active)>" )

    Will attempt to recover by breaking constraint <NSLayoutConstraint:0x283dc85a0 UIButton:0x10be02960.width == 44 (active)>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. 2018-10-24 10:54:48.323375+0900 testapp[5938:1838560] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x283dc8550 UIButton:0x10be02960.width == UIButton:0x10be02960.height (active)>", "<NSLayoutConstraint:0x283dc96d0 UIView:0x10be067d0.height == 44 (active)>", "<NSLayoutConstraint:0x283dc9720 V:[UIButton:0x10be02960]-(0)-| (active, names: '|':UIView:0x10be067d0 )>", "<NSLayoutConstraint:0x283dc9770 V:|-(0)-[UIButton:0x10be02960] (active, names: '|':UIView:0x10be067d0 )>", "<NSLayoutConstraint:0x283dc97c0 H:|-(0)-[UIButton:0x10be02960] (active, names: '|':UIView:0x10be067d0 )>", "<NSLayoutConstraint:0x283dc9900 H:[UIButton:0x10be03150]-(0)-| (active, names: '|':UIView:0x10be067d0 )>", "<NSLayoutConstraint:0x283dc9950 H:[UIButton:0x10be02960]-(0)-[UIButton:0x10be03150] (active)>", "<NSLayoutConstraint:0x283dc9d60 H:[UIView:0x10be067d0]-(0)-| (active, names: '|':UIView:0x10be065f0 )>", "<NSLayoutConstraint:0x283dc9db0 H:|-(0)-[UIView:0x10be067d0] (active, names: '|':UIView:0x10be065f0 )>", "<NSLayoutConstraint:0x283de4410 'UIView-Encapsulated-Layout-Width' UIView:0x10be065f0.width == 0 (active)>" )

    Will attempt to recover by breaking constraint <NSLayoutConstraint:0x283dc8550 UIButton:0x10be02960.width == UIButton:0x10be02960.height (active)>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. 2018-10-24 10:54:48.326489+0900 testapp[5938:1838560] [LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x283dc9810 H:|-(44)-[UILabel:0x10be03660'Additional Message'] (active, names: '|':UIView:0x10be067d0 )>", "<NSLayoutConstraint:0x283dc9860 H:[UILabel:0x10be03660'Additional Message']-(44)-| (active, names: '|':UIView:0x10be067d0 )>", "<NSLayoutConstraint:0x283dc9d60 H:[UIView:0x10be067d0]-(0)-| (active, names: '|':UIView:0x10be065f0 )>", "<NSLayoutConstraint:0x283dc9db0 H:|-(0)-[UIView:0x10be067d0] (active, names: '|':UIView:0x10be065f0 )>", "<NSLayoutConstraint:0x283de4410 'UIView-Encapsulated-Layout-Width' UIView:0x10be065f0.width == 0 (active)>" )

    Will attempt to recover by breaking constraint <NSLayoutConstraint:0x283dc9860 H:[UILabel:0x10be03660'Additional Message']-(44)-| (active, names: '|':UIView:0x10be067d0 )>

    Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger. The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKitCore/UIView.h> may also be helpful. (lldb) `

    opened by mota-raven 1
  • Cocoapods not updated, latest version 2.2

    Cocoapods not updated, latest version 2.2

    The latest version on Cocoapods is 2.2, as can be seen here. But the latest version currently in the repo is 3.1.

    Could the latest version be pushed to Cocoapods please?

    opened by Zandor300 0
  • Wrong isReachable value

    Wrong isReachable value

    StatusBarOverlay.isReachable returns true when it is not reachable (view is showing correctly).

    (lldb) po StatusBarOverlay.isReachable
    true
    
    (lldb) po self.shared.reachability?.connection
    ▿ Optional<Connection>
      - some : No Connection
    
    opened by andrey-lisovskiy 0
Releases(3.1.0)
Owner
Idle Hands Apps
c/- Fraser Scott-Morrison
Idle Hands Apps
Material Linear Progress Bar for your iOS apps

LinearProgressBar Material Linear Progress Bar for your iOS apps Installation Carthage: github "Recouse/LinearProgressBar" CocoaPods: Add this to you

Firdavs Khaydarov 161 Dec 5, 2022
☠️ An elegant way to show users that something is happening and also prepare them to which contents they are awaiting

Features • Guides • Installation • Usage • Miscellaneous • Contributing ?? README is available in other languages: ???? . ???? . ???? . ???? . ???? To

Juanpe Catalán 11.7k Jan 8, 2023
UIProgressView replacement with an highly and fully customizable animated progress bar in pure Core Graphics

The YLProgressBar is an UIProgressView replacement with a highly and fully customizable animated progress bar in pure Core Graphics. It has been imple

Yannick Loriot 1.3k Jan 5, 2023
Simple and powerful animated progress bar with dots

Example To run the example project, clone the repo, and run pod install from the Example directory first. Requirements iOS 8.0+ Swift 3.0+ Installatio

Nikola Corlija 42 Dec 5, 2022
Flexible Stepped Progress Bar for IOS

FlexibleSteppedProgressBar This is a stepped progress bar for IOS. The base code is derived from ABSteppedProgressBar. Most of the design is customisa

Amrata Baghel 549 Jan 6, 2023
⌛️A customizable animated gradient loading bar.

GradientLoadingBar A customizable animated gradient loading bar. Inspired by iOS 7 Progress Bar from Codepen. Example To run the example project, clon

Felix M. 791 Dec 26, 2022
A simple animated progress bar in Swift

DSGradientProgressView Introduction DSGradientProgressView is a simple and customizable animated progress bar written in Swift. Inspired by GradientPr

Dhol Studio 445 Oct 13, 2022
📊 A customizable gradient progress bar (UIProgressView).

GradientProgressBar A customizable gradient progress bar (UIProgressView). Inspired by iOS 7 Progress Bar from Codepen. Example To run the example pro

Felix M. 490 Dec 16, 2022
💈 Retro looking progress bar straight from the 90s

Description Do you miss the 90s? We know you do. Dial-up internet, flickering screens, brightly colored websites and, of course, this annoyingly slow

HyperRedink 18 Nov 24, 2022
A lightweight and awesome loading Activity Indicator for your iOS app.

BPCircleActivityIndicator BPCircleActivityIndicator is a clean and easy-to-use Activity Indicator meant to display the progress of an ongoing task on

Ben.Park 46 Aug 12, 2022