IntrepidPursuits / objective-c-style-guide

MIT License
4 stars 0 forks source link

add dot-notation and method distinctions #14

Closed brightredchilli closed 9 years ago

brightredchilli commented 9 years ago

Address #12

cprime commented 9 years ago

Okay, I see what @brightredchilli is doing here. However, I think this statement "Dot-notation should not be used to call methods. For Cocoa objects, use headers from the latest available SDK." should be broken up into two statements either with their own example.

Dot-notation should not be used to call methods. For example:

NSMutableArray *array = [NSMutableArray array];

Not:

NSMutableArray *array = NSMutableArray.array;

However, recent SDKs have converted some methods into properties. Since you should be using the latest available SDK, you should use the dot syntax for these newly declared properties. For example:

array.firstObject
array.count

Not:

[array firstObject]
[array count]
brightredchilli commented 9 years ago

guilty as charged!

brightredchilli commented 9 years ago

closed with 4b05050