<div dir="ltr">This looks like it doesn&#39;t work (swift 2.x), but wanted to be sure it&#39;s not supported:<div>







<p class=""><span class="">class</span><span class=""> Superclass {}<br></span><span class="">class</span><span class=""> Subclass1 : </span><span class="">Superclass</span><span class=""> {}<br></span><span class="">class</span><span class=""> Subclass2 : </span><span class="">Superclass</span><span class=""> {}<br></span><span class="">class</span><span class=""> Subclass3 : </span><span class="">Superclass</span><span class=""> {}</span></p>
<p class=""><span class="">let</span><span class=""> sc1 = </span><span class="">Subclass1</span><span class="">()<br></span><span class="">let</span><span class=""> sc2 = </span><span class="">Subclass2</span><span class="">()<br></span><span class="">let</span><span class=""> sc3 = </span><span class="">Subclass3</span><span class="">()</span></p>
<p class=""><span class="">let</span><span class=""> objects : [</span><span class="">Superclass</span><span class="">] = [</span><span class="">sc1</span><span class="">, </span><span class="">sc2</span><span class="">, </span><span class="">sc3</span><span class="">]</span></p>
<p class=""><span class="">for</span><span class=""> subclassObject </span><span class="">in</span><span class=""> </span><span class="">objects</span><span class=""> {<br></span><span class="">    switch</span><span class=""> subclassObject {<br></span><span class="">    </span><span class="">case</span><span class=""> </span><span class="">let</span><span class=""> object = subclassObject </span><span class="">as</span><span class="">? Subclass1:<br></span>        doSomethingWith(object)<br><span class="">    </span><span class="">case</span><span class=""> </span><span class="">let</span><span class=""> object = subclassObject </span><span class="">as</span><span class="">? Subclass2:<br></span><span class="">        </span>doSomethingWith(object)<br><span class="">    </span><span class="">case</span><span class=""> </span><span class="">let</span><span class=""> object = subclassObject </span><span class="">as</span><span class="">? Subclass3:<br></span><span class="">        </span>doSomethingWith(object)<br><span class="">    </span><span class="">default</span><span class="">:<br></span><span class="">        </span><span class="">return<br></span>    }<br>}</p></div><div><div>This gives an error, expecting a colon (:) after object on every case.</div><div><br></div><div>I wanted to be sure I wasn&#39;t missing something in my syntax (nor some obvious-to-others reason this isn&#39;t supported) before going to swift evolution.</div><div><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Nate Birkholz</div>
</div></div></div>