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 = ...
//
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
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)
...
}
}
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
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