@@ -65,7 +65,7 @@ This not only works for `@ObservedObject` decorated Variables in a SwiftUI `View
6565First, you would define a Protocol describing the Methods implemented in your * Observer* Class Type that your * Observable* Class can invoke:
6666``` swift
6767/// Protocol defining what Methods the Obverable Class can invoke on any Observer
68- protocol DummyObserver : AnyObject { // It's extremely important that this Protocol be constrained to AnyObject
68+ protocol DummyObservable : AnyObject { // It's extremely important that this Protocol be constrained to AnyObject
6969 func onFooChanged (oldValue : String , newValue : String )
7070 func onBarChanged (oldValue : String , newValue : String )
7171}
@@ -83,7 +83,7 @@ class Dummy: ObservableClass {
8383 }
8484 set {
8585 // Invoke onFooChanged for all current Observers
86- withObservers { (observer : DummyObserver ) in
86+ withObservers { (observer : DummyObservable ) in
8787 observer.onFooChanged (oldValue : _foo, newValue : newValue)
8888 }
8989 _foo = newValue
@@ -98,7 +98,7 @@ class Dummy: ObservableClass {
9898 }
9999 set {
100100 // Invoke onBarChanged for all current Observers
101- withObservers { (observer : DummyObserver ) in
101+ withObservers { (observer : DummyObservable ) in
102102 observer.onBarChanged (oldValue : _bar, newValue : newValue)
103103 }
104104 _bar = newValue
@@ -108,10 +108,10 @@ class Dummy: ObservableClass {
108108}
109109```
110110
111- We can now define an * Observer* to register with the * Observable* , ensuring that we specify that it implements our ` DummyObserver ` protocol:
111+ We can now define an * Observer* to register with the * Observable* , ensuring that we specify that it implements our ` DummyObservable ` protocol:
112112``` swift
113- class DummyObserver : DummyObserver {
114- /* Implementations for DummyObserver */
113+ class DummyObserver : DummyObservable {
114+ /* Implementations for DummyObservable */
115115 func onFooChanged (oldValue : String , newValue : String ) {
116116 print (" Foo Changed from \( oldValue ) to \( newValue ) " )
117117 }
0 commit comments