Much obliged!! This syntax is clean and makes sense once I see it.

Sent from my iPhone, please excuse brevity and errors

> On Jul 8, 2016, at 8:49 AM, Dan Loewenherz via swift-users 
> <swift-users@swift.org> wrote:
> 
>> On Fri, Jul 8, 2016 at 10:34 AM, Roth Michaels via swift-users 
>> <swift-users@swift.org> wrote:
>> On Fri, Jul 08 2016 at 11:11:04 AM, Nate Birkholz via swift-users 
>> <swift-users@swift.org> wrote:
>> > This gives an error, expecting a colon (:) after object on every case.
>> >
>> > I wanted to be sure I wasn't missing something in my syntax (nor some
>> > obvious-to-others reason this isn't supported) before going to swift
>> > evolution.
>> 
>> There is a bug filed to improve this error message:
>> https://bugs.swift.org/browse/SR-2022
>> 
>> On Fri, Jul 08 2016 at 11:15:48 AM, Dan Loewenherz via swift-users 
>> <swift-users@swift.org> wrote:
>> > To my knowledge, you can’t do exactly what you’re trying to do
>> 
>> Here is how:
>> 
>> ```Swift
>> 
>> for object in objects {
>>     switch object {
>>     case let object as Subclass1:
>>         doSomethingWith(object)
>>     case let object as Subclass2:
>>         doSomethingWith(object)
>>     case let object as Subclass3:
>>         doSomethingWith(object)
>>     default:
>>         break
>>     }
>> }
> 
> Beautiful, thanks Roth! This is much nicer. :)
> 
> Dan
> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to