Reputation: 38667
If I look at UIViewController.h, I can see atomicity before retainability:
@property(nullable, nonatomic, readonly, strong) NSBundle *nibBundle;
As if I drag an drop an element from a .xib to a counterpart file, it generates retainability before atomicity:
@property (weak, nonatomic) IBOutlet UIView *testView;
Source: Xcode 7 beta 5.
Which one is recommended or following Apple guidelines more closely?
Upvotes: 0
Views: 237
Reputation: 16660
Edit to the comments:
I tried it with:
NSPredicate *propertyPredicate = [NSPredicate predicateWithFormat:@"kind = %d", CXCursor_ObjCPropertyDecl];
NSMutableDictionary *properties = [NSMutableDictionary new];
[protocol visitChildrenMatchingPredicate:propertyPredicate withBlock:
^(CLNGEntity *property, CLNGEntity *parent)
{
CXCursor cursor = property.cxCursor;
CXType type = clang_getCursorType(cursor);
CXString spelling = clang_getTypeSpelling(type);
const char *cSpelling = clang_getCString(spelling);
NSLog(@"Property type %s", cSpelling);
return CXChildVisit_Continue;
}];
(Don't care about the CLNG…
types, they are simple Objective-C wrappers around the corresponding CX…
types. The only additional capability used here is the possibility to visit blocks matching an NSPredicate
instance.)
However, with this code I only get the spelling of the type of the property, i. e. …:
2015-09-16 10:18:33.689 obcl_cloudInterfaceExporter[1544:507] Property type NSString *
… but not the complete property declaration. But I would bet that there was a function to print (dump) the whole cursor. But I cannot find it now. Sorry. (Maybe it was in the C++ API only, but later I decided to switch to the C API.)
However, since you are working on clang, you will have better chances to find it, if I do not remember that completely wrong.
Upvotes: -1
Reputation: 124997
Which one is recommended or following Apple guidelines more closely?
The order of the attributes is unimportant, and I'm not aware of any guidelines regarding the order. Personally, I usually put the atomicity specifier at the end because it's almost always the same and the thing I care least about. A good friend puts it first because it's easiest to skip when all the nonatomic
specifiers line up. Do what you like best.
Upvotes: 3