mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
DataStack.addStorage ambiguity #321
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @iby on GitHub (Mar 20, 2020).
There are two methods for adding storage, this and this – both seem to be doing the exact same thing, but the latter returns a progress object.
However, when I'm calling it in my code, by default the compiler picks the second one and reports a warning about the unused invocation result (progress). When I tell the compiler to use the other one (via
stack.addStorage(store, completion: { _ in }) as Void) I getNSPersistentStoreCoordinatorexception:However, the method that returns the progress object works as expected. Can you elaborate if there's any difference between them or am I missing something?
@JohnEstropia commented on GitHub (Mar 21, 2020):
I am assuming that you are using an
SQLiteStorage, in which case the second one is the correct overload. The first one is meant for use for custom implementers ofStorageType.@iby commented on GitHub (Mar 21, 2020):
Good point, totally missed that. Not as critical, but perhaps it's worth to check inside the custom
StorageTypeoverload if the storage isLocalStorageand revert to the other method if so. If it gets invoked with erasedLocalStoragestorage type this would result in the same crash, wouldn't it?