Skip to content

Commit 715f828

Browse files
committed
Minor spacing and style related updates
Update NSString to String Remove extraneous "() -> () in" after closure brace Add "-" after "// Mark:" which will add a line in the method list dropdown Added single space after "//"
1 parent a7fab15 commit 715f828

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.markdown

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ class app_widgetContainer {
6060
For functions and init methods, prefer named parameters for all arguments unless the context is very clear. Include external parameter names if it makes function calls more readable.
6161

6262
```swift
63-
func dateFromString(dateString: NSString) -> NSDate
63+
func dateFromString(dateString: String) -> NSDate
6464
func convertPointAt(#column: Int, #row: Int) -> CGPoint
6565
func timedAction(#delay: NSTimeInterval, perform action: SKAction) -> SKAction!
6666

@@ -123,20 +123,20 @@ If you need to expose a Swift type for use within Objective-C you can provide a
123123
**Preferred:**
124124
```swift
125125
if user.isHappy {
126-
//Do something
126+
// Do something
127127
} else {
128-
//Do something else
128+
// Do something else
129129
}
130130
```
131131

132132
**Not Preferred:**
133133
```swift
134134
if user.isHappy
135135
{
136-
//Do something
136+
// Do something
137137
}
138138
else {
139-
//Do something else
139+
// Do something else
140140
}
141141
```
142142

@@ -218,11 +218,11 @@ Use `self` when required to differentiate between property names and arguments i
218218
class BoardLocation {
219219
let row: Int, column: Int
220220

221-
init(row: Int,column: Int) {
221+
init(row: Int, column: Int) {
222222
self.row = row
223223
self.column = column
224224

225-
let closure = { () -> () in
225+
let closure = {
226226
println(self.row)
227227
}
228228
}
@@ -233,7 +233,7 @@ class BoardLocation {
233233

234234
When adding protocol conformance to a class, prefer adding a separate class extension for the protocol methods. This keeps the related methods grouped together with the protocol and can simplify instructions to add a protocol to a class with its associated methods.
235235

236-
Also, don't forget the `// MARK` comment to keep things well-organized!
236+
Also, don't forget the `// MARK: -` comment to keep things well-organized!
237237

238238
**Preferred:**
239239
```swift
@@ -324,14 +324,14 @@ Always use Swift's native types when available. Swift offers bridging to Objecti
324324

325325
**Preferred:**
326326
```swift
327-
let width = 120.0 //Double
328-
let widthString = (width as NSNumber).stringValue //String
327+
let width = 120.0 // Double
328+
let widthString = (width as NSNumber).stringValue // String
329329
```
330330

331331
**Not Preferred:**
332332
```swift
333-
let width: NSNumber = 120.0 //NSNumber
334-
let widthString: NSString = width.stringValue //NSString
333+
let width: NSNumber = 120.0 // NSNumber
334+
let widthString: NSString = width.stringValue // NSString
335335
```
336336

337337
In Sprite Kit code, use `CGFloat` if it makes the code more succinct by avoiding too many conversions.

0 commit comments

Comments
 (0)