Ok, this seemed to do it for me.
persistentContainer = NSPersistentContainer(name: "DataModel")
let description = persistentContainer.persistentStoreDescriptions.first
description?.setOption(true as NSNumber, forKey: NSPersistentHistoryTrackingKey)
persistentContainer.loadPersistentStores { description, error in
if let error = error {
fatalError("\(error)")
}
}
I have a different class for CloudKit but I presume I could combine them more than I have.
I finally found this answer.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: