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

I'm getting an error towards the end of this code.

if let plistPath = NSBundle.mainBundle().pathForResource("CurrentWeather", ofType: "plist"), let weatherDictionary = NSDictionary(contentsOfFile: plistPath), let currentWeatherDictionary = weatherDictionary["currently"] as? [String: AnyObject]{ let currentWeather = CurrentWeather(weatherDictionary: currentWeatherDictionary) }

The last line is giving me the error: "Use of unresolved identifier 'CurrentWeather'"

What is this "CurrentWeather" reference referring to?

dexter foo
dexter foo
8,233 Points

this CurrentWeather is referring to the struct CurrentWeather that you should have created earlier on. If you did not, that might explain why there is an unresolved identifier.

I had the same unresolved identifier issue, and it was because my CurrentWeather struct in CurrentWeather.swift was written with a lower case "c" (as in "currentWeather"). Once I fixed that, it worked. Make sure that the struct name in CurrentWeather.swift matches the exact same format it takes in ViewController.swift.

1 Answer

Girri M Palaniyapan
Girri M Palaniyapan
7,829 Points

Same I am getting an error too. I am also getting an error about the override in the following function.