Skip to content

Instantly share code, notes, and snippets.

@thekarladam
Created August 26, 2011 22:04
Show Gist options
  • Save thekarladam/1174535 to your computer and use it in GitHub Desktop.
Save thekarladam/1174535 to your computer and use it in GitHub Desktop.
Cocoa commandments
1. Thou shalt always use Key Value Observing
2. Thou shalt not block the main thread
3. Thou shalt compile with zero errors or warnings
4. Thou shalt use #pragma mark to separate code into groups based on related functionality
@pbowden
Copy link

pbowden commented Aug 26, 2011

  1. Cool story, though

@robrix
Copy link

robrix commented Aug 26, 2011

Though shalt compile with clang as the Lord intended

@patr1ck
Copy link

patr1ck commented Aug 26, 2011

Though shalt use #pragma mark

@robrix
Copy link

robrix commented Aug 26, 2011

Though shalt use #pragma message() instead of #warning for thy fixmes

@stevestreza
Copy link

Thou shalt never write interface code achievable through Interface Builder.

@thekarladam
Copy link
Author

I disagree with that one Streza. Interface builder is not something I often use. The more custom the UI the less Interface Builder makes an appearance.

@zac
Copy link

zac commented Aug 26, 2011

Meh, I haven't implemented loadView in years and I'm better for it. Custom UIView subclasses laid out in IB FTW.

@natan
Copy link

natan commented Aug 26, 2011

Thou shalt make copious use of categories

@stevestreza
Copy link

Karl: if it can't be done in IB, sure. If it can, but you're writing code anyway, you're doing it wrong. Less code == less bugs. And the cases where it can't be done are being addressed by Apple.

@thekarladam
Copy link
Author

I certainly agree with the logic behind your statement, just not the execution of it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment