RxUIAlertController 1.1.0

RxUIAlertController 1.1.0

测试已测试
语言语言 SwiftSwift
许可协议 MIT
发布日期最后发布2017年1月
SwiftSwift版本3.0
SPM支持SPM

roshanman 维护。



 
依赖项
RxSwift>= 0
RxCocoa>= 0
 

  • roshanman

RxUIAlertController

RxUIAlertController 是一个包装库,用于与 RxSwift 和 UIAlertController 一起工作。

安装

RxUIAlertController 通过 CocoaPods 可用。

pod 'RxUIAlertController'

示例代码

Alert(title: "Test", message: "This is a test message.")
    .addAction(title: "Yes")
    .addAction(title: "No", style: .destructive)
    .addTextField{
        $0.placeholder = "placeholder"
    }
    .rx.show()
    .subscribe(onNext: {
        print("button: \($0.buttonTitle)")
        print($0.controller.textFields?.first?.text ?? "")
    })
    .addDisposableTo(disposeBag)

ActionSheet(title: "Test", message: "This is a test message.")
    .addAction(title: "Yes")
    .addAction(title: "No", style: .destructive)
    .addAction(title: "Cancel", style: .cancel)
    .setPresenting(source: sender)
    .rx.show()
    .subscribe(onNext: {
        print("button: \($0.buttonTitle)")
    })
    .addDisposableTo(disposeBag)

示例

要运行示例项目,请首先克隆存储库,然后在 Example 目录中运行 pod install

许可协议

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