<div dir="ltr">Using a static/class function would make subclassing difficult<div><ul><li>you cannot hide them in subclasses (they&#39;re always inherited unlike initializers)</li><li>you can&#39;t call them from subclass initializers to properly initialize superclasses<br></li></ul></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Dec 13, 2015 at 2:21 PM, Drew Crawford via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><span class=""><br><div><blockquote type="cite"><div>On Dec 13, 2015, at 7:13 AM, ilya &lt;<a href="mailto:ilya.nikokoshev@gmail.com" target="_blank">ilya.nikokoshev@gmail.com</a>&gt; wrote:</div><br><div><span style="font-family:HelveticaNeue;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:pre-wrap;word-spacing:0px;float:none;display:inline!important">You can easily call a private parametrized init from a class function though. </span></div></blockquote></div><div><br></div></span><div>Sure, but we&#39;re just shuffling the deck.  We&#39;ve gone from a bad public API to a bad private API.</div><div><br></div><div>Actually, it&#39;s worse, because we now have BOTH a bad private API AND a bad public API.  There is a reason that NSData.dataWithData(...) is a Swift compile error.</div><div><br></div><div>The (ab)use of class functions as constructors is a holdover from ObjC times.  If you want to make an instance in Swift, you should type ClassName( and see what autocomplete suggests; you should not have to read through the documentation of class functions to see if they are secretly constructors that have been filed at the wrong shelf in the library.</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=6ZGE61OxINd5lLe2xYh9Ku-2BXbixWNr2nvfzp2IB1sZiqZHDIlgYl-2BScSOg2-2BXLlwLZ5BrjrpNzS6DOvHnZiM8IEFgDz031KM5wKJ08hWMBruddpB2mGQq3XQe-2B5mlJDRKXPJtz-2FKcj9RtTXASHNrQCiuvIAQktInFXg42p0-2BtHU46HPxiUx3PR7blAljfzpZKXFUYvV57LVKk3a4dsX-2B0csU7Lfb471czDGpQqJeIeU-3D" alt="" width="1" height="1" border="0" style="min-height:1px!important;width:1px!important;border-width:0!important;margin-top:0!important;margin-bottom:0!important;margin-right:0!important;margin-left:0!important;padding-top:0!important;padding-bottom:0!important;padding-right:0!important;padding-left:0!important">
</div>
<br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>