Last active
December 14, 2018 10:32
-
-
Save Viveron/729915739af8041ea40077a134985231 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import LeadKit | |
import RxSwift | |
import RxCocoa | |
typealias TapTrait = Void | |
typealias TapRelay = PublishRelay<TapTrait> | |
typealias TapDriver = Driver<TapTrait> | |
extension PublishRelay where Element == TapTrait { | |
func tap() { | |
accept(()) | |
} | |
func asDriver() -> TapDriver { | |
return asDriver(onErrorDriveWith: .empty()) | |
} | |
} | |
extension SharedSequenceConvertibleType where SharingStrategy == DriverSharingStrategy, E == TapTrait { | |
func driveOnTap(_ closure: @escaping VoidBlock) -> Disposable { | |
return drive(onNext: closure) | |
} | |
} |
Author
Viveron
commented
Dec 14, 2018
•
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment