Post

Replies

Boosts

Views

Activity

Reply to Importing Data into SwiftData in the Background Using ModelActor and @Query
Yes, it seems something was fixed (using Beta 6 and Xcode 16 b5). In my case I could get rid of the previous workaround with Notification Center and I can see the changes reflecting in the views. However there are definitely new problems with saving models - in some cases it appears a model's @Relationship is not saved. Will try to recreate this in a test project. In the meantime, @DTS Engineer - any comments on the new changes? PS. it is really quite frustrating that there is no mention of SwiftData issues in any of the Release Notes although changes are evidently being made
Aug ’24
Reply to SwiftData Update Item View from Background Thread
Quick question, are you on iOS 18? Did it work in iOS 17? I'm trying to figure out a similar issue that worked in iOS 17, but doesn't work in iOS 18 Beta 1 and Beta 2 (just updated today). In a nutshell I have a parent and child view as part of a NavigationSplitView. A parent view has a @Query for items, the item is passed to the child view, like in your case. In the child there is a method that performs an async task, which updates the item in the background using @ModelActor This update was immediately refrelcted in the child view on iOS 17 but is not reflected in iOS 18. Only if I navigate to parent view and then re-open child I can see the changes.
Jun ’24
Reply to Enabling undo with multi-model schema
Trying to figure out if this is possible for a sharedModelContainer. When creating a new empty multiplatform app with SwiftData, this code is automatically generated in the App.swift: import SwiftUI import SwiftData @main struct SwiftDataTestApp: App { var sharedModelContainer: ModelContainer = { let schema = Schema([ Item.self, ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() var body: some Scene { WindowGroup { ContentView() } .modelContainer(sharedModelContainer) } } Is there a way to set isUndoEnabled in this scenario? Doesn't look like ModelContainer(for: Schema...) supports it?
Dec ’23
Reply to Importing Data into SwiftData in the Background Using ModelActor and @Query
Yes, it seems something was fixed (using Beta 6 and Xcode 16 b5). In my case I could get rid of the previous workaround with Notification Center and I can see the changes reflecting in the views. However there are definitely new problems with saving models - in some cases it appears a model's @Relationship is not saved. Will try to recreate this in a test project. In the meantime, @DTS Engineer - any comments on the new changes? PS. it is really quite frustrating that there is no mention of SwiftData issues in any of the Release Notes although changes are evidently being made
Replies
Boosts
Views
Activity
Aug ’24
Reply to Importing Data into SwiftData in the Background Using ModelActor and @Query
This workaround worked for me, thanks @DTS Engineer 👍
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftData Update Item View from Background Thread
Beta 4, still broken
Replies
Boosts
Views
Activity
Jul ’24
Reply to SwiftData fatal error "Never access a full future backing data"
Also getting this quite often when deleting a model
Topic: UI Frameworks SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to SwiftData Update Item View from Background Thread
Quick question, are you on iOS 18? Did it work in iOS 17? I'm trying to figure out a similar issue that worked in iOS 17, but doesn't work in iOS 18 Beta 1 and Beta 2 (just updated today). In a nutshell I have a parent and child view as part of a NavigationSplitView. A parent view has a @Query for items, the item is passed to the child view, like in your case. In the child there is a method that performs an async task, which updates the item in the background using @ModelActor This update was immediately refrelcted in the child view on iOS 17 but is not reflected in iOS 18. Only if I navigate to parent view and then re-open child I can see the changes.
Replies
Boosts
Views
Activity
Jun ’24
Reply to Enabling undo with multi-model schema
Trying to figure out if this is possible for a sharedModelContainer. When creating a new empty multiplatform app with SwiftData, this code is automatically generated in the App.swift: import SwiftUI import SwiftData @main struct SwiftDataTestApp: App { var sharedModelContainer: ModelContainer = { let schema = Schema([ Item.self, ]) let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false) do { return try ModelContainer(for: schema, configurations: [modelConfiguration]) } catch { fatalError("Could not create ModelContainer: \(error)") } }() var body: some Scene { WindowGroup { ContentView() } .modelContainer(sharedModelContainer) } } Is there a way to set isUndoEnabled in this scenario? Doesn't look like ModelContainer(for: Schema...) supports it?
Replies
Boosts
Views
Activity
Dec ’23
Reply to Xcode 15.1 & iOS 17.2: SwiftData ModelContext Delete: It's only possible to delete the data after it has been inserted for about 30 seconds
In your addSamples try explicitly saving context after inserting models: try? modelContext.save(), this should allow deleting immediately.
Topic: Programming Languages SubTopic: Swift Tags:
Replies
Boosts
Views
Activity
Dec ’23
Reply to Embedding a NavigationStack within the detail view of a NavigationSplitView
Here is an example, the toolbar items appear with delay in detail view.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Embedding a NavigationStack within the detail view of a NavigationSplitView
Experiencing the same on iOS 17.2 beta 3, the delay with which .toolbar appears is very noticeable
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Nov ’23
Reply to Convert Chrome/Firefox Extension to Safari
I found that Unable to parse manifest.json at file is thrown if manifest_version is not 2 Latest Chrome extensions use manifest version 3 and looks like Xcode can't handle it.
Topic: Safari & Web SubTopic: General Tags:
Replies
Boosts
Views
Activity
May ’21