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 Views and View Controllers View Controllers and IBAction

Stanley Gao
Stanley Gao
3,889 Points

Viewcontroller is different in Xcode 6.1? Inserting action does not give me a function, how can I fix it?

It seems inserting action does not give me a function, it generated the following statement

  • (IBAction)showFunFact {}

When I manually put a "func" to try to change it to a function, it shows an error "Expected method body".

Also, the insert options I had is different too, I can only establish "Action" under "Connection", and I only have id/UIButton under "Type"

Am I doing anything wrong? How can I fix this?

1 Answer

Michael Hulet
Michael Hulet
47,912 Points

It looks to me like you made a project that's supposed to be made in Objective-C. Delete the folder containing that project and make a new one, but make sure to select "Swift" as the language when you're setting up the new project