Git Product home page Git Product logo

statusbaroverlay's Introduction

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

  • Alamofire is required for the connectivity events

Get these while stocks last :)

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

An extension to easily set your UINavigationBar transparent and hide the shadow https://github.com/IdleHandsApps/UINavigationBar-Transparent

Author

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

License

Distributed under the MIT License

statusbaroverlay's People

Contributors

bronenos avatar fraserscottmorrison avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.