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 NavigationNoticeExample
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. heightof notification is same asheightof 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
NavigationNoticeoptional instance that is currently displayed.
class func addContent(view: UIView) -> NavigationNotice.NavigationNotice- Add content to display.
- Return
NavigationNoticeinstance.
class func onStatusBar(on: Bool) -> NavigationNotice- Set on the status bar of notification.
- Return
NavigationNoticeinstance.
func completion(completion: (() -> Void)?)- Completion handler.
func addContent(view: UIView) -> Self- Add content to display.
- Return
Selfinstance.
func showOn(view: UIView) -> Self- Show notification on view.
- Return
Selfinstance.
func showAnimations(animations: (() -> Void, (Bool) -> Void) -> Void) -> Self- Animated block of show.
- Return
Selfinstance.
func hideAnimations(animations: (() -> Void, (Bool) -> Void) -> Void) -> Self- Animated block of hide.
- Return
Selfinstance.
func hide(interval: NSTimeInterval) -> Self- Hide notification.
- Return
Selfinstance.
func removeAll(hidden: Bool) -> Self- Remove all notification.
- Return
Selfinstance.
LICENSE
Under the MIT license. See LICENSE file for details.
