Coding the Action

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

Back in Chapter 2, we learned about the NSLog function for logging timestamped messages to the Xcode console. We can use that in 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 ...

Get iOS 9 SDK Development 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.