Re: Class in Swift

2014-08-16 Thread Marco S Hyman
On Aug 16, 2014, at 2:13 PM, Quincey Morris 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() { // for(...) { // p = ... //

Re: Class in Swift

2014-08-16 Thread Quincey Morris
On Aug 16, 2014, at 13:53 , Charles Srstka wrote: > You can't. Er, am I missing something, or is this not a case that generic functions handle quite easily? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: Class in Swift

2014-08-16 Thread Stephen J. Butler
I'm still learning Swift, but extrapolating from what I might do in Python or Ruby... protocol MyProtocol { ... } func myFunction(generator: (MyParameterType) -> MyProtocol) { for ... { let p : MyParameterType = ... if not p special { continue } let obj = generator(p) ... } }

Re: Class in Swift

2014-08-16 Thread Charles Srstka
On Aug 16, 2014, at 6:32 AM, Gerriet M. Denkmann wrote: > How to translate into Swift: > > - (void)myFunctionWithClass: (Class)someClass > { > for(...) > { > p = ... > if ( p is not special ) continue; > > id aClass = [[ someClass alloc] in

Class in Swift

2014-08-16 Thread Gerriet M. Denkmann
How to translate into Swift: - (void)myFunctionWithClass: (Class)someClass { for(...) { p = ... if ( p is not special ) continue; id aClass = [[ someClass alloc] initWithParameter: p ]; ... do something with aClass