KUIPopupController 1.0.0

KUIPopupController 1.0.0

测试已测试
语言语言 SwiftSwift
许可 MIT
发布上次发布2017年9月
SwiftSwift 版本4.0
SPM支持 SPM

Kofktu 维护。



  • Kofktu



  • 简单的 iOS Popup ContentView

alt tag

要求

  • iOS 8.0+
  • Swift 4.0
  • Swift 3.0 (0.0.1)

用法

KUIPopupContentViewProtocol

public protocol KUIPopupContentViewProtocol {
    var modalBackgroundColor: UIColor? { get } // default UIColor.black(alpha 0.6)
    var animator: KUIPopupContentViewAnimator? { get }
}

public extension KUIPopupContentViewProtocol where Self: UIView {
    public func show(_ parentViewController: UIViewController? = nil) 
    public func dismiss(_ animated: Bool) 
}

KUIPopupContentViewAnimator

public protocol KUIPopupContentViewAnimator {
    func animate(_ parameter: KUIPopupContentViewAnimatorStateParameter, completion: @escaping (Bool) -> Void)
}

KUIPopupContentViewAnimatorStateParameter

属性 类型 描述
isShow Bool 如果值为 true,显示状态
contentView UIView 自定义视图
containerView UIView 弹出容器视图
containerViewCenterX NSLayoutConstraint 容器视图居中约束
containerViewCenterY NSLayoutConstraint container view centerY constraint

概述

import KUIPopupController

class ContentView: UIView, KUIPopupContentViewProtocol {
    var animator: KUIPopupContentViewAnimator?
}

...

func showContentView {
  let view = ContentView()
  view.animator = KUIPopupContentViewAnimator
  view.show()
}

作者

Taeun Kim (kofktu), [email protected]

许可

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