NavigationNotice
Customizable and interactive animated notification UI control.
Easy to write at chainable syntax.
Appetize's Demo
Requirements
- Swift 5.0
- iOS 7.0 or later
How to Install NavigationNotice
iOS 8+
CocoaPods
Add the following to your Podfile
:
pod "NavigationNotice"
use_frameworks!
Carthage
Add the following to your Cartfile
:
github "KyoheiG3/NavigationNotice"
iOS 7
Just add everything in the NavigationNotice.swift
file to your project.
Usage
import
If target is ios8.0 or later, please import the NavigationNotice
.
import NavigationNotice
Example
Show simply notification.
let noticeView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 64))
NavigationNotice.addContent(noticeView).showOn(self.view).hide(2)
- Automatically set
width
. height
of notification is same asheight
of the content.- Hide at 2 sec from displayed in this example.
Set status bar hidden and animated block.
let noticeView = UIView(frame: CGRect(x: 0, y: 0, width: 0, height: 64))
NavigationNotice.addContent(noticeView).showOn(self.view).showAnimations { animations, completion in
UIView.animateWithDuration(0.6, delay: 0, usingSpringWithDamping: 0.8, initialSpringVelocity: 0.1, options: .BeginFromCurrentState, animations: animations, completion: completion)
} .hideAnimations { animations, completion in
UIView.animateWithDuration(0.8, animations: animations, completion: completion)
}
- Not hidden status bar.
- Custome show and hide animation.
Variable
class var defaultShowAnimations: ((() -> Void, (Bool) -> Void) -> Void)?
- Common animated block of show.
- Default is
nil
.
class var defaultHideAnimations: ((() -> Void, (Bool) -> Void) -> Void)?
- Common animated block of hide.
- Default is
nil
.
Function
class func currentNotice() -> NavigationNotice.NavigationNotice?
- Return
NavigationNotice
optional instance that is currently displayed.
class func addContent(view: UIView) -> NavigationNotice.NavigationNotice
- Add content to display.
- Return
NavigationNotice
instance.
class func onStatusBar(on: Bool) -> NavigationNotice
- Set on the status bar of notification.
- Return
NavigationNotice
instance.
func completion(completion: (() -> Void)?)
- Completion handler.
func addContent(view: UIView) -> Self
- Add content to display.
- Return
Self
instance.
func showOn(view: UIView) -> Self
- Show notification on view.
- Return
Self
instance.
func showAnimations(animations: (() -> Void, (Bool) -> Void) -> Void) -> Self
- Animated block of show.
- Return
Self
instance.
func hideAnimations(animations: (() -> Void, (Bool) -> Void) -> Void) -> Self
- Animated block of hide.
- Return
Self
instance.
func hide(interval: NSTimeInterval) -> Self
- Hide notification.
- Return
Self
instance.
func removeAll(hidden: Bool) -> Self
- Remove all notification.
- Return
Self
instance.
LICENSE
Under the MIT license. See LICENSE file for details.