Skip to content

Commit fdd5e7d

Browse files
committed
Updates from PR comments.
1 parent 360cd87 commit fdd5e7d

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

Action.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Pod::Spec.new do |s|
2121
s.source_files = "*.{swift}"
2222

2323
s.frameworks = "Foundation"
24-
s.dependency "RxSwift", 'develop'
25-
s.dependency "RxCocoa", 'develop'
24+
s.dependency "RxSwift", '~> 2.6'
25+
s.dependency "RxCocoa", '~> 2.6'
2626

2727
s.watchos.exclude_files = "UIButton+Rx.swift", "UIBarButtonItem+Action.swift", "AlertAction.swift"
2828
s.osx.exclude_files = "UIButton+Rx.swift", "UIBarButtonItem+Action.swift", "AlertAction.swift"

Action.swift

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,8 @@ public final class Action<Input, Element> {
6565
fileprivate let executingQueue = DispatchQueue(label: "com.ashfurrow.Action.executingQueue", attributes: [])
6666
fileprivate let disposeBag = DisposeBag()
6767

68-
public init<B: ExpressibleByBooleanLiteral>(enabledIf: Observable<B> = Observable.just(true), workFactory: @escaping WorkFactory) {
69-
self._enabledIf = enabledIf.map { (booleanLiteral) -> Bool in
70-
return booleanLiteral as! Bool
71-
}
68+
public init(enabledIf: Observable<Bool> = Observable.just(true), workFactory: @escaping WorkFactory) {
69+
self._enabledIf = enabledIf
7270

7371
self.workFactory = workFactory
7472

@@ -78,7 +76,7 @@ public final class Action<Input, Element> {
7876

7977
self.inputs.subscribe(onNext: { [weak self] (input) in
8078
self?._execute(input)
81-
}, onError: nil, onCompleted: nil, onDisposed: nil).addDisposableTo(disposeBag)
79+
}).addDisposableTo(disposeBag)
8280
}
8381
}
8482

@@ -129,7 +127,7 @@ public extension Action {
129127
guard startedExecuting else {
130128
let error = ActionError.notEnabled
131129
self._errors.onNext(error)
132-
buffer.onError(error as Error)
130+
buffer.onError(error)
133131

134132
return buffer
135133
}

UIBarButtonItem+Action.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public extension UIBarButtonItem {
3434

3535
self.rx.tap.subscribe(onNext: { (_) in
3636
action.execute()
37-
}, onError: nil, onCompleted: nil, onDisposed: nil)
37+
})
3838
.addDisposableTo(self.actionDisposeBag)
3939
}
4040
}

UIButton+Rx.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public extension UIButton {
4949
controlEvent
5050
.subscribe(onNext: {
5151
action.execute()
52-
}, onError: nil, onCompleted: nil, onDisposed: nil)
52+
})
5353
.addDisposableTo(self.actionDisposeBag)
5454
}
5555
}

0 commit comments

Comments
 (0)