On Aug 16, 2014, at 2:13 PM, Quincey Morris 
<quinceymor...@rivergatesoftware.com> wrote:

> Er, am I missing something, or is this not a case that generic functions 
> handle quite easily?

That's what I thought, too.

protocol MyProtocol {
    init()
    // ...
}

func myFunction<T: MyProtocol>() {
//      for(...)  {
//          p = ...
//          if ( p is special ) {
                let aClass = T()
                // do something with aClass
//          }
//      }
}


There is a requirement that an init function must be part of the
protocol.

Marc
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to