You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/mulle-objc/mulle-objc-styleguide/share/howto/objc-styleguide.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -96,8 +96,12 @@ these rules to maintain code consistency and readability.
96
96
97
97
- Do not use `-retain` or `copy` or `-release` or `autorelease` (exception: inside `-init` and `-dealloc` and "accessor" methods)
98
98
- Do not use `+alloc``-init` use `+instance` or an appropriate factory method like `-[NSMutableArray array]`
99
+
- arrange method arguments columnar fashion. Do not write [dosbox setObject:@"vgaonly" forKey:@"machine"] in a single line but in two lines, where the selector ':' match up in the same column.
99
100
100
-
### 4.2. Property Access
101
+
102
+
### 4.2. Properties
103
+
104
+
- Just declare the @property in the @interface, skip instance variable declaration, do not @synthesize, do not manage in -dealloc. This is all done automatically and properly
101
105
- Do not use dot-syntax for property access.
102
106
- Prefer non-mutable state in properties, prefer `(copy)` over `(retain)` when possible
103
107
- Do not use strong use retain or copy instead
@@ -106,8 +110,14 @@ these rules to maintain code consistency and readability.
106
110
-**Read:**`[self property]` instead of `self.property`.
107
111
-**Write:**`[self setProperty:value]` instead of `self.property = value`.
108
112
113
+
### 4.3 Employ Factory style object creation
114
+
115
+
- prefer [Foo instance] instead of [[Foo new] autorelease] or [[[Foo alloc] init] autorelease]
116
+
- prefer [[Foo instantiate] initWith...] when a factory method is unavailable
117
+
109
118
110
119
## Tip:
111
120
112
121
NSString, NSArray and most other Foundation classes are not available
113
-
with mulle-objc/objc-developer, you want foundation/objc-developer for that.
122
+
with mulle-sde project mulle-objc/objc-developer, you need mulle-sde project
0 commit comments