mirror of
https://github.com/JohnEstropia/CoreStore.git
synced 2026-03-25 02:41:24 +01:00
check correct queue for managed object value access
This commit is contained in:
@@ -31,12 +31,29 @@ import CoreData
|
||||
|
||||
internal extension NSManagedObject {
|
||||
|
||||
@nonobjc
|
||||
internal func isRunningInAllowedQueue() -> Bool? {
|
||||
|
||||
guard let context = self.managedObjectContext else {
|
||||
|
||||
return nil
|
||||
}
|
||||
if context.isTransactionContext {
|
||||
|
||||
return context.parentTransaction?.isRunningInAllowedQueue()
|
||||
}
|
||||
if context.isDataStackContext {
|
||||
|
||||
return Thread.isMainThread
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// TODO: test before release (rolled back)
|
||||
// @nonobjc
|
||||
// internal static func cs_swizzleMethodsForLogging() {
|
||||
//
|
||||
//
|
||||
// struct Static {
|
||||
//
|
||||
//
|
||||
// static let isSwizzled = Static.swizzle()
|
||||
//
|
||||
// private static func swizzle() -> Bool {
|
||||
|
||||
Reference in New Issue
Block a user