From 5559f4662573838d4689e4a674461d4238f6a7e0 Mon Sep 17 00:00:00 2001 From: Danny Greg Date: Mon, 11 Feb 2013 13:16:58 +0000 Subject: [PATCH 1/4] First pass at the C99 preference. --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index 8153e05..eef22a2 100644 --- a/README.md +++ b/README.md @@ -67,6 +67,16 @@ void GHAwesomeFunction(BOOL hasSomeArgs); * Constructors should generally return `instancetype` rather than `id`. + * Prefer C99 struct initialiser syntax to helper functions. + + ```objc + CGRect rect = { .origin.x = 3.0, .origin.y = 12.0, .size.width = 15.0, size.height = 80.0 }; + + // rather than + + NSRect rect = CGRectMake(3.0, 12.0, 15.0, 80.0); + ``` + ## Expressions * Don't access an ivar unless you're in `-init` or `-dealloc`. From da9072d338d4be05aaf4ce1fd2ebe229bbd46297 Mon Sep 17 00:00:00 2001 From: Danny Greg Date: Mon, 11 Feb 2013 13:25:31 +0000 Subject: [PATCH 2/4] Fix a couple of typos. --- README.md | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index eef22a2..2677525 100644 --- a/README.md +++ b/README.md @@ -66,16 +66,15 @@ void GHAwesomeFunction(BOOL hasSomeArgs); ``` * Constructors should generally return `instancetype` rather than `id`. - * Prefer C99 struct initialiser syntax to helper functions. - ```objc - CGRect rect = { .origin.x = 3.0, .origin.y = 12.0, .size.width = 15.0, size.height = 80.0 }; - - // rather than - - NSRect rect = CGRectMake(3.0, 12.0, 15.0, 80.0); - ``` +```objc +CGRect rect = { .origin.x = 3.0, .origin.y = 12.0, .size.width = 15.0, .size.height = 80.0 }; + +// rather than + +NSRect rect = CGRectMake(3.0, 12.0, 15.0, 80.0); +``` ## Expressions From 709441ff15f799c436a563abd7cc3501548be8f2 Mon Sep 17 00:00:00 2001 From: Danny Greg Date: Mon, 11 Feb 2013 14:34:18 +0000 Subject: [PATCH 3/4] It's a CGRect, not an NSRect. Been doing too much AppKit recently it seems. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2677525..b309921 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ CGRect rect = { .origin.x = 3.0, .origin.y = 12.0, .size.width = 15.0, .size.hei // rather than -NSRect rect = CGRectMake(3.0, 12.0, 15.0, 80.0); +CGRect rect = CGRectMake(3.0, 12.0, 15.0, 80.0); ``` ## Expressions From b01496155f07c20d868c4b0574177d3921f2a53d Mon Sep 17 00:00:00 2001 From: Danny Greg Date: Tue, 12 Feb 2013 12:59:27 +0000 Subject: [PATCH 4/4] Don't have CGRectMake in the example. --- README.md | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index b309921..25119df 100644 --- a/README.md +++ b/README.md @@ -66,15 +66,11 @@ void GHAwesomeFunction(BOOL hasSomeArgs); ``` * Constructors should generally return `instancetype` rather than `id`. - * Prefer C99 struct initialiser syntax to helper functions. + * Prefer C99 struct initialiser syntax to helper functions (such as `CGRectMake()`). ```objc -CGRect rect = { .origin.x = 3.0, .origin.y = 12.0, .size.width = 15.0, .size.height = 80.0 }; - -// rather than - -CGRect rect = CGRectMake(3.0, 12.0, 15.0, 80.0); -``` + CGRect rect = { .origin.x = 3.0, .origin.y = 12.0, .size.width = 15.0, size.height = 80.0 }; + ``` ## Expressions