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

iOS Build a Simple iPhone App with Swift 2.0 View Controllers and Views Using IBAction to Execute Methods

Ryan Maneo
Ryan Maneo
4,342 Points

Why is the @IBAction for showFunFact below the didRecieveMemoryWarning method?

Title says it all... why?!?! can't it be above it?

Well, location in code doesn't matter, it can be anywhere inside the class. off course it can be above!

1 Answer

The location in code doesn't really matter as long as you're in the right scope. However in this case the location of @IBAction is a result of the general rules on how to write iOS apps :)