Post

Replies

Boosts

Views

Created

SwiftUI Performance vs identity
In SwiftUI, it is recommended not to store ViewBuilder closures in sub-views but instead evaluate them directly in init and store the result (example: https://www.youtube.com/watch?v=yXAQTIKR8fk). That has the advantage, as I understand it, that the closure doesn't need to be re-evaluated on every layout pass. On the other side, identity is a very important topic in SwiftUI to get the UI working properly. Now I have this generic view I'm using with a closure which is displayed in two places (HStack & VStack). Should I store the closure result and get the performance improvements, or evaluate it in place and get correct identities (if that is even an issue)? Simplified example: struct DynamicStack<Content: View>: View { @ViewBuilder var content: () -> Content var body: some View { ViewThatFits(in: .horizontal) { HStack { content() } VStack { content() } } } } vs struct DynamicStack<Content: View>: View { @ViewBuilder var content: Content var body: some View { ViewThatFits(in: .horizontal) { HStack { content } VStack { content } } } }
0
0
50
4d
Suspicious CloudKit Telemetry Data
Starting 20th March 2025, I see an increase in bandwidth and latency for one of my CloudKit projects. I'm using NSPersistentCloudKitContainer to synchronise my data. I haven't changed any CloudKit scheme during that time but shipped an update. Since then, I reverted some changes from that update, which could have led to changes in the sync behaviour. Is anyone else seeing any issues? I would love to file a DTS and use one of my credits for that, but unfortunately, I can't because I cannot reproduce it with a demo project because I cannot travel back in time and check if it also has an increase in metrics during that time. Maybe an Apple engineer can green-light me filing a DTS request, please.
0
1
134
Apr ’25
CoreData + CloudKit: Cocoa-Error 134419
Hi, Some of my users are experiencing synchronization issues when using the NSPersistentCloudKitContainer in CoreData. My app is listening to any errors that occur during the synchronization with the NSPersistentCloudKitContainer.eventChangedNotification Notification. Before I just got Cocoa-Errors 2 or 3 which indicate a bad network connection or something similar. Now I received reports with a Cocoa-Error 134419. Does anyone know what this error code means? Maybe someone from the Core Data team could have a look at this. Thanks a lot, Alexander
1
0
1.9k
Nov ’21