Post

Replies

Boosts

Views

Activity

Comment on NSViewRepresentable updates triggered by .onChange ignore SwiftUI Transactions on macOS
I tested on macOS 27b1 and the issue still exists, that is no animation. Furthermore, none of my workarounds including your suggestion work anymore, even on macOS 26.5.1. While this animates perfectly fine on iOS: func updateUIView(_ uiView: UIView, context: Context) { let targetColor = toggle ? UIColor.red : UIColor.blue context.animate { uiView.backgroundColor = targetColor } } FB22270146
Topic: SwiftUI SubTopic:
SwiftUI Q&A
Jun ’26
Comment on How to Sandbox SwiftData Edits in .sheet
Maybe a better id would be var id: EditorConfig { self }. Actually what would be real nice is to remove the Identifable requriement on the item and have a .sheet(item:id:) so can do: .sheet(item: $editorConfig, id: \.self) like we can do with ForEach when using objects. By the way I believe @Model's implementation of Identifiable's id might be wrong because it uses persistentModelID which changes during save as you say. I have to override id to be self in all my models.
Topic: SwiftUI SubTopic:
SwiftUI Q&A
Jun ’26
Comment on [macOS] CoreSpotlight importer using CSImportExtension failing to index
If it is listed in mdimport -e it can run with mdimport -m -y LOWERCASECONTENTTYPE -u PATHTOAFILE however the attributes aren't actually added to Spotlight's database. And even if the Spotlight extension is enabled in Settings->LoginItems->Spotlight Extensions, Spotlight will never actually run the extension itself. And if in the extension code you attempt to open the file with a try, it throws a permission exception so you wouldn't even be able to compute attributes anyway.
Topic: App & System Services SubTopic: General Tags:
Sep ’25
Comment on SwiftData updates in the background are not merged in the main UI context
By the way on macOS 15.4.1 (24E263) I found @Query does call body when ModelActor saves 🤔 Seems to me @Query watches for the remote store changed notification, then toggles a bool to and performs another SQL query. CoreData: debug: Remote Change Notification - posting for store ContentView: \QueryController<Item>.<computed (Bool)> changed. CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZCOUNTER, t0.ZTIMESTAMP, t0.ZUNIQUEIDENTIFIER FROM ZITEM t0 ORDER BY t0.ZTIMESTAMP DESC, t0.Z_PK
Topic: App & System Services SubTopic: iCloud Tags:
Apr ’25
Comment on NSViewRepresentable updates triggered by .onChange ignore SwiftUI Transactions on macOS
I tested on macOS 27b1 and the issue still exists, that is no animation. Furthermore, none of my workarounds including your suggestion work anymore, even on macOS 26.5.1. While this animates perfectly fine on iOS: func updateUIView(_ uiView: UIView, context: Context) { let targetColor = toggle ? UIColor.red : UIColor.blue context.animate { uiView.backgroundColor = targetColor } } FB22270146
Topic: SwiftUI SubTopic:
SwiftUI Q&A
Replies
Boosts
Views
Activity
Jun ’26
Comment on How to Sandbox SwiftData Edits in .sheet
Maybe a better id would be var id: EditorConfig { self }. Actually what would be real nice is to remove the Identifable requriement on the item and have a .sheet(item:id:) so can do: .sheet(item: $editorConfig, id: \.self) like we can do with ForEach when using objects. By the way I believe @Model's implementation of Identifiable's id might be wrong because it uses persistentModelID which changes during save as you say. I have to override id to be self in all my models.
Topic: SwiftUI SubTopic:
SwiftUI Q&A
Replies
Boosts
Views
Activity
Jun ’26
Comment on [macOS] CoreSpotlight importer using CSImportExtension failing to index
If it is listed in mdimport -e it can run with mdimport -m -y LOWERCASECONTENTTYPE -u PATHTOAFILE however the attributes aren't actually added to Spotlight's database. And even if the Spotlight extension is enabled in Settings->LoginItems->Spotlight Extensions, Spotlight will never actually run the extension itself. And if in the extension code you attempt to open the file with a try, it throws a permission exception so you wouldn't even be able to compute attributes anyway.
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Sep ’25
Comment on SwiftData updates in the background are not merged in the main UI context
By the way on macOS 15.4.1 (24E263) I found @Query does call body when ModelActor saves 🤔 Seems to me @Query watches for the remote store changed notification, then toggles a bool to and performs another SQL query. CoreData: debug: Remote Change Notification - posting for store ContentView: \QueryController<Item>.<computed (Bool)> changed. CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZCOUNTER, t0.ZTIMESTAMP, t0.ZUNIQUEIDENTIFIER FROM ZITEM t0 ORDER BY t0.ZTIMESTAMP DESC, t0.Z_PK
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Apr ’25
Comment on Navigation: update multiple times per frame
[post] should fix that, e.g. .navigationDestination(for: Paragraph.self) { [post] paragraph in ParagraphDetail( post: post, paragraph: paragraph) } This way it captures post and not self so it won't be called every time any property of self changes and only if post changes.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’24
Comment on SwiftData on iOS 18 extreme memory use
Try redesigning your model so you only have one @Query per View. It might mean your model isn't designed correctly. Try to design it based on what you want to show. And its best to compute counts when you save rather than compute them in the UI.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’24