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: README_CN.md
+10-4Lines changed: 10 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -241,9 +241,13 @@ it should be positioned with it.
241
241
242
242
_理由:_ 类型区分号是对于 _identifier_ 来说的,所以要跟它连在一起。
243
243
244
-
Also, when specifying the type of a dictionary, always put the colon immediately
245
-
after the key type, followed by a space and then the value type.
244
+
Also, when specifying the type of a dictionary, always put the colon immediately after the key type, followed by a space and then the value type.
246
245
246
+
此外,指定字典类型时,键类型后紧跟着冒号,接着加一个空格,之后才是值类型。
247
+
248
+
```swift
249
+
let capitals: [Country: City] = [ Sweden: Stockholm ]
250
+
```
247
251
248
252
249
253
#### Only explicitly refer to `self` when required
@@ -363,9 +367,9 @@ Classes should start as `final`, and only be changed to allow subclassing if a v
363
367
364
368
_Rationale:_ Composition is usually preferable to inheritance, and opting _in_ to inheritance hopefully means that more thought will be put into the decision.
365
369
366
-
`Classes`应该作为基类,只能被子类已识别正当的继承(and only be changed to allow subclassing if a valid need for inheritance has been identified.)。即使这种例子,根据同样的规则,类中的定义也要尽可能的用`final`标注上
_理由:_ 组合通常比继承更合适,而且不用 继承意味着考虑的更多(and opting in to inheritance hopefully means that more thought will be put into the decision.)。
372
+
_理由:_ 组合通常比继承更合适,选择使用继承则很可能意味着在做出决定时需要更多的思考。
369
373
370
374
#### Omit type parameters where possible
371
375
#### 能不写类型参数的就别写了
@@ -421,3 +425,5 @@ func <|< <A>(lhs: A, rhs: A) -> A
421
425
_Rationale:_ Operators consist of punctuation characters, which can make them difficult to read when immediately followed by the punctuation for a type or value parameter list. Adding whitespace separates the two more clearly.
0 commit comments