Notify allows you to present notifications to your users with a simple interface.
Notify(title: "Hello world!").present()
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
}
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
}
}