Coding the App

Now that we’ve added a button to our view and wired it up, we can run the app again. The app now has the Send Tweet button, and we can even tap it, but it doesn’t do anything. In fact, we don’t even know if we’ve made our connections correctly. One thing we can do as a sanity check is to log a message to make sure our code is really running. Once that’s verified, we can move on to implementing our tweet functionality.

Logging

On iOS, we can use the function println to write a string out to the system’s log file. We can implement our action to just log a message every time the button is tapped and thereby verify that the connections are working. Select ViewController.swift in the File Navigator (1) to edit its source code and rewrite ...

Get iOS 8 SDK Development, 2nd Edition 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.