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!

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 (Retired) Concurrency Using Our JSON Data

Alphonse Yang
Alphonse Yang
7,830 Points

dot notation method

I am using the Xcode 6.1 GM, and I found that some dot notation methods couldn't be found in the Xcode, for example, the NSString.stringWithContentsOfURL().. But if I use the constructor, there's a similar function, is that because of the swift update?

It seems like there have been several updates to Swift and the videos have yet to be updated to reflect these changes. I'm having lots of problems following these trainings since most of the time I need to stop and do some research to find the latest syntax...

1 Answer

Jaroslaw Oleksy
Jaroslaw Oleksy
4,992 Points

I think the line should go like this in Xcode 6.1:

var urlContents = NSString(contentsOfURL: location, encoding: NSUTF8StringEncoding, error: nil)