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 Simple Data Structures NSBundle and the File Directory

Martin Foldyna
Martin Foldyna
10,359 Points

help with Code Challenge please

I'm getting Bummer: "Don't forget to instantiate the dictionary with the contents of the plist!."

And I Don't know what to do more :(

This is my code:

import Foundation

// Add your code below

let plistPath = NSBundle.mainBundle().pathForResource("CrazyInformation", ofType: "plist"), let weatherDictionary = NSDictionary(contentsOfFile: plistPath)

2 Answers

Darren Poole
Darren Poole
3,609 Points

I was struggling with this challenge for a bit also. This worked for me. Watched the video back and at about 4 minutes in I had realised the instance of NSDictionary containing the plistPath wasn't in the curly braces. Hope it helps.

import Foundation

if let plistPath = NSBundle.mainBundle().pathForResource("CrazyInformation", ofType: "plist") { let crazy = NSDictionary(contentsOfFile: plistPath) }

Martin Foldyna
Martin Foldyna
10,359 Points

Yes this help :)

Thank you very much

God damn curly braces got me too