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
2.[**Non-intrusive Design**](https://github.com/codeface-io/SwiftObserver/blob/master/Documentation/philosophy.md#non-intrusive-design) ✊🏻<br>SwiftObserver doesn't limit or modulate your design. It just makes it easy to do the right thing.
11
11
3.[**Simplicity**](https://github.com/codeface-io/SwiftObserver/blob/master/Documentation/philosophy.md#simplicity-and-flexibility) 🕹<br>SwiftObserver employs few radically simple concepts and applies them consistently without exceptions.
12
12
4.[**Flexibility**](https://github.com/codeface-io/SwiftObserver/blob/master/Documentation/philosophy.md#simplicity-and-flexibility) 🤸🏻♀️<br>SwiftObserver's types are simple but universal and composable, making them applicable in many situations.
13
-
5.[**Safety**](https://github.com/codeface-io/SwiftObserver/blob/master/Documentation/philosophy.md#safety) ⛑<br>SwiftObserver makes those memory leaks impossible that typically come with observer-/reactive patterns.
13
+
5.[**Safety**](https://github.com/codeface-io/SwiftObserver/blob/master/Documentation/philosophy.md#safety) ⛑<br>SwiftObserver eradicates those memory leaks that typically come with observer- and reactive patterns.
14
14
15
15
SwiftObserver is only 1400 lines of production code, but it's well beyond a 1000 hours of work, re-imagining and reworking it many times, [letting go of fancy features](https://github.com/codeface-io/SwiftObserver/releases), documenting, [unit-testing](https://github.com/codeface-io/SwiftObserver/tree/master/Tests/SwiftObserverTests), and battle-testing it in practice.
16
16
@@ -143,7 +143,7 @@ class Sky: ObservableObject {
143
143
144
144
### Memory Management
145
145
146
-
When an `Observer` or `ObservableObject` dies, SwiftObserver cleans up all related observations automatically, making those memory leaks impossible that typically come with observer- and reactive patterns. So there isn't any specific memory management to worry about – no "Cancellables", "Tokens", "DisposeBags" or any such weirdness.
146
+
When an `Observer` or `ObservableObject` dies, SwiftObserver cleans up all related observations automatically, making those memory leaks impossible that typically come with observer- and reactive patterns. So there's no specific memory management to worry about – and no "Cancellables", "Tokens", "DisposeBags" or any such weirdness.
147
147
148
148
However, observing- and observed objects can stop particular- or all their ongoing observations:
149
149
@@ -156,7 +156,7 @@ Sky.shared.stopBeingObserved() // no more messages to anywhere
156
156
157
157
### Architecture
158
158
159
-
Have a look at the codebase with its essential internal dependencies:
159
+
Have a look at the internal codebase (compositions and essential dependencies) of the "SwiftObserver" target:
160
160
161
161

162
162
@@ -189,7 +189,7 @@ public protocol ObservableObject: class {
189
189
}
190
190
```
191
191
192
-
`Messenger` is itself `ObservableObject` because it points to itself as the required `Messenger`:
192
+
`Messenger` is itself an `ObservableObject` because it points to itself as the required `Messenger`:
193
193
194
194
```swift
195
195
extensionMessenger: ObservableObject {
@@ -390,9 +390,7 @@ dog.observe(Sky.shared).map {
390
390
391
391
## Interoperate With Combine
392
392
393
-
SwiftObserver is for pure Swift-/model code without any dependencies – not even on Combine. When combined with Combine (oops), SwiftObserver would be employed in the model core of an application, while Combine would be used more with I/O periphery like SwiftUI and other system-specific APIs that already rely on Combine. That means, the "Combine layer" should be able to observe the "SwiftObserver layer" – but hardly the other way around.
394
-
395
-
CombineObserver is a library contained in the SwiftObserver package. It depends on SwiftObserver and adds a simple way to transform SwiftObserver's `ObservableObject` into Combine's `Publisher`:
393
+
**CombineObserver** is a library contained in the SwiftObserver package. It depends on SwiftObserver and adds a simple way to transform any SwiftObserver- `ObservableObject` into a Combine-`Publisher`:
396
394
397
395
```swift
398
396
importCombineObserver
@@ -407,9 +405,11 @@ let cancellable = numberPublisher.dropFirst().sink { numberUpdate in
407
405
number =42// prints "42"
408
406
```
409
407
408
+
Some reasoning behind this: SwiftObserver is for pure Swift-/model code without external dependencies – not even on Combine. When combined with Combine (🙊), SwiftObserver would be employed in the model core of an application, while Combine would be used more with I/O periphery like SwiftUI and other system-specific APIs that already rely on Combine. That means, the "Combine layer" might want to observe (react to-) the "SwiftObserver layer" – but hardly the other way around.
409
+
410
410
## Message Authors
411
411
412
-
Every message has an author associated with it. This feature is only noticable in code if we use it.
412
+
Every message has an author associated with it. This feature is only noticable in code if you use it.
413
413
414
414
An observable object can send an author together with a message via `object.send(message, from: author)`. If noone specifies an author as in `object.send(message)`, the observable object itself becomes the author.
415
415
@@ -559,9 +559,12 @@ Of course, `weak()` wouldn't make sense as an adhoc transform, so it can only cr
559
559
* Update and rework (or simply delete) texts about philosophy and patterns
0 commit comments