Post

Replies

Boosts

Views

Activity

Reply to SwiftData with CloudKit Error: Error updating background task request
Just to be clear this is not a background task I have initiated. This is something done internally by SwiftData. That is the reason I would like to know the background task id. If I don't then the whole background processing would be blocked and defeats the purpose of the SwiftData background processing. This doesn't seem to be documented anywhere. Even if there is a way to debug this please let me know as symbolic breakpoints that I tried don't seem to work. Any help on this would be greatly appreciated.
Topic: App & System Services SubTopic: iCloud Tags:
Apr ’26
Reply to 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
@DTS Engineer Questions Can you confirm if it is ok to use ColorComponents as Coddle and ignore the fault log? 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release Or what is the best approach? I could store it as Data, however having to decode every time seems to be expensive especially when displaying In a list. I am kind of stuck with this, could you please help, thanks!
Topic: App & System Services SubTopic: iCloud Tags:
Apr ’26
Reply to 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
@DTS Engineer could you please add CloudKit tag to this post, I am unable to add it, thanks! My Solution I have managed to get it working on the app target with ValueTransformer and NSSecureCoding but kind of seems odd to store just a normal struct using so much boilerplate code. Way to reproduce this The issue is not reproducible on SwiftData only. Only when you have SwiftData + CloudKit this occurs. CloudKit minimum reproducible code often requires turning on project setup with capabilities etc. Problem On the app target things work ok but for test cases there is a crash as it can't convert from Data to ColorRepresentation. I have the same file added to 2 different targets, not sure if it has anything with the names and module names because the error seems to suggest it. Error Domain=NSCocoaErrorDomain Code=4864 "value for key 'root' was of unexpected class 'ColorRepresentation' (0x10326c828) [/Users/homefolder/Library/Developer/CoreSimulator/Devices/E365C6A9-B19A-4A53-8885-05E9DE4D8B84/data/Containers/Bundle/Application/BE80DEBA-5FAF-496A-99CC-E60A8C72A096/WidgetStylesDemo.app]. Allowed classes are: {( "'ColorRepresentation' (0x103d98520) [/Users/homefolder/Library/Developer/CoreSimulator/Devices/E365C6A9-B19A-4A53-8885-05E9DE4D8B84/data/Containers/Bundle/Application/BE80DEBA-5FAF-496A-99CC-E60A8C72A096/WidgetStylesDemo.app/PlugIns/WidgetStylesDemoTests.xctest]" )}" UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'ColorRepresentation' (0x10326c828) [/Users/homefolder/Library/Developer/CoreSimulator/Devices/E365C6A9-B19A-4A53-8885-05E9DE4D8B84/data/Containers/Bundle/Application/BE80DEBA-5FAF-496A-99CC-E60A8C72A096/WidgetStylesDemo.app]. Allowed classes are: {( "'ColorRepresentation' (0x103d98520) [/Users/homefolder/Library/Developer/CoreSimulator/Devices/E365C6A9-B19A-4A53-8885-05E9DE4D8B84/data/Containers/Bundle/Application/BE80DEBA-5FAF-496A-99CC-E60A8C72A096/WidgetStylesDemo.app/PlugIns/WidgetStylesDemoTests.xctest]" )}} Documentation / Videos: I wish there are some documentation around SwiftData + CloudKit custom types.
Topic: App & System Services SubTopic: iCloud Tags:
Apr ’26
Reply to Navigation title flickers when tab is changed when used with a List / Form
Summary This is not a bug Closed Feedback Concept TabView needs to be the outermost container. NavigationStack should be in the Tab contents. Fixed Code struct ContentView: View { @State private var selectedTab = TabItem.red var body: some View { TabView(selection: $selectedTab) { ForEach(TabItem.allCases, id: \.self) { tab in Tab(tab.rawValue, systemImage: tab.systemImageName, value: tab) { NavigationStack { List { Text(tab.rawValue) } .navigationTitle(selectedTab.rawValue) } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI
Dec ’25
Reply to #Predicate doesn't work with enum
I really hope this gets addressed in #WWDC25. Using a rawValue, you need to hardcode the rawValue, even the below wouldn't compile. #Predicate<Train> { $0.statusRawValue == Status.onTime.rawValue } Error: Key path cannot refer to enum case 'status' If the intent of SwiftData is to be modern and not expose the constraints of SQLite, then more needs to be done to improve support more swift types. Using a #Predicate seems like a blackbox, it works for simple primitive type comparisons but doesn't even work when trying to compare with something like Status.onTime.rawValue
Topic: App & System Services SubTopic: iCloud Tags:
May ’25
Reply to Need help understanding a piece of logic in a piece of code involving ".background"
dragDetector returns a GeometryReader which is a View You can look at the documentation for GeometryReader and Color.clear, both of them conform to View. I think it will be best to start simple by going through the basics of SwiftUI. There is great documentation / videos on Apple Developer website. Trying to learn SwiftUI by reading through code might not be the best approach, without the proper understanding of the basics of SwiftUI
Topic: Community SubTopic: Apple Developers Tags:
Aug ’24
Reply to SwiftData with CloudKit Error: Error updating background task request
Just to be clear this is not a background task I have initiated. This is something done internally by SwiftData. That is the reason I would like to know the background task id. If I don't then the whole background processing would be blocked and defeats the purpose of the SwiftData background processing. This doesn't seem to be documented anywhere. Even if there is a way to debug this please let me know as symbolic breakpoints that I tried don't seem to work. Any help on this would be greatly appreciated.
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Apr ’26
Reply to 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
@DTS Engineer Questions Can you confirm if it is ok to use ColorComponents as Coddle and ignore the fault log? 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release Or what is the best approach? I could store it as Data, however having to decode every time seems to be expensive especially when displaying In a list. I am kind of stuck with this, could you please help, thanks!
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Apr ’26
Reply to 'NSKeyedUnarchiveFromData' should not be used to for un-archiving and will be removed in a future release
@DTS Engineer could you please add CloudKit tag to this post, I am unable to add it, thanks! My Solution I have managed to get it working on the app target with ValueTransformer and NSSecureCoding but kind of seems odd to store just a normal struct using so much boilerplate code. Way to reproduce this The issue is not reproducible on SwiftData only. Only when you have SwiftData + CloudKit this occurs. CloudKit minimum reproducible code often requires turning on project setup with capabilities etc. Problem On the app target things work ok but for test cases there is a crash as it can't convert from Data to ColorRepresentation. I have the same file added to 2 different targets, not sure if it has anything with the names and module names because the error seems to suggest it. Error Domain=NSCocoaErrorDomain Code=4864 "value for key 'root' was of unexpected class 'ColorRepresentation' (0x10326c828) [/Users/homefolder/Library/Developer/CoreSimulator/Devices/E365C6A9-B19A-4A53-8885-05E9DE4D8B84/data/Containers/Bundle/Application/BE80DEBA-5FAF-496A-99CC-E60A8C72A096/WidgetStylesDemo.app]. Allowed classes are: {( "'ColorRepresentation' (0x103d98520) [/Users/homefolder/Library/Developer/CoreSimulator/Devices/E365C6A9-B19A-4A53-8885-05E9DE4D8B84/data/Containers/Bundle/Application/BE80DEBA-5FAF-496A-99CC-E60A8C72A096/WidgetStylesDemo.app/PlugIns/WidgetStylesDemoTests.xctest]" )}" UserInfo={NSDebugDescription=value for key 'root' was of unexpected class 'ColorRepresentation' (0x10326c828) [/Users/homefolder/Library/Developer/CoreSimulator/Devices/E365C6A9-B19A-4A53-8885-05E9DE4D8B84/data/Containers/Bundle/Application/BE80DEBA-5FAF-496A-99CC-E60A8C72A096/WidgetStylesDemo.app]. Allowed classes are: {( "'ColorRepresentation' (0x103d98520) [/Users/homefolder/Library/Developer/CoreSimulator/Devices/E365C6A9-B19A-4A53-8885-05E9DE4D8B84/data/Containers/Bundle/Application/BE80DEBA-5FAF-496A-99CC-E60A8C72A096/WidgetStylesDemo.app/PlugIns/WidgetStylesDemoTests.xctest]" )}} Documentation / Videos: I wish there are some documentation around SwiftData + CloudKit custom types.
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
Apr ’26
Reply to Navigation title flickers when tab is changed when used with a List / Form
Summary This is not a bug Closed Feedback Concept TabView needs to be the outermost container. NavigationStack should be in the Tab contents. Fixed Code struct ContentView: View { @State private var selectedTab = TabItem.red var body: some View { TabView(selection: $selectedTab) { ForEach(TabItem.allCases, id: \.self) { tab in Tab(tab.rawValue, systemImage: tab.systemImageName, value: tab) { NavigationStack { List { Text(tab.rawValue) } .navigationTitle(selectedTab.rawValue) } } } } } }
Topic: UI Frameworks SubTopic: SwiftUI
Replies
Boosts
Views
Activity
Dec ’25
Reply to #Predicate doesn't work with enum
I really hope this gets addressed in #WWDC25. Using a rawValue, you need to hardcode the rawValue, even the below wouldn't compile. #Predicate<Train> { $0.statusRawValue == Status.onTime.rawValue } Error: Key path cannot refer to enum case 'status' If the intent of SwiftData is to be modern and not expose the constraints of SQLite, then more needs to be done to improve support more swift types. Using a #Predicate seems like a blackbox, it works for simple primitive type comparisons but doesn't even work when trying to compare with something like Status.onTime.rawValue
Topic: App & System Services SubTopic: iCloud Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Need help understanding a piece of logic in a piece of code involving ".background"
dragDetector returns a GeometryReader which is a View You can look at the documentation for GeometryReader and Color.clear, both of them conform to View. I think it will be best to start simple by going through the basics of SwiftUI. There is great documentation / videos on Apple Developer website. Trying to learn SwiftUI by reading through code might not be the best approach, without the proper understanding of the basics of SwiftUI
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
Aug ’24