

Structuring Modern Objective-C - AshFurrow
http://ashfurrow.com/blog/structuring-modern-objective-c

======
program
Enable modules and use them to import system frameworks:

    
    
       // #import <Cocoa/Cocoa.h>
       @import Cocoa;
    

Use literals and subscripting methods:

    
    
       NSNumber *yes = @YES;
       NSNumber *number = @42;
       NSArray *array = @[@"Hello", @"World"];
       NSDictionary *dictionary = @{ @"name" : NSUserName() };
    

Learn about "instancetype":
[http://clang.llvm.org/docs/LanguageExtensions.html#objective...](http://clang.llvm.org/docs/LanguageExtensions.html#objective-
c-features)

Always use NS_ENUM and NS_OPTIONS to declare enum types:

    
    
       typedef NS_ENUM(NSInteger, HNExample) {
          HNExampleDefault,
          HNExample1,
          HNExample2
       };

~~~
AshFurrow
Good tips, too! I tried to stay away from more stylistic things, but I do
agree with you.

------
liviu
Thank you Ash, I was looking for that for long time.

I'm happy that I found your blog with so many iOS resources. I'll read them
all and I'll follow your activity a there.

------
anon1385
>Instead, you should be declaring them as properties, and then accessing them
through message-passing or dot syntax.

Dot syntax _is_ message passing. This type of confusion is one of the reasons
I really hate dot syntax.

~~~
AshFurrow
I know. I was referring to the message-passing syntax or dot syntax.

