So...
// why they've done so with old good enums?
typedef NS_ENUM(NSUInteger, PaymentType) {
tCreditCard = 0,
tBankAccount = 1,
tBitcoin = 2
};
...
NSDictionary *payItem = [[NSDictionary alloc]
initWithObjectsAndKeys:[NSNumber numberWithInt:tCreditCard], @"type",
[self makeFakeCreditCardData], @"data", nil];
...
switch([[object valueForKey:@"type"] integerValue])
{
case tCreditCard:
// do something
break;
...
No comments:
Post a Comment