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 ...

Get RubyMotion now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.