Based on another thread, wrapping the modelContext.insert and modelContext.save in DispatchQueue.main.async fixed the issue.
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: