Merge branch 'feature/uialert-action' of git://github.com/AndrewSB/RxSwift into AndrewSB-feature/uialert-action
This commit is contained in:
commit
a5f1d1eef7
|
|
@ -7,6 +7,8 @@
|
|||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
46307D4E1CDE77D800E47A1C /* UIAlertAction+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46307D4D1CDE77D800E47A1C /* UIAlertAction+Rx.swift */; };
|
||||
46307D4F1CDE77D800E47A1C /* UIAlertAction+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 46307D4D1CDE77D800E47A1C /* UIAlertAction+Rx.swift */; };
|
||||
54700CA01CE37E1800EF3A8F /* UINavigationItem+RxTests.swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54700C9E1CE37D1000EF3A8F /* UINavigationItem+RxTests.swift.swift */; };
|
||||
54700CA11CE37E1900EF3A8F /* UINavigationItem+RxTests.swift.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54700C9E1CE37D1000EF3A8F /* UINavigationItem+RxTests.swift.swift */; };
|
||||
54D2138E1CE0824E0028D5B4 /* UINavigationItem+Rx.swift in Sources */ = {isa = PBXBuildFile; fileRef = 54D2138C1CE081890028D5B4 /* UINavigationItem+Rx.swift */; };
|
||||
|
|
@ -1363,6 +1365,7 @@
|
|||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
46307D4D1CDE77D800E47A1C /* UIAlertAction+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIAlertAction+Rx.swift"; sourceTree = "<group>"; };
|
||||
54700C9E1CE37D1000EF3A8F /* UINavigationItem+RxTests.swift.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationItem+RxTests.swift.swift"; sourceTree = "<group>"; };
|
||||
54D2138C1CE081890028D5B4 /* UINavigationItem+Rx.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UINavigationItem+Rx.swift"; sourceTree = "<group>"; };
|
||||
79E9DE881C3417FD009970AF /* DispatchQueueSchedulerQOS.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DispatchQueueSchedulerQOS.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -2424,6 +2427,7 @@
|
|||
84E4D3901C9AFCD500ADFDC9 /* UISearchController+Rx.swift */,
|
||||
54D2138C1CE081890028D5B4 /* UINavigationItem+Rx.swift */,
|
||||
844BC8B31CE4FD7500F5C7CB /* UIPickerView+Rx.swift */,
|
||||
46307D4D1CDE77D800E47A1C /* UIAlertAction+Rx.swift */,
|
||||
);
|
||||
path = iOS;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -3333,6 +3337,7 @@
|
|||
C8C4B4A91C17722400828BD5 /* _RXObjCRuntime.m in Sources */,
|
||||
C8093EEF1B8A732E0088E94D /* KVOObserver.swift in Sources */,
|
||||
C882541F1B8A752B00B02D69 /* RxCollectionViewDelegateProxy.swift in Sources */,
|
||||
46307D4E1CDE77D800E47A1C /* UIAlertAction+Rx.swift in Sources */,
|
||||
C88254201B8A752B00B02D69 /* RxScrollViewDelegateProxy.swift in Sources */,
|
||||
C88F76811CE5341700D5A014 /* RxTextInput.swift in Sources */,
|
||||
C882542E1B8A752B00B02D69 /* UILabel+Rx.swift in Sources */,
|
||||
|
|
@ -4367,6 +4372,7 @@
|
|||
C8BCD3EF1C14B5FB005F1280 /* UIView+Rx.swift in Sources */,
|
||||
D2138C921BB9BED600339B5C /* KVOObserver.swift in Sources */,
|
||||
D2138C831BB9BEBE00339B5C /* _RXKVOObserver.m in Sources */,
|
||||
46307D4F1CDE77D800E47A1C /* UIAlertAction+Rx.swift in Sources */,
|
||||
C80DDEB31BCE8CA3006A1832 /* Driver+Operators+arity.swift in Sources */,
|
||||
C8DB968F1BF7595D0084BD53 /* KVORepresentable+Swift.swift in Sources */,
|
||||
D203C5061BB9C53E00D02D00 /* UIControl+Rx.swift in Sources */,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
//
|
||||
// UIAlertAction+Rx.swift
|
||||
// Rx
|
||||
//
|
||||
// Created by Andrew Breckenridge on 5/7/16.
|
||||
// Copyright © 2016 Krunoslav Zaher. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
#if os(iOS) || os(tvOS)
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
#if !RX_NO_MODULE
|
||||
import RxSwift
|
||||
#endif
|
||||
|
||||
extension UIAlertAction {
|
||||
|
||||
/**
|
||||
Bindable sink for `enabled` property.
|
||||
*/
|
||||
public var rx_enabled: AnyObserver<Bool> {
|
||||
return UIBindingObserver(UIElement: self) { alertAction, value in
|
||||
alertAction.enabled = value
|
||||
}.asObserver()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -144,6 +144,22 @@ extension ControlTests {
|
|||
}
|
||||
}
|
||||
|
||||
// UIAlertAction
|
||||
extension ControlTests {
|
||||
func testAlertAction_Enable() {
|
||||
let subject = UIAlertAction()
|
||||
Observable.just(false).subscribe(subject.rx_enabled).dispose()
|
||||
|
||||
XCTAssertTrue(subject.enabled == false)
|
||||
}
|
||||
|
||||
func testAlertAction_Disable() {
|
||||
let subject = UIAlertAction()
|
||||
Observable.just(true).subscribe(subject.rx_enabled).dispose()
|
||||
|
||||
XCTAssertTrue(subject.enabled == true)
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue