mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-12 04:10:36 +01:00
Cannot create an SQL store with a nil URL #275
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 @seanliu1 on GitHub (May 29, 2019).
This is my interface looks like
I want to do dependency injection, then for test, I can provide in-memory storage, in production app I can use local storage.
However I start to see once I change it to that way
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot create an SQL store with a nil URL.
It looks like we always pass nil to finalURL if it comes from StorageInterface, should we have factory method based on input type to determine which constructor to use?
@JohnEstropia commented on GitHub (May 29, 2019):
Use
<T: LocalStorage>instead of<T: StorageInterface>@seanliu1 commented on GitHub (May 29, 2019):
how to pass InMemoryStore if we wanna to use in memory storage for unit test, since InMemoryStore does not conform to LocalStorage. Both LocalStore and InMemoryStore conforms to StorageInterface.
@JohnEstropia commented on GitHub (May 29, 2019):
I see. If you need both then you need to implement the overloads for both.