Created
March 15, 2012 14:12
-
-
Save n-b/2044386 to your computer and use it in GitHub Desktop.
properties are strong by default now.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.m | |
// testproperties | |
// | |
// Created by Nicolas Bouilleaud on 15/03/12. | |
// Copyright (c) 2012 __MyCompanyName__. All rights reserved. | |
// | |
#import <Foundation/Foundation.h> | |
#import <objc/runtime.h> | |
@interface TestProp : NSObject | |
@property id defaultObject; | |
@property (nonatomic) id nonatomicObject; | |
@property (strong) id strongObject; | |
@property (weak) id weakObject; | |
@property (assign) id assignObject; | |
@end | |
@implementation TestProp | |
@synthesize defaultObject,nonatomicObject,strongObject,weakObject,assignObject; | |
@end | |
int main(int argc, const char * argv[]) | |
{ | |
id TestPropClass = objc_getClass("TestProp"); | |
unsigned int outCount, i; | |
objc_property_t *properties = class_copyPropertyList(TestPropClass, &outCount); | |
for (i = 0; i < outCount; i++) { | |
objc_property_t property = properties[i]; | |
NSLog(@"%s: %s\n", property_getName(property), property_getAttributes(property)); | |
} | |
return 0; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2012-03-15 15:08:32.138 testproperties[304:403] defaultObject T@,&,VdefaultObject | |
2012-03-15 15:08:35.505 testproperties[304:403] nonatomicObject T@,&,N,VnonatomicObject | |
2012-03-15 15:08:36.608 testproperties[304:403] strongObject T@,&,VstrongObject | |
2012-03-15 15:08:38.385 testproperties[304:403] weakObject T@,W,VweakObject | |
2012-03-15 15:08:39.611 testproperties[304:403] assignObject T@,VassignObject |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment