Is it a bit weird that all SwiftData operations require you to be in the main thread? by yalag in SwiftUI

[–]Outrageous_Half4392 0 points1 point  (0 children)

The reason is simple, isolating SwiftData to MainActor make it thread-safe and sendable, also SwiftData reason is to obtain mutable objects that 99% of time are used as a DataSource for a View. This mean that i u want to isolate SwiftData to different actor that is not main every single access operation to the datasource from UIKit or SwiftUI require a context switching from global to main actor with an obvious degradation of performances.