title: Core Data ManagedObjectContext Notification Memory Address Changing
body: <p>I have am trying to observe for changes in an NSManagedObjectContext in one of my view controllers.</p>
  
  <pre><code>NotificationCenter.default.addObserver(self, selector: #selector(updateData), name: .NSManagedObjectContextObjectsDidChange, object: DataManager.shared.managedObjectContext)
  </code></pre>
  
  <p>Here is my core data setup:</p>
  
  <pre><code>class DataManager {
      static let shared = DataManager()
  
      lazy var persistentContainer: NSPersistentContainer = {
          let container = NSPersistentContainer(name: "Store")
          container.loadPersistentStores(completionHandler: { storeDescription, error in
              if let error = error as NSError? {
                  fatalError("Unresolved error \(error), \(error.userInfo)")
              }
          })
          return container
      }()
  
      lazy var managedObjectContext: NSManagedObjectContext = {
          let context = self.persistentContainer.viewContext
          context.automaticallyMergesChangesFromParent = true
          context.mergePolicy = NSMergeByPropertyStoreTrumpMergePolicy
          return context
      }()
  }
  </code></pre>
  
  <p>I get notifications sometimes, but other times I will not. If I set the object to nil I get the notifications as expected. If I print out the managedObjectContext when I add the observer and when the notification gets called (using the nil object in the notificationObserver), they are pointing at two different managedObjectContexts. Where am I going wrong? Is there some sort of race condition on initializing the context when setting up the observer for the first time?</p>