Post

Replies

Boosts

Views

Activity

Model Container Sendable Throwing Error in Swift 6
Hi all, I just wanted to ask how people were using ModelActor with the Swift 6 language mode enabled. My current implementation involves passing the ModelContainer to my ModelActor, which worked in Sonoma and previous betas of Sequoia, however in the current Beta 3, I get this error: "Sending 'self.modelContext.container' risks causing data races" I am a bit confused by this, as from what I understand, ModelContainer conforms to Sendable, so ideally this error should not be thrown. Is this a bug in Beta 3? Thanks in advance.
3
1
1.1k
Jul ’24
MapKit mapItemDetailAccessory Custom View
Hi all, It wasn't extensively covered in the "Unlock the power of places with MapKit" at WWDC, but is it possible to add your own views to the mapItemDetailAccessory? The default view is great, but I would like to add a button for opening a new window showing another view. The documentation is rather limited at the moment so I thought I would ask here. Thanks in advance.
0
0
381
Jun ’24
ModelActor Implementation Changes In Xcode 15 Beta 7
Hi all, There appears to be some changes to how ModelActors are implemented in Beta 7 of Xcode 15. In Beta 6, we had the DefaultModelExecutor object which we used to assign to the ModelActor's executor property. A simple example is shown below: final actor SimpleModelActor: ModelActor { let executor: any ModelExecutor init(modelContainer: ModelContainer) { let modelContext = ModelContext(modelContainer) executor = DefaultModelExecutor(context: modelContext) } func addItem() { let newItem = Item(timestamp: Date()) context.insert(newItem) try! context.save() } .... } However, it seems that the DefaultModelExecutor class has been removed for Beta 7, without any real replacement. Anyone know how to implement a ModelActor in the new beta? Thanks in advance.
2
0
1.5k
Aug ’23
Xcode 15 Beta 6: App Runs With High CPU Usage
Hi all, I am creating a Mac application leveraging SwiftUI for the views and SwiftData for the persistent storage. Now, I have seen others have issues with high CPU usage in Xcode 15 Beta 5, and I seem to be encountering the same issue in Beta 6. Contrary to many though, I did not observe high CPU use in Beta 5. I have already done my best to resolve the issue, most notably refining my Models' properties to not use default values, etc, but I am still seeing CPU usage at 100%. Any idea on where I can look to further optimise my application? Massive thanks in advance.
1
0
1.4k
Aug ’23