respondsToSelector in Swift


Gerriet M. Denkmann
 

How to translate this into Swift

- (id)transformedValue:(id)value
{
if ( ![value respondsToSelector: @selector(doubleValue) ] )
{
NSLog(@"%s Error value %@ %@",__FUNCTION__, [value class], value);
return @50;
};

NSNumber *input = (NSNumber *)value; // maybe NSString
double output = …
return @(output)
}

Gerriet.

Join cocoa@apple-dev.groups.io to automatically receive all group messages.