|
DispatchQueue.global(qos: .background).sync { |
I would recommend never using sync here. It is just asking for pain down the road.
This should be async and the UI must wait for the persistence layer to be ready. Normally this is < 100ms and not noticeable by the UI. But when a merge or some other long task runs the UI must be able to handle it. Plan for it and when it happens it is not an issue. Don't plan for it and you are asking for a re-write in the future.
CoreDataSafeExample/CoreDataSafeExample/Data/CoreDataSafe.swift
Line 116 in 8ad04e0
I would recommend never using sync here. It is just asking for pain down the road.
This should be async and the UI must wait for the persistence layer to be ready. Normally this is < 100ms and not noticeable by the UI. But when a merge or some other long task runs the UI must be able to handle it. Plan for it and when it happens it is not an issue. Don't plan for it and you are asking for a re-write in the future.