Core Data Outside Perform (ARCH9043)
هذا المحتوى غير متوفر بلغتك بعد.
Key swift.async.core-data-outside-perform · Severity warning · Category async
Flags managed object context fetch / save called from an async function outside context.perform { }.
Incorrect
Section titled “Incorrect”func load() async throws { let rows = try context.fetch(request) }Correct
Section titled “Correct”func load() async throws { let rows = try await context.perform { try self.context.fetch(request) } }Wrap context access in await context.perform { } - contexts are bound to their queue.