/Notify

A lightweight iOS notification banner

Primary LanguageSwiftMIT LicenseMIT

Notify

Carthage compatible CI Status

Notify allows you to present notifications to your users with a simple interface.

Hello

Notify(title: "Hello world!").present()

Customization

init(title: String, backgroundColor: UIColor = .orangeColor(), titleColor: UIColor = Notify.currentStatusBarTextColor, font: UIFont = .boldSystemFontOfSize(12))
func present(dismiss dismiss: Dismissal = .After(2.0), completion: (() -> Void)? = nil)
enum Dismissal {
  case After(NSTimeInterval)
  case OnTap
}

Recommended Extension

In order to match the current status bar Notify calls preferredStatusBarStyle() & preferredStatusBarHidden() on the keyWindow of your apps rootViewController.

If your application's rootViewController is typically a UINavigationController or subclass thereof, then without this extension it will be the one to decide the visuals of your status bar.

extension UINavigationController {
  public override func preferredStatusBarStyle() -> UIStatusBarStyle {
    return topViewController?.preferredStatusBarStyle() ?? .Default
  }

  public override func prefersStatusBarHidden() -> Bool {
    return topViewController?.prefersStatusBarHidden() ?? false
  }
}