RxSwift/RxCocoa/iOS/UIView+Rx.swift
2017-11-04 18:53:02 +01:00

39 lines
893 B
Swift

//
// UIView+Rx.swift
// RxCocoa
//
// Created by Krunoslav Zaher on 12/6/15.
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
//
#if os(iOS) || os(tvOS)
import UIKit
import RxSwift
extension Reactive where Base: UIView {
/// Bindable sink for `hidden` property.
public var isHidden: Binder<Bool> {
return Binder(self.base) { view, hidden in
view.isHidden = hidden
}
}
/// Bindable sink for `alpha` property.
public var alpha: Binder<CGFloat> {
return Binder(self.base) { view, alpha in
view.alpha = alpha
}
}
/// Bindable sink for `isUserInteractionEnabled` property.
public var isUserInteractionEnabled: Binder<Bool> {
return Binder(self.base) { view, userInteractionEnabled in
view.isUserInteractionEnabled = userInteractionEnabled
}
}
}
#endif