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 trialAlex M
6,117 PointsCannot get method syntax
I think I wrote a valid code. It works in Xcode. Can't get what's wrong.
import Foundation
// Add your code below
func fetchTreehouseBlogPosts(completion: (NSData!, NSURLResponse!, NSError!) -> ()) {
}
Alex M
6,117 PointsIt says: Make sure the method is named fetchTreehouseBlogPosts and has the correct syntax!
and no error in console
2 Answers
Steve Hunter
57,712 PointsHi Alex,
Have a look at this code - see if that makes sense to you:
typealias BlogPostCompletion = ((NSData!, NSURLResponse!, NSError!) -> Void)
func fetchTreehouseBlogPosts(completion: BlogPostCompletion) {
}
Steve.
Caleb Kleveter
Treehouse Moderator 37,862 PointsThat's weird, it seems that when you read the instructions from the challenge you don't have to create the typealias
.
Steve Hunter
57,712 PointsNo, it's optional - I just find it easier to do it that way else the line gets long and that confuses me. :-D
Alex M
6,117 PointsThanks
Caleb Kleveter
Treehouse Moderator 37,862 PointsCaleb Kleveter
Treehouse Moderator 37,862 PointsWhat is your error?