Skip to content

Instantly share code, notes, and snippets.

@thekarladam
Created August 26, 2011 22:04
Show Gist options
  • Select an option

  • Save thekarladam/1174535 to your computer and use it in GitHub Desktop.

Select an option

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

pbowden commented Aug 26, 2011

Copy link
Copy Markdown
  1. Cool story, though

@robrix

robrix commented Aug 26, 2011

Copy link
Copy Markdown

Though shalt compile with clang as the Lord intended

@patr1ck

patr1ck commented Aug 26, 2011

Copy link
Copy Markdown

Though shalt use #pragma mark

@robrix

robrix commented Aug 26, 2011

Copy link
Copy Markdown

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

@stevestreza

Copy link
Copy Markdown

Thou shalt never write interface code achievable through Interface Builder.

@thekarladam

Copy link
Copy Markdown
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

zac commented Aug 26, 2011

Copy link
Copy Markdown

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

@natan

natan commented Aug 26, 2011

Copy link
Copy Markdown

Thou shalt make copious use of categories

@stevestreza

Copy link
Copy Markdown

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
Copy Markdown
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