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 trialKevin Murphy
24,380 PointsSwift - 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?