I have added all of the relevant code to the App Delegate, and I am able to add to the data model and fetch from the data model in applicationDidFinishLaunchingWithOptions.<
In my case the .xcdatamodeld was mislabeled in the AppDelegate:
.xcdatamodeld
let container = NSPersistentContainer(name: "name of data model")