Is an IBAction also an "outlet"?

In Chapter 6 of the the iOS Apprentice book, it states the following instruction for a section:

“Connect the Outlet.
Finally, you need to connect the Start Over button to the action method.”

I would like to know why it states “Connect the Outlet”, if this is actually an action that is being connected to the object. Am I misunderstanding something here? Or is this a typo?

The book also states: "“Just as Interface Builder likes to call methods actions, it calls these variables outlets. ”

So I’m confused as to why they’re being referred to in Chapter 6 as “outlets”. I’d like to make sure that I’m properly learning the necessary terminology. Could someone PLEASE clear this up for me? Praying that this gets an answer soon. Thank you for your help.

Outlets are variables that give your code access to objects on your storyboard. For a label, it lets you set the text, or read the text a user has entered.

Actions are a way for objects on the storyboard to notify your code that something has happened. For a button, it can call your code whenever the button is tapped.

You can have both for a single object. In Bull’s Eye, the slider has an outlet, which lets your code read the value from the slider, or set the slider to a starting value. It also has an action, which will call your code whenever the user moves the slider.

That section at the end of chapter 6 called “Connect the Outlet” should probably have been called “Connect the Button.”

1 Like

Thank you for this clear explanation. This was super helpful, I appreciate it!

This topic was automatically closed after 166 days. New replies are no longer allowed.