POST Requests and ColorController
ColorController will be a bit more involved than a text field and one button. The controller’s view will have two sections: a lower-half UITableView to list the color’s Tags and an upper section with an entry field to add new tags.
When we want to add a new tag, we send a POST request to Colr with the tag’s text. When that request finishes, we completely refresh our data and update the UI so the user knows the new tag is saved. POST requests are done just like GETs, except using HTTP.post. That sounds like a lot, so let’s take it one step at a time.
Setting Up the UI
First we’re going to use a custom initializer for ColorController. This will take a Color as its sole argument, which makes sense given that ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access