Re: Class in Swift
Re: Class in Swift
- Subject: Re: Class in Swift
- From: Marco S Hyman <email@hidden>
- Date: Sat, 16 Aug 2014 16:56:47 -0700
On Aug 16, 2014, at 2:13 PM, Quincey Morris <email@hidden> 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 (email@hidden)
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:
This email sent to email@hidden