Until now, everything is quite traditional with regard to developing with Xcode, but now we are going to start using the ReactiveCocoa framework. Let's start with only the username text field. If it is valid, its border must change to green. This way, the user will know that they have introduced a valid value.
Click on your ViewController.swift
file and take a look at the viewDidLoad
method. Here, we are going to check whether the ReactiveCocoa signals are working and try to understand the concept behind them first. Type the following highlighted code in viewDidLoad
and run your code using command + R:
override func viewDidLoad() {
super.viewDidLoad()
nameTextField.rac_textSignal().subscribeNext { (input) -> Void in
print(input)
}
}
Once the application starts running, tap on the username text field and start typing your name. Have a look at the log console and ensure that each letter typed...