Skip to content

Commit 4aa3bb0

Browse files
authored
Preferred, Not Preferred Ordering Maintained
When example are given throughout the guide, it shows the preferred instance before the not preferred instance. However, in [unused code](https://github.com/raywenderlich/swift-style-guide#unused-code) this pattern is reversed, which may lead to confusion. For the sake of clarity and consistency, the Preferred section is now placed above the Not Preferred section, as is done throughout the rest of the style guide.
1 parent 48ef4b8 commit 4aa3bb0

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

README.markdown

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,13 @@ Unused (dead) code, including Xcode template code and placeholder comments shoul
219219

220220
Aspirational methods not directly associated with the tutorial whose implementation simply calls the superclass should also be removed. This includes any empty/unused UIApplicationDelegate methods.
221221

222+
**Preferred:**
223+
```swift
224+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
225+
return Database.contacts.count
226+
}
227+
```
228+
222229
**Not Preferred:**
223230
```swift
224231
override func didReceiveMemoryWarning() {
@@ -236,13 +243,6 @@ override func tableView(_ tableView: UITableView, numberOfRowsInSection section:
236243
return Database.contacts.count
237244
}
238245

239-
```
240-
241-
**Preferred:**
242-
```swift
243-
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
244-
return Database.contacts.count
245-
}
246246
```
247247
### Minimal Imports
248248

0 commit comments

Comments
 (0)