The last thing we need to do is dismiss the keyboard. Cocoa Touch refers to the object that is currently receiving user events as the first responder. Currently, this is the text field.
It's the act of the text field becoming the first responder that caused the keyboard to appear on-screen. Therefore, to dismiss the keyboard, the text field just needs to resign its place as first responder:
extension ReposTableViewController: UITextFieldDelegate {
public func textFieldShouldReturn(_ textField: UITextField)
-> Bool {
//...
// Dismiss keyboard
textField.resignFirstResponder()
// Returning true as we want the system to have the default
// behaviour
return true
}
}
Now, click on Build and Run. At this point, you can enter any GitHub account name in the text field to retrieve a list of its public repositories. Note that if your Xcode simulator doesn't have the "soft...