Presenting the Log On-Screen

Our library can store log entries, but this alone is not really useful. We need a component that will display the log entries on-screen so that when our app isn’t working properly we can figure out why.

The log itself is just an array with short strings, so a UITableView is the perfect component to display that data. Whenever you see information in similar chunks in an app (for example, tweets or Facebook posts), a table view is probably presenting that information. The easiest way to get a table view to display on-screen is to use a table view controller.

Let’s add a UITableViewController to the libraries package.

Select the LogStore folder in the package, add a new file with the shortcut N, and change the ...

Get Build Location-Based Projects for iOS 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.