Should I just cast a variable, or use isKindOfClass: to check it and then cast? Which one will be better and more efficient? (Well, efficiency isn’t an issue just for a little bit.) I want string below to be an NSString.
Example:
NSString *string = (NSString *)result;
or:
if(![string isKindOfClass:[NSString class]]
{
//cast it
}
Although just casting would be more efficient it may be better for your app if you first check if the result is what you think it is.
It all depends on how safe you want to be