2015-04-08 01:28:38 +03:00
|
|
|
//
|
|
|
|
// UILabel+Rx.swift
|
|
|
|
// RxCocoa
|
|
|
|
//
|
|
|
|
// Created by Krunoslav Zaher on 4/1/15.
|
2015-12-29 18:56:21 +03:00
|
|
|
// Copyright © 2015 Krunoslav Zaher. All rights reserved.
|
2015-04-08 01:28:38 +03:00
|
|
|
//
|
|
|
|
|
2015-09-30 15:02:41 +03:00
|
|
|
#if os(iOS) || os(tvOS)
|
|
|
|
|
2015-08-01 16:13:26 +03:00
|
|
|
#if !RX_NO_MODULE
|
2015-04-10 02:52:51 +03:00
|
|
|
import RxSwift
|
2015-08-01 16:13:26 +03:00
|
|
|
#endif
|
2015-04-08 01:28:38 +03:00
|
|
|
import UIKit
|
|
|
|
|
2016-08-03 21:11:43 +03:00
|
|
|
extension Reactive where Base: UILabel {
|
2015-08-29 22:20:44 +03:00
|
|
|
|
2016-10-23 20:26:22 +03:00
|
|
|
/// Bindable sink for `text` property.
|
2016-10-11 23:41:05 +03:00
|
|
|
public var text: UIBindingObserver<Base, String?> {
|
2016-08-03 21:11:43 +03:00
|
|
|
return UIBindingObserver(UIElement: self.base) { label, text in
|
2016-02-13 23:25:31 +03:00
|
|
|
label.text = text
|
2016-10-11 23:41:05 +03:00
|
|
|
}
|
2015-04-08 01:28:38 +03:00
|
|
|
}
|
2015-11-11 05:46:30 +03:00
|
|
|
|
2016-10-23 20:26:22 +03:00
|
|
|
/// Bindable sink for `attributedText` property.
|
2016-10-11 23:41:05 +03:00
|
|
|
public var attributedText: UIBindingObserver<Base, NSAttributedString?> {
|
2016-08-03 21:11:43 +03:00
|
|
|
return UIBindingObserver(UIElement: self.base) { label, text in
|
2016-02-13 23:25:31 +03:00
|
|
|
label.attributedText = text
|
2016-10-11 23:41:05 +03:00
|
|
|
}
|
2015-11-11 05:46:30 +03:00
|
|
|
}
|
2015-08-29 22:20:44 +03:00
|
|
|
|
2015-09-30 15:02:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|