为什么 rx.text / rx.observe / rx.etc 不可用 (RxSwift)
Why are rx.text / rx.observe / rx.etc not available (RxSwift)
我用 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
我错过了什么?
你也必须在顶部添加 import RxCocoa
我用 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
我错过了什么?
你也必须在顶部添加 import RxCocoa