iosLearner iosLearner - 4 months ago 7
Swift Question

Is this right conversion from Swift to Objective C?

In swift

!tempPlays.values.contains(1)


In Objective C

(![[tempPlays objectForKey:@"1"] integerValue]) // tempPlays is NSDictionary


New to iOS..

Answer

In Objective-C

 if (![tempPlays.allValues containsObject:@"1"]) {}

or

if (![tempPlays.allValues containsObject:@(1)]) {}
Comments