我用Cocoapods创建了一个简单的项目并安装了RxSwift和RxCocoa。
我已经写了这段代码:
import UIKit
import RxSwift
class ViewController: UIViewController {
@IBOutlet weak var field: UITextField!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
//self.field.rx. (only suggests `base`)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
所以我应该能够self.field.rx.text
正确吗?但我只得到self.field.rx.base
我错过了什么?
答案 0 :(得分:5)
你必须在顶部添加import RxCocoa