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

sendNoticeTo() error in Swift 2

rpl.swift:86:19: error: expected parameter type following ':' func sendNoticeTo(#aptNumber:Int) { ^ '

so basically func sendNotice(#aptNumber:Int){ } doesn't work in swift 2

3 Answers

Hey Thomas Katalenas,

The # for parameter names isn't supported anymore in Swift 2. If you want the function to have the same external name as the local name, you just write the parameter name twice. However, this is only for the first parameter because if no external name is specified - Swift will use the local name as the external name by default.

func sendNotice(aptNumber aptNumber:Int){

}

Good Luck

what is the big difference between swift 1 and 2, besides minor syntax differences?

Hey Thomas,

The biggest difference I have noticed so far is regarding how errors are handled. The Swift 2.0 course on Error Handling is a great course on this topic. I believe that Treehouse also has a Workshop that should answer this question for you in more detail: https://teamtreehouse.com/library/whats-new-in-swift-20

However, I haven't gotten to watch it myself yet. Hope this helps, good luck!

Thanks!!