Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Have tvOS CoreDataModel init's storeType default to CachesDirectory URL #61

Closed
cgoldsby opened this issue Mar 3, 2016 · 2 comments
Closed
Assignees
Milestone

Comments

@cgoldsby
Copy link
Contributor

cgoldsby commented Mar 3, 2016

CoreDataModel init method storeType defaults to a SQLite DB using the Documents Directory URL: storeType: StoreType = .SQLite(DocumentsDirectoryURL())

On tvOS, the Document Directory is not available and it would be a nice enhancement to have the init method default to the Caches Directory.

A proposal would be to refactor DocumentsDirectoryURL() to DirectoryURL() and add an availability check when creating the directory URL:

var searchPathDirectory = .DocumentDirectory
#if os(tvOS)
    searchPathDirectory = .CachesDirectory
#endif
return try NSFileManager.defaultManager().URLForDirectory(searchPathDirectory, ...)
@jessesquires jessesquires self-assigned this Mar 3, 2016
@jessesquires jessesquires added this to the 2.2.1 milestone Mar 3, 2016
@jessesquires
Copy link
Owner

Hey @cgoldsby ! 😄

Sounds like a great idea. Would you like to submit a pull request?

If so, let's call it DefaultDirectoryURL().

@cgoldsby
Copy link
Contributor Author

cgoldsby commented Mar 3, 2016

Will do.

# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants