Currently, our app fetches repositories from a specific, hardcoded GitHub username. It would be great if, rather than hardcoding the username, the user of the app could enter the GitHub username that the repositories will be retrieved for. So, let's add this functionality:
- First, we need a way for the user to enter their GitHub username; the most appropriate way to allow a user to enter a small amount of text is through the use of UITextField.
- In the main storyboard, find Text Field in the object library, drag it over to the main window, and drop it on the navigation bar of our ReposTableViewController. Now, you need to increase the width of the Text Field. For now, just hard code this to around 300px by highlighting the respective Text Field and selecting the Size Inspector option:
Figure 6.12 – Adding a UITextField
Like a table view, UITextField communicates user events through a delegate, which needs to conform to ...