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 trialAlexey Kuznetsov
9,516 PointsBuild a Weather App With Swift -> Managing complexity -> 1st challenge
Got no errors, where is mistake? Or i just didn't understand the task?
import Foundation
// Add your code below
typealias BlogPostCompletion = (NSData!, NSURLResponse!, NSError!) -> Void
func fetchTreehouseBlogPosts(completion: BlogPostCompletion) {
}
2 Answers
Corey Dutson
Courses Plus Student 3,193 PointsTurns out for whatever reason, you need to throw an extra set of () around the callback declaration. Pasan doesn't do this in the video, nor does xcode correct you on it... I feel like this may be a Swift 1.0 thing that changed and the code checker was never updated on.
Anyways here's a working answer:
import Foundation
// Add your code below
typealias BlogPostCompletion = ((NSData!, NSURLResponse!, NSError!) -> Void)
func fetchTreehouseBlogPosts(completion: BlogPostCompletion) {}
Alexey Kuznetsov
9,516 PointsThank you! I tried all the options except the last one, I didn't even occur, that problem was here.
Corey Dutson
Courses Plus Student 3,193 PointsCorey Dutson
Courses Plus Student 3,193 PointsHey there! I'm getting the exact same problem right now. I've dumped my code into xcode and it all seems syntactically correct. Here's what I've tried:
I should note that I'm aware some are not correct (1,2,7,8) because they shouldn't be named, but I wanted to be thorough.
EDIT: I've figured it out, though it seems to be a bug with the code checker itself. I've added my answer below.