Skip to content

Instantly share code, notes, and snippets.

@Slowhand0309
Created August 17, 2019 09:03
Show Gist options
  • Save Slowhand0309/eea80b823dd3ad4f7e713a9b099bdf8d to your computer and use it in GitHub Desktop.
Save Slowhand0309/eea80b823dd3ad4f7e713a9b099bdf8d to your computer and use it in GitHub Desktop.
[UIButton enable style binder] #iOS
import UIKit
import RxSwift
import RxCocoa
extension Reactive where Base: UIButton {
var enabledStyle: Binder<Bool> {
return Binder(self.base) { base, enabled in
base.isEnabled = enabled
base.backgroundColor = enabled ? UIColor.xxx : UIColor.xxx
base.setTitleColor(enabled ? UIColor.xxx : UIColor.xxx, for: .normal)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment