Class in Swift
Class in Swift
- Subject: Class in Swift
- From: "Gerriet M. Denkmann" <email@hidden>
- Date: Sat, 16 Aug 2014 18:32:53 +0700
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 (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