Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // main.m
- // Literals
- //
- // Created by Bruno Gama on 14/06/12.
- // Copyright (c) 2012 Bruno Gama. All rights reserved.
- //
- #import <Foundation/Foundation.h>
- int main(int argc, const char * argv[])
- {
- @autoreleasepool {
- __block id num = @ 5.1,
- arr = @ [@"a", @"b", @"c", @1, @2., @.3],
- dic = @{ @"hi" : num, @"sup" : arr };
- #define _c(theString) \
- [[(theString) class] description]
- // Console output:
- // 2012-06-14 21:30:35.296 Literals[8203:403] key=hi (__NSCFConstantString), obj=5.1 (__NSCFNumber)
- // 2012-06-14 21:30:35.298 Literals[8203:403] key=sup (__NSCFConstantString), obj=(
- // a,
- // b,
- // c,
- // 1,
- // 2,
- // "0.3"
- // ) (__NSArrayI)
- //
- [dic enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
- NSLog(@"key=%@ (%@), obj=%@ (%@)", key, _c(key), obj, _c(obj));
- }];
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment