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) Pulling Data From the Web Networking in iOS

Kevin Murphy
Kevin Murphy
24,380 Points

Swift - Class Method syntax (when calling)

I'm wondering if any experienced Swift users can clear up my confusion regarding class methods in Swift.

It seems the syntax varies between dot notation and just using the class followed by parentheses (as if creating an instance with special init arguments). Which is the standard/current syntax?? Apple documentation still says a class method is called using dot notation, but in these projects I've seen the parentheses notation used repeatedly e.g.:

//Class method "parentheses" syntax
let forecastURL = NSURL(String: "",  relativeToURL: baseURL)

Also, the teachers notes updates get rid of the dot notation in favor of the parentheses syntax, so it seems like a shift towards parentheses as the standard/current syntax.

Can someone please clarify?