How to translate into Swift:

- (void)myFunctionWithClass: (Class)someClass
{
        for(...)
        {
                p = ...
                if ( p is not special ) continue;

                id <MyProtocol> aClass = [[ someClass alloc] initWithParameter: 
p ];
                ... do something with aClass ...
        }
}

Assuming that someClass is costly to initialize and myFunctionWithClass does so 
only under certain circumstances.
Or that myFunctionWithClass creates many instances of someClass.

Assuming also, that there is an unlimited number of classes (all implementing 
MyProtocol).

Which means that there is no way that the caller of myFunctionWithClass could 
create a someClass and pass it to the method.

How to do this in Swift?

Gerriet.


_______________________________________________

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