Skip to content

Commit 492d117

Browse files
authored
Update chapter1-introduction.md
1 parent 354fe71 commit 492d117

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

document/chapter1-introduction.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ To simplify the code, they are not recommended to be imported.
123123
viewModel.title ~> titleLabel.rx.text
124124
```
125125

126+
For some situations, the `self` keyword cannot be omitted.
127+
For example, when the properties are used with in a clousre, the `self` property should be captured with `[unowned self]` or `[weak self]` to avoid memoery leak.
128+
If there are too many `self` keywoard within our code, it is difficult for us to concentrate on those situations we need pay attention to.
129+
For this reason, unnecessary `self` keywords are recommended to be omitted.
130+
126131
- Omit `class`, `struct` and `enum` keyword if possible.
127132

128133
```swift

0 commit comments

Comments
 (0)