UpperNotificationController 0.1.2

UpperNotificationController 0.1.2

测试已测试
Lang语言 SwiftSwift
许可协议 MIT
Released上次发布2016年7月
SPM支持 SPM

muukiimuukii 维护。



UpperNotificationController

用法

1. 定义 UpperNotificationViewType 的 UIView

public protocol UpperNotificationViewType: class {

    /**
     - parameter manualDismissClosure: Call this closure to dismiss the notification view
     */
    func didPrepare(dismissClosure: () -> Void)

    func willAppear()
    func didAppear()

    func willDisappear()
    func didDisappear()
}

class MyNotification: UpperNotificationViewType { … }

2. 定义 UpperNotificationAnimatorType 的类或结构体

public protocol UpperNotificationAnimatorType {

    func applyPresentAnimation<T where T: UpperNotificationViewType, T: UIView>(notificationView notificationView: T, completion: () -> Void)

    func applyDismissAnimation<T where T: UpperNotificationViewType, T: UIView>(notificationView notificationView: T, completion: () -> Void)
}

struct MyAnimator: UpperNotificationViewType { ... }

3. 创建 UpperNotificationController

let notificationController = UpperNotificationController()

4. 发送通知

let notification = NotificationContext<SampleNotificationView> {
    SampleNotificationView()
}

notificationController.deliver(notification: notification, animator: Animator())

需求

iOS 8.0+

作者

muukii,[email protected]

许可协议

UpperNotificationController 可在 MIT 许可协议下使用。有关更多信息,请参阅 LICENSE 文件。