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.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ SwiftObserver is just about 1200 lines of production code, but it also approache
22
22
*[Introduction](#introduction)
23
23
*[Memory Management](#memory-management)
24
24
*[Variables](#variables)
25
-
*[Set Variable Values](#set-variable-values)
25
+
*[Use Variable Values](#use-variable-values)
26
26
*[Observe Variables](#observe-variables)
27
27
*[Variables are Codable](#variables-are-codable)
28
28
*[Mappings](#mappings)
@@ -177,7 +177,7 @@ The three above mentioned functions are all you need for safe memory management.
177
177
178
178
A `Var<Value>` has a property `value: Value`. If `Value` conforms to `Equatable` or `Comparable`, the whole `Var<Value>` will also conform to the respective protocol.
179
179
180
-
## Set Variable Values
180
+
## Use Variable Values
181
181
182
182
You can set `value` directly, via initializer and via the `<-` operator:
183
183
@@ -199,15 +199,15 @@ If `Value` is either `Int`, `Float` or `Double`:
199
199
3.```swift
200
200
let numVar = Var<Int?>() // numVar.value == nil
201
201
print(numVar.int) // 0
202
-
numVar<-Var(3) +2// numVar.value == 5
203
-
numVar.int+=5// numVar.value == 10
202
+
numVar.int+=5// numVar.value == 5
203
+
numVar<-Var(1) +2// numVar.value == 3
204
204
```
205
205
206
206
### String Values
207
207
208
208
1. Every `Var<String>`, `Var<String?>`, `Var<String>?` and `Var<String?>?` has a `var string: String` which is non-optional and interprets `nil` values as `""`.
209
209
2. Representing its `string` property, every `Var<String>` and `Var<String?>` conforms to `BidirectionalCollection`, `Collection` and `Sequence`.
210
-
3. You can apply concatenation operators `+` and `+=` to all pairs of `String`, `String?`, `Var<String>`, `Var<String?>`, `Var<String>?` and `Var<String?>?`.
210
+
3. You can apply concatenation operator `+` to all pairs of `String`, `String?`, `Var<String>`, `Var<String?>`, `Var<String>?` and `Var<String?>?`.
0 commit comments