RedMadRobot / DAO

MIT License
74 stars 25 forks source link

CoreData fetch method should be in performAndWait #11

Closed Hardenn closed 6 years ago

Hardenn commented 6 years ago

Source link

open override func read(_ entityId: String) -> Model? {
        guard let entries = try? context.fetch(request(entityId)),
            !entries.isEmpty,
            let entry = entries.first
        else {
            return nil
        }
        ...
        return entity
    }

try? context.fetch(request(entityId)) should be wrapped into context.performAndWait.