Skip to content

Instantly share code, notes, and snippets.

Objective-C Coding Convention and Best Practices

Most of these guidelines are to match Apple's documentation and community-accepted best practices. Some are derived some personal preference. This document aims to set a standard way of doing things so everyone can do things the same way. If there is something you are not particularly fond of, it is encouraged to do it anyway to be consistent with everyone else.

This document is mainly targeted toward iOS development, but definitely applies to Mac as well.

Operators

NSString *foo = @"bar";
@interface PSPDFThreadSafeMutableDictionary : NSMutableDictionary
@end
#import "PSPDFThreadSafeMutableDictionary.h"
#import <libkern/OSAtomic.h>
@implementation PSPDFThreadSafeMutableDictionary {
OSSpinLock _lock;
NSMutableDictionary *_dictionary; // Class Cluster!
#import <Foundation/Foundation.h>
#import "sqlite3.h"
typedef int64_t timestamp;
NSUInteger randomNumberInRange(NSUInteger start, NSUInteger end);
// Create a sample date using the ISO-8601 format.
// 2013-04-23T16:29:05Z
NSString* generateSampleDate();
# Roon Viewer
#
# This is the locale file for the Roon Viewer. The Viewer is the part of Roon
# that shows users' blogs. Example: <http://sam.roon.io>
#
# Don't translate anything that starts with `#`. That is just a comment for
# the translator!
en:
viewer:
# Button to allow the reader to comment on the current post on Twitter
@bogdanbeczkowski
bogdanbeczkowski / pl.yml
Last active December 21, 2015 18:49 — forked from soffes/en.yml
pl:
viewer:
comment_on_twitter: 'Skomentuj na Twitterze'
older: 'Starsze'
newer: 'Nowsze'
feed: 'Kanał'
share: 'Udostępnij'
close: 'Zamknij'
next_post: 'Następny wpis'
previous_post: 'Poprzedni wpis'
@bogdanbeczkowski
bogdanbeczkowski / gist:4477966
Created January 7, 2013 20:09
Pause and enter this in debugging console, creates a breakpoint
breakpoint set -n "-[UIImageView setFrame:]"