I am following the Build a Mobile App With Sync tutorial MongoDB provides but running into an error when configuring the sync on a particular collection. This is my code:
todoCollection.sync.configure(
conflictHandler: DefaultConflictHandlers.remoteWins.resolveConflict,
changeEventDelegate: { documentId, event in
if !event.hasUncommittedWrites {
// you can add code here to update your app's UI or
// perform other operations based on a document change.
}
}, errorListener: self.on)
These are my imports:
import MongoSwift
import StitchCore
import StitchRemoteMongoDBService
And for clarity's sake, here is the error:
I have some theories, like a separate import required or my XCode indexing is just broken, but no success so far.
Edit: I am using pod 'StitchSDK', '~> 5.0.0'
I have installed that pod and found you need to add
import StitchCoreRemoteMongoDBService
And DefaultConflictHandlers
is renamed with DefaultConflictHandler
So after importing your code will be:
todoCollection.sync.configure(
conflictHandler: DefaultConflictHandler.remoteWins.resolveConflict,
changeEventDelegate: { documentId, event in
if !event.hasUncommittedWrites {
// you can add code here to update your app's UI or
// perform other operations based on a document change.
}
}, errorListener: self.on)