I can't figure out what is wrong, can someone help me?
coordinator = NSPersistentStoreCoordinator(managedObjectModel: model)
let store = coordinator.addPersistentStore(ofType: NSSQLiteStoreType, configurationName: nil, at: storeURL, options: nil) throws -> NSPersistentStore
It's saying:
expected type before ->
Just remove this final part from your addPersistentStore
method call:
throws -> NSPersistentStore
and ignore, for now, any exceptions thrown by this method (using a try!
before the method call), like this:
let store = try! coordinator.addPersistentStore(...
and you should be good :)
By the way, the return type (and throws
qualifier) are only needed on the method definition. They aren't necessary (or even allowed!) when calling a method.