KRAlertController 3.1.0

KRAlertController 3.1.0

测试已测试
语言语言 SwiftSwift
许可证 MIT
发布最后发布2018年9月
SPM支持 SPM

Krimpedance 维护。



  • 作者
  • krimpedance

日语

KRAlertController

Version License Platform Download Carthage compatible CI Status

KRAlertController 是由 Swift 编写的一个美观且易于使用的 iOS 弹出控制器。

要求

  • iOS 10.0+
  • Xcode 10.0+
  • Swift 4.2+

演示

要运行示例项目,请克隆仓库,并从 DEMO 目录中打开 KRAlertControllerDemo.xcodeproj

或在 appetize.io

安装

KRAlertController 通过 CocoaPodsCarthage 提供。要安装它,只需将以下行添加到您的 Podfile 或 Cartfile

# Podfile
pod "KRAlertController"
# Cartfile
github "Krimpedance/KRAlertController"

使用

(请参考/Demo目录下的样本Xcode项目)

主要与UIAlertController相同。

首先,在您的swift文件中导入

显示简单的警告。

KRAlertController(title: "Title", message: "message")
  .addCancel()
  .addAction("OK") { action, textFields in
    print("OK")
  }
  .show()

初始化器

init(title: String?, message: String?, style: KRAlertControllerStyle = .Alert)

警告类型

共有7种警告。icon参数传入true以显示图形图标;否则,传入false。默认的视图控制器为显示警告的关键窗口的可视视图控制器。

func show(presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showSuccess(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showInformation(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showWarning(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showError(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showEdit(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
func showAuthorize(icon icon: Bool, presentingVC: UIViewController? = nil, animated: Bool = true, completion: (() -> ())? = nil)
// Example
alert.showSuccess(true)
alert.showWarning(true, presentingVC: self, animated: false) {
  print("Showed warning alert!")
}

为该项目做出贡献

我正在寻找错误报告和特性请求。

发布说明

  • 3.1.0

    • 兼容Swift 4.2。
  • 3.0.1

    • 兼容Swift 4.1。
  • 3.0.0

    • 支持Xcode9和Swift4。

许可协议

KRAlertController遵循MIT许可协议。有关更多信息,请参阅LICENSE文件。