Search results for

“SwiftData inheritance relationship”

4,981 results found

Post

Replies

Boosts

Views

Activity

Reply to SwiftData and CloudKit
Could anyone from Apple weigh in on this? this is a real and easily reproducible issue. on active scenePhase, if CloudKit, specially SwiftData, is enabled… there is a noticeable hang first few seconds. I am assuming it has to do with the @Query sync with remote.
Aug ’25
Is realtime multidevice persistence possible using SwiftData?
I really enjoyed using SwiftData for persistence until I found out that the CloudKit integration ensures changes are only eventually consistent, and that changes can propagate to other devices after as long as minutes, making it useless for any feature that involves handoff between devices. Devastating news but I guess it’s on me for nrtfm. I may try my hand at a custom model context DataStore integrating Powersync, but that’s a whole trip and before I embark on it I was wondering if anyone had suggestions for resolving this problem in a simple and elegant manager that allows me to keep as much of the machinery within Apple’s ecosystem as possible, while ensure reliable “live” updates to SwiftData stores on all eligible devices.
2
0
231
Aug ’25
Reply to How do I use IOUserSCSIPeripheralDeviceType00?
So, the first thing to understand here is that the IOKitPersonalities is called that because it IS in fact a fully valid IOKitPersonalities dictionary. That is, what the system actually uses that dictionary for is: Perform a standard IOKit match and load cycle in the kernel. The final driver in the kernel then uses the DEXT-specific data to launch and run your DEXT process outside the kernel. So, working through the critical keys in that dictionary: IOProviderClass-> This is the in-kernel class that your driver loads on top of. In your case, that would be IOSCSIPeripheralDeviceNub or one of its variants. IOClass-> This is the in-kernel class that your driver loads on top of. This is where things can become a bit confused, as some families work by: Routing all activity through the provider reference so that the DEXT-specific class does not matter (PCIDriverKit). Having the DEXT subclass a specific subclass which corresponds to a specific kernel driver (SCSIPeripheralsDriverKit). This distinction is descr
Aug ’25
Reply to SwiftData Inheritance Query Specialized Model
Nice to know that the original issue goes away in the latest Beta. Regarding the crash triggered by the access to Item.children, if you can provide a runnable code snippet to demo the issue, I'll take another look. You have mentioned a few classes with inheritance, and so I think it is probably worth mentioning that over-using inheritance may impact your app's performance negatively. Concretely, with today's default store (DefaultStore), all the types in an inheritance hierarchy are persisted with one single table in SQLite. If your inheritance hierarchy has many classes, the table (columns and data) can be quite big, which can slow down the performance of fetching and inserting data. That being said, when adopting SwiftData inheritance, you might examine if that is a right use case. This WWDC25 session(starting from around 4:25) covers this topic a bit. You can take a look, if haven't yet. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Aug ’25
v1/appPriceSchedules 409
BASE_TERRITORY=USA app_id = ******* # your app id app_price_points_id = eyJzIjoiNjc1MTMwOTAyNiIsInQiOiJVU0EiLCJwIjoiMTAwMTEifQ # query and get manual_price_id = manualPrice-0 update_app_price_url = https://api.appstoreconnect.apple.com/v1/appPriceSchedules update_app_price_payload = { data: { type: appPriceSchedules, relationships: { app: { data: {type: apps, id: app_id} }, baseTerritory: { data: {type: territories, id: BASE_TERRITORY} }, manualPrices: { data: [{id: manual_price_id, type: appPrices}] } } }, included: [ { type: appPrices, id: manual_price_id, attributes: {startDate: None}, relationships: { appPricePoint: { data: {type: appPricePoints, id: app_price_points_id} } } } ] } update_app_price_resp = requests.post(update_app_price_url, headers=headers, data=json.dumps(update_app_price_payload)) if update_app_price_resp.status_code == 201: update_app_price_id = update_app_price_resp.json()[data][id] print(f✅ Success : {update_app_price_id}) else: print(f❌ Failed : {update_app_price_re
5
0
543
Aug ’25
Reply to SwiftData Inheritance Query Specialized Model
Hi Ziqiao, I've tried with iOS 26 Beta 7 and since Beta 8 (landed tonight) on device (because my Xcode is stuck on iOS Beta 6, don't know why) and the problem is solved. I can now query CollectionItem with predicate that contains inherited properties. Now I have only got problems with accesses to the children property in List. When i got the following hierarchy and the SwiftUI view List access to the Item.children property I got another kind of crash. Category: Work (parent: none) Category: Tech (parent: Work) Thread 1: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID(0x9872c0007ba42159 ))) with Optional(7639D151-5D48-46AC-AB2A-7F0F50919AC5) But I guess it's a different kind of problem now.
Aug ’25
Reply to Change to safe area logic on iOS 26
it would be helpful to see a small test project that has the relationship between your navigation toolbar and the content view set up the same way as your real app and see if you get the same results. If so, please provide a link to that test project. — Ed Ford,  DTS Engineer
Topic: UI Frameworks SubTopic: UIKit
Aug ’25
AppIntent, StartWorkoutIntent, and Siri
I'm a bit confused as to what we're supposed to be doing to support starting a workout using Siri in iOS/watchOS 26. On one hand, I see a big push to move towards App Intents and shortcuts rather than SiriKit. On the other hand, I see that some of the things I would expect to work with App Intents well... don't work. BUT - I'm also not sure it isn't just developer error on my part. Here are some assertions that I'm hoping someone more skilled and knowledgable can correct me on: Currently the StartWorkoutIntent only serves the Action button on the Watch Ultra. It cannot be used to register Shortcuts, nor does Siri respond to it. I can use objects inherited from AppIntent to create shortcuts, but this requires an additional permission to run a shortcut if a user starts a workout with Siri. AppIntent shortcuts requires the user to say Start a workout in - if the user leaves out the in part, Siri will not prompt the user to select my app. If I want to allow the user to simply say Start a Workout and ha
1
0
356
Aug ’25
Reply to How do you observe the count of records in a Swift Data relationship?
There are some subtle things that determine if a change on a SwiftData model is observable, as discussed in this WWDC25 session (starting from around 14:00.) Your code snippet doesn't show where the folder in FolderView is from and how you add a new item. If you can share a runnable code snippet that demonstrates the issue, I'd be able to figure out why folder doesn't trigger an update. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’25
SwiftData ModelContext.insert crashes, why?
This simple test fails in my project. Similar code in my application also crashes. How do I debug the problem? What project settings are required. I have added SwiftData as a framework to test (and application) targets? Thanks, The problem is with: modelContext.insert(item) Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) import XCTest import SwiftData @Model class FakeModel { var name: String init(name: String) { self.name = name } } @MainActor final class FakeModelTests: XCTestCase { var modelContext: ModelContext! override func setUp() { super.setUp() do { let container = try ModelContainer(for: FakeModel.self, configurations: ModelConfiguration(isStoredInMemoryOnly: true)) modelContext = container.mainContext } catch { XCTFail(Failed to create ModelContainer: (error)) modelContext = nil } } func testSaveFetchDeleteFakeItem() { guard let modelContext = modelContext else { XCTFail(ModelContext must be initialized) return } let item = FakeModel(name: Test) modelContext.inser
4
0
267
Aug ’25
SwiftData CloudKit hangs on Active scene Phase
If Cloudkit is enabled, SwiftData @Query operation hangs when the View scenePhase becomes active. Seems like the more @Query calls you have, the more it hangs. This has been first documented some time ago, but in typical Apple style, it has not been addressed or even commented on. https://developer.apple.com/forums/thread/761434
Replies
1
Boosts
0
Views
215
Activity
Aug ’25
Reply to SwiftData and CloudKit
Could anyone from Apple weigh in on this? this is a real and easily reproducible issue. on active scenePhase, if CloudKit, specially SwiftData, is enabled… there is a noticeable hang first few seconds. I am assuming it has to do with the @Query sync with remote.
Replies
Boosts
Views
Activity
Aug ’25
Is realtime multidevice persistence possible using SwiftData?
I really enjoyed using SwiftData for persistence until I found out that the CloudKit integration ensures changes are only eventually consistent, and that changes can propagate to other devices after as long as minutes, making it useless for any feature that involves handoff between devices. Devastating news but I guess it’s on me for nrtfm. I may try my hand at a custom model context DataStore integrating Powersync, but that’s a whole trip and before I embark on it I was wondering if anyone had suggestions for resolving this problem in a simple and elegant manager that allows me to keep as much of the machinery within Apple’s ecosystem as possible, while ensure reliable “live” updates to SwiftData stores on all eligible devices.
Replies
2
Boosts
0
Views
231
Activity
Aug ’25
App extension write data The main target reads data.
I have an iOS app with a main target and an app extension. I want the app extension to write data to the SwiftData in App Groups, while the main target reads the data. However, currently, the app extension only has permission to read data, not to write it.Is the issue due to my incorrect configuration or an Apple-imposed restriction?
Replies
2
Boosts
0
Views
123
Activity
Aug ’25
Reply to How do I use IOUserSCSIPeripheralDeviceType00?
So, the first thing to understand here is that the IOKitPersonalities is called that because it IS in fact a fully valid IOKitPersonalities dictionary. That is, what the system actually uses that dictionary for is: Perform a standard IOKit match and load cycle in the kernel. The final driver in the kernel then uses the DEXT-specific data to launch and run your DEXT process outside the kernel. So, working through the critical keys in that dictionary: IOProviderClass-> This is the in-kernel class that your driver loads on top of. In your case, that would be IOSCSIPeripheralDeviceNub or one of its variants. IOClass-> This is the in-kernel class that your driver loads on top of. This is where things can become a bit confused, as some families work by: Routing all activity through the provider reference so that the DEXT-specific class does not matter (PCIDriverKit). Having the DEXT subclass a specific subclass which corresponds to a specific kernel driver (SCSIPeripheralsDriverKit). This distinction is descr
Replies
Boosts
Views
Activity
Aug ’25
Reply to SwiftData Inheritance Query Specialized Model
Nice to know that the original issue goes away in the latest Beta. Regarding the crash triggered by the access to Item.children, if you can provide a runnable code snippet to demo the issue, I'll take another look. You have mentioned a few classes with inheritance, and so I think it is probably worth mentioning that over-using inheritance may impact your app's performance negatively. Concretely, with today's default store (DefaultStore), all the types in an inheritance hierarchy are persisted with one single table in SQLite. If your inheritance hierarchy has many classes, the table (columns and data) can be quite big, which can slow down the performance of fetching and inserting data. That being said, when adopting SwiftData inheritance, you might examine if that is a right use case. This WWDC25 session(starting from around 4:25) covers this topic a bit. You can take a look, if haven't yet. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Aug ’25
Reply to RCS firewall domains & ports
I’m not sure of your relationship to niggeulimann, but I responded to their copy of this question over on this thread. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Replies
Boosts
Views
Activity
Aug ’25
v1/appPriceSchedules 409
BASE_TERRITORY=USA app_id = ******* # your app id app_price_points_id = eyJzIjoiNjc1MTMwOTAyNiIsInQiOiJVU0EiLCJwIjoiMTAwMTEifQ # query and get manual_price_id = manualPrice-0 update_app_price_url = https://api.appstoreconnect.apple.com/v1/appPriceSchedules update_app_price_payload = { data: { type: appPriceSchedules, relationships: { app: { data: {type: apps, id: app_id} }, baseTerritory: { data: {type: territories, id: BASE_TERRITORY} }, manualPrices: { data: [{id: manual_price_id, type: appPrices}] } } }, included: [ { type: appPrices, id: manual_price_id, attributes: {startDate: None}, relationships: { appPricePoint: { data: {type: appPricePoints, id: app_price_points_id} } } } ] } update_app_price_resp = requests.post(update_app_price_url, headers=headers, data=json.dumps(update_app_price_payload)) if update_app_price_resp.status_code == 201: update_app_price_id = update_app_price_resp.json()[data][id] print(f✅ Success : {update_app_price_id}) else: print(f❌ Failed : {update_app_price_re
Replies
5
Boosts
0
Views
543
Activity
Aug ’25
Reply to SwiftData Inheritance Query Specialized Model
Hi Ziqiao, I've tried with iOS 26 Beta 7 and since Beta 8 (landed tonight) on device (because my Xcode is stuck on iOS Beta 6, don't know why) and the problem is solved. I can now query CollectionItem with predicate that contains inherited properties. Now I have only got problems with accesses to the children property in List. When i got the following hierarchy and the SwiftUI view List access to the Item.children property I got another kind of crash. Category: Work (parent: none) Category: Tech (parent: Work) Thread 1: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID(0x9872c0007ba42159 ))) with Optional(7639D151-5D48-46AC-AB2A-7F0F50919AC5) But I guess it's a different kind of problem now.
Replies
Boosts
Views
Activity
Aug ’25
Reply to Change to safe area logic on iOS 26
it would be helpful to see a small test project that has the relationship between your navigation toolbar and the content view set up the same way as your real app and see if you get the same results. If so, please provide a link to that test project. — Ed Ford,  DTS Engineer
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Aug ’25
AppIntent, StartWorkoutIntent, and Siri
I'm a bit confused as to what we're supposed to be doing to support starting a workout using Siri in iOS/watchOS 26. On one hand, I see a big push to move towards App Intents and shortcuts rather than SiriKit. On the other hand, I see that some of the things I would expect to work with App Intents well... don't work. BUT - I'm also not sure it isn't just developer error on my part. Here are some assertions that I'm hoping someone more skilled and knowledgable can correct me on: Currently the StartWorkoutIntent only serves the Action button on the Watch Ultra. It cannot be used to register Shortcuts, nor does Siri respond to it. I can use objects inherited from AppIntent to create shortcuts, but this requires an additional permission to run a shortcut if a user starts a workout with Siri. AppIntent shortcuts requires the user to say Start a workout in - if the user leaves out the in part, Siri will not prompt the user to select my app. If I want to allow the user to simply say Start a Workout and ha
Replies
1
Boosts
0
Views
356
Activity
Aug ’25
Reply to How do you observe the count of records in a Swift Data relationship?
There are some subtle things that determine if a change on a SwiftData model is observable, as discussed in this WWDC25 session (starting from around 14:00.) Your code snippet doesn't show where the folder in FolderView is from and how you add a new item. If you can share a runnable code snippet that demonstrates the issue, I'd be able to figure out why folder doesn't trigger an update. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to SwiftData Inheritance Query Specialized Model
The use of the inheritance, as shown in the above code snippet, looks fine to me, and I don't really see a crash by running the code on my iOS 26 Beta 7 simulator and device. So did you try with Beta 7, the latest Beta as of today, yet? Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Aug ’25
Reply to SwiftData ModelContext.insert crashes, why?
Answering my own question. Found this blog, searching for answers https://blog.jacobstechtavern.com/p/swiftdata-outside-swiftui Thanks Jacob. The answer is simple, but maybe someone can explain. modelContext = container.mainContext works if it's modelContext = ModelContext(container) Done!
Replies
Boosts
Views
Activity
Aug ’25
SwiftData ModelContext.insert crashes, why?
This simple test fails in my project. Similar code in my application also crashes. How do I debug the problem? What project settings are required. I have added SwiftData as a framework to test (and application) targets? Thanks, The problem is with: modelContext.insert(item) Thread 1: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0) import XCTest import SwiftData @Model class FakeModel { var name: String init(name: String) { self.name = name } } @MainActor final class FakeModelTests: XCTestCase { var modelContext: ModelContext! override func setUp() { super.setUp() do { let container = try ModelContainer(for: FakeModel.self, configurations: ModelConfiguration(isStoredInMemoryOnly: true)) modelContext = container.mainContext } catch { XCTFail(Failed to create ModelContainer: (error)) modelContext = nil } } func testSaveFetchDeleteFakeItem() { guard let modelContext = modelContext else { XCTFail(ModelContext must be initialized) return } let item = FakeModel(name: Test) modelContext.inser
Replies
4
Boosts
0
Views
267
Activity
Aug ’25