Created
May 5, 2020 14:22
-
-
Save Monntay/962b22fa71d998df255703d49fee6a44 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 RxCocoa | |
| import RxSwift | |
| extension Reactive where Base: UIImageView { | |
| func image(withDuration: TimeInterval) -> Binder<UIImage?> { | |
| return Binder(base) { imageView, image in | |
| // needed to avoid "Value of type 'UIView' has no member 'image'" | |
| let baseImageView = imageView | |
| UIView.transition(with: imageView, | |
| duration: withDuration, | |
| options: .transitionCrossDissolve, | |
| animations: { baseImageView.image = image }, | |
| completion: nil) | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment