mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-26 11:21:32 +01:00
Prevent retain cycles in NSManagedObjectContext (fixes #87)
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>2.0.3</string>
|
<string>2.0.4</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
@@ -32,14 +32,10 @@ internal final class NotificationObserver {
|
|||||||
|
|
||||||
// MARK: Public
|
// MARK: Public
|
||||||
|
|
||||||
let notificationName: String
|
|
||||||
let object: AnyObject?
|
|
||||||
let observer: NSObjectProtocol
|
let observer: NSObjectProtocol
|
||||||
|
|
||||||
init(notificationName: String, object: AnyObject?, queue: NSOperationQueue? = nil, closure: (note: NSNotification) -> Void) {
|
init(notificationName: String, object: AnyObject?, queue: NSOperationQueue? = nil, closure: (note: NSNotification) -> Void) {
|
||||||
|
|
||||||
self.notificationName = notificationName
|
|
||||||
self.object = object
|
|
||||||
self.observer = NSNotificationCenter.defaultCenter().addObserverForName(
|
self.observer = NSNotificationCenter.defaultCenter().addObserverForName(
|
||||||
notificationName,
|
notificationName,
|
||||||
object: object,
|
object: object,
|
||||||
@@ -50,10 +46,6 @@ internal final class NotificationObserver {
|
|||||||
|
|
||||||
deinit {
|
deinit {
|
||||||
|
|
||||||
NSNotificationCenter.defaultCenter().removeObserver(
|
NSNotificationCenter.defaultCenter().removeObserver(self.observer)
|
||||||
self.observer,
|
|
||||||
name: self.notificationName,
|
|
||||||
object: self.object
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user