Skip to content

Commit a2ed880

Browse files
committed
ooops, add comment about crashing if we go out of existence still observed
1 parent 5b30db6 commit a2ed880

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bk1ch13p380kvo/ch13p355kvo/AppDelegate.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ class AppDelegate : UIResponder, UIApplicationDelegate {
4646
let opts : NSKeyValueObservingOptions = .New | .Old
4747
objectA.addObserver(objectB, forKeyPath: "value", options: opts, context: &con)
4848
(objectA as MyClass1).value = true
49-
// objectA.removeObserver(objectB, forKeyPath: "value")
49+
// comment out next line if you wish to crash
50+
objectA.removeObserver(objectB, forKeyPath: "value")
5051
objectA = nil
5152

5253
return true

0 commit comments

Comments
 (0)