mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-01-11 20:00:30 +01:00
Exposing NSManagedObjectContext #54
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 @colinmorelli on GitHub (Apr 28, 2016).
Back again with another issue/question.
I see this has been asked before #9 and #33 - so I apologize in advance if you're already against this idea. However, I'm looking to create a transaction and get access to the internalContext that drives it. While I can use
beginUnsafe(), it forces my hand to use a queue with QOS of user initiated, which this is not.My use case is a background mapping operation. I use a library to map JSON into CoreData entities, and it uses a MOC to insert/update entities based on the JSON data. I'd be completely fine using
beginUnsafe()and manually ensuring thread safety myself for this case, if we could just expose the option to choose which queue to use (if you want, I think user initiated makes sense by default).@JohnEstropia commented on GitHub (Apr 28, 2016):
UnsafeDataTransactiondoesn't actually use the queue it gets from itsinit(...)method. You can see for yourself inUnsafeDataTransaction.swift:So you can actually just call
commitAndWait()freely from any queue you wish.@colinmorelli commented on GitHub (Apr 28, 2016):
Yep, now I feel really dumb. Should have looked deeper into it. Sorry about that.
@JohnEstropia commented on GitHub (Apr 28, 2016):
No problem! I should remove the queue in that init code though so people don't get confused.
If you have other questions feel free to ask anytime :)