It looks like it is possible to use the underlying core data persistent store option to vacuum the database
https://developer.apple.com/documentation/coredata/nssqlitemanualvacuumoption
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: