Hi,
i am working on a little app with Realm and trying to figure out, why there is no notification for deletion, when observing a single object with a Publisher.
func subscribe(primaryKey key: String, completion: @escaping ((Result<LocationModel, LocationError>) -> Void)) {
guard let location: DBLocationModel = self.realmService.fetch(id: key) else {
return completion(.failure(.noLocation))
}
self.subscribeBy = RealmSwift.changesetPublisher(location)
.receive(on: DispatchQueue.main)
.sink(receiveValue: { response in
switch response {
case .change(let location, _): completion(.success(self.locationWrapper.map(location)))
case .deleted: print("go back to rootview, but nothing is happening :(")
case .error: completion(.failure(.noLocation))
}
})
}
if i am changing the object, it is working well and updating. but if i am deleting this object out of the database, there is no action.
anyone got the same thing and figured out why?