Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • that's defining a new function f which is to my sConstructorFun just without labelled arguments. It does save some typing though. Clarified the question. Commented Feb 16, 2015 at 18:22
  • Joe Groff, a Swift developer just confirmed via Twitter that it's not possible at the moment and the easiest way is actually do define a new function wrapping the call :-(. I will therefore accept your answer. Commented Feb 16, 2015 at 18:26
  • I think the problem is that if you just use the letter S, Swift doesn't know what you want to do with it. You could be trying to pass the type as a parameter, or doing any number of other things with it. I'm curious, though, is that something that is common in other programming languages? Are there languages where you can pass the name of a type to a function and it will infer that you are trying to call a constructor? It would be kinda cool... Commented Feb 16, 2015 at 18:47