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 Weather App with Swift Managing Complexity Callback Methods With Closures

Pascal Brisset
Pascal Brisset
2,290 Points

Preview is blank for this fetchTreehouseBlogPosts challenge

I can't seem to understand what is wrong with my code :(

Callbacks.swift
import Foundation

// Add your code below

func fetchTreehouseBlogPosts(result: NSData!, request: NSURLResponse!, error: NSError! -> Void) {

}
Roberta Voulon
Roberta Voulon
5,792 Points

I think a ton of people are stuck on this, I finally got a hint from somewhere and it worked for me, so I'm re-posting this where I can: What made it work for me in the end was wrap the signature in outer parenthesis like this:

typealias BlogPostCompletion = ((NSData!, NSURLResponse!, NSError!) -> Void)
func fetchTreehouseBlogPosts(completion: BlogPostCompletion) {}

You shouldn't have to do this though! It's perfectly valid without the wrapping parentheses.