Created
July 27, 2017 20:26
-
-
Save alanf/4de565da4263863c88977958d08eef95 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 ReactiveKit | |
import UIKit | |
class UnderlinedTextField: UITextField { | |
@IBOutlet weak var underlineView: UIView! | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
underlineView.backgroundColor = UIColor.lightGray | |
// Highlight/unhighlight the underlined view when it's being edited. | |
reactive.controlEvents(.editingDidBegin).map { _ in | |
return UIColor.green | |
}.bind(to: underlineView.reactive.backgroundColor).dispose(in: reactive.bag) | |
reactive.controlEvents(.editingDidEnd).map { _ in | |
return UIColor.lightGray | |
}.bind(to: underlineView.reactive.backgroundColor).dispose(in: reactive.bag) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Dear Alan,
I have been trying since today morning to fix this error but something is wrong. I installed cocoa and all the kits required but it still gives me this error:
/Users/.../ViewController.swift:31:54: Value of type 'Signal<UIColor, NoError>' has no member 'bind'
I
