Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Martina Reiter
17,654 PointsIBOutlet swift 2.0
Hello everyone,
I have troubles understanding what an IBOutlet is. Maybe someone can explain to me better?
That would be great, thanks !
1 Answer
Greg Kaleka
39,021 PointsHi Martina,
An IBOutlet is simply a way to connect your storyboard elements (like buttons, labels, etc.) to your code. Once you've control-dragged from the button to your code, you have an IBOutlet with a variable name of your choosing (something like nameLabel), and then you can use or set properties of that element in code.
Let's take nameLabel as an example. You can set nameLabel.text = "Martina", and that will make the name "Martina" appear on the screen. You can also set things like font color, size, etc.
Just one example, but hopefully it helps. Basically, it's a connection between your code and your storyboard.
Cheers
-Greg
Martina Reiter
17,654 PointsMartina Reiter
17,654 Pointsthanks Greg. it's very clear now. appreciate it. cheers :)