Skip to content

Commit

Permalink
Updates from PR comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
floskel committed Sep 10, 2016
1 parent 360cd87 commit fdd5e7d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Action.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Pod::Spec.new do |s|
s.source_files = "*.{swift}"

s.frameworks = "Foundation"
s.dependency "RxSwift", 'develop'
s.dependency "RxCocoa", 'develop'
s.dependency "RxSwift", '~> 2.6'
s.dependency "RxCocoa", '~> 2.6'

s.watchos.exclude_files = "UIButton+Rx.swift", "UIBarButtonItem+Action.swift", "AlertAction.swift"
s.osx.exclude_files = "UIButton+Rx.swift", "UIBarButtonItem+Action.swift", "AlertAction.swift"
Expand Down
10 changes: 4 additions & 6 deletions Action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ public final class Action<Input, Element> {
fileprivate let executingQueue = DispatchQueue(label: "com.ashfurrow.Action.executingQueue", attributes: [])
fileprivate let disposeBag = DisposeBag()

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

self.workFactory = workFactory

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

self.inputs.subscribe(onNext: { [weak self] (input) in
self?._execute(input)
}, onError: nil, onCompleted: nil, onDisposed: nil).addDisposableTo(disposeBag)
}).addDisposableTo(disposeBag)
}
}

Expand Down Expand Up @@ -129,7 +127,7 @@ public extension Action {
guard startedExecuting else {
let error = ActionError.notEnabled
self._errors.onNext(error)
buffer.onError(error as Error)
buffer.onError(error)

return buffer
}
Expand Down
2 changes: 1 addition & 1 deletion UIBarButtonItem+Action.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public extension UIBarButtonItem {

self.rx.tap.subscribe(onNext: { (_) in
action.execute()
}, onError: nil, onCompleted: nil, onDisposed: nil)
})
.addDisposableTo(self.actionDisposeBag)
}
}
Expand Down
2 changes: 1 addition & 1 deletion UIButton+Rx.swift
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public extension UIButton {
controlEvent
.subscribe(onNext: {
action.execute()
}, onError: nil, onCompleted: nil, onDisposed: nil)
})
.addDisposableTo(self.actionDisposeBag)
}
}
Expand Down

0 comments on commit fdd5e7d

Please sign in to comment.