Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

Reply to Recent changes to the App Store Connect API has broken the ability to set the IN_APP_PASS_PROVISIONING capability type
Just helping everyone read the post above since it lacks formatting (formatted using gen AI): Overview We have been using this API call to set the In-App Provisioning capability for 2+ years, and it just recently started returning errors. Previously Working Setup To set the In-App Provisioning capability, we had been using the App Store Connect API directly: curl https://api.appstoreconnect.apple.com/v1/bundleIdCapabilities -X POST --header Authorization: Bearer #{appleApiToken} --header Content-Type: application/json -d '{ data: { type: bundleIdCapabilities, attributes: { capabilityType: IN_APP_PASS_PROVISIONING }, relationships: { bundleId: { data: { id: #{appStoreBundleIdentifier}, type: bundleIds } } } } }' The IN_APP_PASS_PROVISIONING capability type is shown when retrieving the bundle ID capabilities, if In-App Provisioning is set on a bundle ID: curl https://api.appstoreconnect.apple.com/v1/bundleIds/#{appStoreBundleIdentifier}/bundleIdCapabilities --header Authorization: Bearer #{appleAp
Jun ’25
Reply to Background App Refresh
Could you elaborate on how to build a model layer and how that differentiates from calling a function from a .task or .onappear function within the view level? What do I need to pass to handleAppRefresh? import Foundation import SwiftData import SwiftUI import BackgroundTasks func scheduleAppRefresh() { let request = BGAppRefreshTaskRequest(identifier: app.RoutineRefresh) // Fetch no earlier than 15 minutes from now. request.earliestBeginDate = Date(timeIntervalSinceNow: 60) do { try BGTaskScheduler.shared.submit(request) } catch { print(Could not schedule app refresh: (error)) } } func handleAppRefresh(task: BGAppRefreshTask) async { // Schedule a new refresh task. scheduleAppRefresh() // Create an operation that performs the main part of the background task. let operation = RefreshAppContentsOperation() // Provide the background task with an expiration handler that cancels the operation. task.expirationHandler = { operation.cancel() } // Inform the system that the background task is complete // whe
Jun ’25
Recent changes to the App Store Connect API has broken the ability to set the IN_APP_PASS_PROVISIONING capability type
We have been using this API call to set the In-App Provisioning capability for 2+ years and it just recently started returning errors. To set the In-App Provisioning capability we had been using the App Store Connect API directly: curl https://api.appstoreconnect.apple.com/v1/bundleIdCapabilities -X POST --header Authorization: Bearer #{appleApiToken} --header Content-Type: application/json -d '{data: {type: bundleIdCapabilities, attributes: {capabilityType: IN_APP_PASS_PROVISIONING}, relationships: {bundleId: {data: {id: #{appStoreBundleIdentifier}, type: bundleIds}}}}}' The IN_APP_PASS_PROVISIONING capability type is shown, by getting the bundle ID capabilities, when In-App Provisioning is set on a bundle ID: curl https://api.appstoreconnect.apple.com/v1/bundleIds/#{appStoreBundleIdentifier}/bundleIdCapabilities --header Authorization: Bearer #{appleApiToken} After manually setting the In-App Provisioning capability via the Apple Developer portal you will see the new capabilityType: { type : bundl
3
0
790
Jun ’25
Reply to Background Modes Capability Missing in App ID Configuration
UIBackgroundModes was already configured in info.plist: Great! That's all you need to do. Entitlement provisioning is not an LLM hallucination it's part of the error message: Yes, I'm afraid it is. Let me start with the error message here: Automatic signing failed Xcode failed to provision this target. Please file a bug report at https://feedbackassistant.apple.com and include the Update Signing report from the Report navigator. Provisioning profile iOS Team Provisioning Profile: [app id] doesn't include the com.apple.developer.location.always and com.apple.developer.location.background entitlements. Structurally, code signing entitlements involve comparing a list of keys/values from two different sources: The entitlements embedded in your app code signature, which come from your entitlements plist. The entitlements in the embedded provisioning profile, which came from our developer portal. Critically, that also means that failures can accurately be described in two different ways: The entitlement file define
Jun ’25
Fatal error: Duplicate keys of type 'AnyHashable2' were found in a Dictionary.
I have encountered the following error and reduced my code to the minimum necessary to reliably reproduce this error. Fatal error: Duplicate keys of type 'AnyHashable2' were found in a >Dictionary. This usually means either that the type violates Hashable's >requirements, or that members of such a dictionary were mutated after insertion. It occurs when instances of a swiftdata model are inserted (the error occurs reliably when inserting five or more instances. Fewer insertions seems to make the error either more rare or go away entirely) and a Picker with .menu pickerStyle is present. Any of the following changes prevents the error from occuring: adding id = UUID() to the Item class removing .tag(item) in the picker content using any pickerStyle other than .menu using an observable class instead of a swiftdata class I would greatly appreciate if anyone knows what exactly is going on here. Tested using XCode Version 16.4 (16F6), iPhone 16 Pro iOS 18.5 Simulator and iPhone 15 Pro iOS 18.
1
0
175
Jun ’25
Old CloudKit Data Repopulating after a Local Reset
We are trying to solve for the following condition with SwiftData + CloudKit: Lots of data in CloudKit Perform app-reset to clear data & App settings and start fresh. Reset data models with try modelContext.delete(model:_) myModel.count() confirms local deletion (0 records); but iCloud Console shows expectedly slow process to delete. Old CloudKit data is returning during the On Boarding process. Questions: • Would making a new iCloud Zone for each reset work around this, as the new zone would be empty? We're having trouble finding details about how to do this with SwiftData. • Would CKSyncEngine have a benefit over the default SwiftData methods? Open to hearing if anyone has experienced a similar challenge and how you worked around it!
2
0
233
Jun ’25
Reply to Unable to Start macOS VM via Virtualization API in a Sandboxed Launchd Service
I think the answer here is “Don’t do that.” Virtualization framework is meant to be used by virtualisation apps. Such apps obviously run in a user context. A launchd agent is sufficiently close to a GUI user context that I fully expect that Virtualization will work there. Old school Unix-y context switching techniques, like the double fork thing, are generally OK if you limit yourself to Unix-y APIs, but they often cause problems when you use higher-level frameworks. That’s because they result in an inconsistent execution context, where part of the context has switched and part hasn’t. I discuss this ideal in a lot more detail in TN2083 Daemons and Agents (it’s old, but still remarkably relevant). Having said that, the immediate cause of your crash seems to be an App Sandbox re-initialisation issue. See Resolving App Sandbox Inheritance Problems. That’s not super surprising given your current setup, because this process has inherited its sandbox from your app. The best path forward depends o
Jun ’25
Reply to When DHCP is used, the Network Extension will cause the machine to fail to obtain an IP address
getnameinfo() doesn't always fail. Its failure has nothing to do with being in this problematic state, but it is indeed because of this problem that I consider using getnameinfo() for reverse DNS. In fact, MyTransparentProxyProvider will obtain some domain names set by the extension user, which indicates that the user wants to block access to these domain names. Initially, MyTransparentProxyProvider, when intercepted UDP Flow, if the target port is 53, would take over the Flow, and deal with the relationship between the Flow data to get the IP addresses to domain names table. However, due to this DHCP issue, I added an exclusion rule, which made me no longer obtain the UDP Flow on port 53. In this case, I consider using getnameinfo() to have a look. During the process of using getnameinfo(), I will first check whether -[NEAppProxyTCPFlow remoteHostname] is available. If it can be used, there is no need for reverse DNS; otherwise, I will try reverse DNS. For Safari's Flow, the value of -[NEAppProxyTCP
Jun ’25
Using Observation class for multiple SwiftData Models
Greetings i have an app that uses three different SwiftData models and i want to know what is the best way to use the them accross the app. I though a centralized behaviour and i want to know if it a correct approach.First let's suppose that the first view of the app will load the three models using the @Enviroment that work with @Observation. Then to other views that add data to the swiftModels again with the @Environment. Another View that will use the swiftData models with graph and datas for average and min and max.Is this a corrent way? or i should use @Query in every view that i want and ModelContext when i add the data. @Observable class CentralizedDataModels { var firstDataModel: [FirstDataModel] = [] var secondDataModel: [SecondDataModel] = [] var thirdDataModel: [ThirdDataModel] = [] let context: ModelContext init(context:ModelContext) { self.context = context } }
0
0
150
Jun ’25
Are these @model classes correct for swiftdata with cloudkit?
I have used core data before via the model editor. This is the first time I'm using swift data and that too with CloudKit. Can you tell me if the following model classes are correct? I have an expense which can have only one sub category which in turn belongs to a single category. Here are my classes... // Expense.swift // Pocket Expense Diary // // Created by Neerav Kothari on 16/05/25. // import Foundation import SwiftData @Model class Expense { @Attribute var expenseDate: Date? = nil @Attribute var expenseAmount: Double? = nil @Attribute var expenseCategory: Category? = nil @Attribute var expenseSubCategory: SubCategory? = nil var date: Date { get { return expenseDate ?? Date() } set { expenseDate = newValue } } var amount: Double{ get { return expenseAmount ?? 0.0 } set { expenseAmount = newValue } } var category: Category{ get { return expenseCategory ?? Category.init(name: , icon: ) } set { expenseCategory = newValue } } var subCategory: SubCategory{ get { return expenseSubCategory ?? SubCatego
1
0
137
Jun ’25
CloudKit Console: No Containers
Background: Our non-production App was using SwiftData locally. Yesterday we followed the documentation to enable CloudKit: https://developer.apple.com/documentation/cloudkit/enabling-cloudkit-in-your-app iCloud Works: Data is properly syncing via iCloud between 2 devices. Add on one shows on the other; delete on one deletes on the other. Today we logged into CloudKit Console for the first time; but there are no databases showing. We verified: Users and Roles: we have “Access to Cloud Managed… Certificates” Certificates, Identifiers & Profiles: our app has iCloud capabilities and is using our iCloud Container Signed into CloudKit Console with same developer ID as AppStoreConnect This is also the Apple ID of the iCloud account that has synced data from our app. In Xcode > Signing & Capabilities we are signed in as our Company team. Any guidance or tips to understanding how to what’s going on in CloudKit Console and gaining access to the database is appreciated!
1
0
237
Jun ’25
Error - Never access a full future backing data
Hi, I am building an iOS app with SwiftUI and SwiftData for the first time and I am experiencing a lot of difficulty with this error: Thread 44: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID( /MySwiftDataModel/p1>)), backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID( /MySwiftDataModel/p1>)) with Optional() I have been trying to figure out what the problem is, but unfortunately I cannot find any information in the documentation or on other sources online. My only theory about this error is that it is somehow related to fetching an entity that has been created in-memory, but not yet saved to the modelContext in SwiftData. However, when I am trying to debug this, it's not clear this is the case. Sometimes the error happens, sometimes it doesn't. Saving manually does not always solve the error. Therefore, i
1
0
200
Jun ’25
Feedback/issues for SwiftData custom store
Hello, thank you Apple for supporting custom store with SwiftData and the Schema type is superb to work with. I have successfully set one up with SQL and have some feedback and issues regarding its APIs. There’s a highlighted message in the documentation about not using internal restricted symbols directly, but they contradict with the given protocols and I am concerned about breaking any App Store rules. Are we allowed to use these? If not, they should be opened up as they’re useful. BackingData is required to set up custom snapshots, initialization, and getting/setting values. And I want to use it with createBackingData() to directly initialize instances from snapshots when transferring them between server and client or concurrency. RelationshipCollection for casting to-many relationships from backing data or checking if an array contains a PersistentModel. SchemaProperty for type erasure in a collection. Schema.Relationship has KeyPath properties, but it is missing for Schema.Attribute an
0
0
164
May ’25
ShieldConfigurationExtension & SwiftData
Hi, I am developing a Screen Time App and I am having issues with the ShieldConfigurationExtension (ShieldConfigurationDataSource). I know this extensions is sandboxed but I should be able to read data from the main app. I am using SwiftData as my database, but I am unable to initialize it in the extensions with an error indicating insufficient file permissions. I have App Group set up and I am able to share data using UserDefaults but that is just inconvenient. Is there any way I could just open the SwiftData in read only mode so that I could display the user some info on the shield? SwiftData Init: private func setupContainer() throws { let schema = Schema([ DogEntity.self, HouseEntity.self ]) // Use app group container if available let config: ModelConfiguration if let containerURL = FileManager.default.containerURL( forSecurityApplicationGroupIdentifier: group.(Bundle.app.bundleIdentifier ?? ) ) { config = ModelConfiguration(schema: schema, url: containerURL.appendingPathCompone
1
0
195
May ’25
Reply to Recent changes to the App Store Connect API has broken the ability to set the IN_APP_PASS_PROVISIONING capability type
Just helping everyone read the post above since it lacks formatting (formatted using gen AI): Overview We have been using this API call to set the In-App Provisioning capability for 2+ years, and it just recently started returning errors. Previously Working Setup To set the In-App Provisioning capability, we had been using the App Store Connect API directly: curl https://api.appstoreconnect.apple.com/v1/bundleIdCapabilities -X POST --header Authorization: Bearer #{appleApiToken} --header Content-Type: application/json -d '{ data: { type: bundleIdCapabilities, attributes: { capabilityType: IN_APP_PASS_PROVISIONING }, relationships: { bundleId: { data: { id: #{appStoreBundleIdentifier}, type: bundleIds } } } } }' The IN_APP_PASS_PROVISIONING capability type is shown when retrieving the bundle ID capabilities, if In-App Provisioning is set on a bundle ID: curl https://api.appstoreconnect.apple.com/v1/bundleIds/#{appStoreBundleIdentifier}/bundleIdCapabilities --header Authorization: Bearer #{appleAp
Replies
Boosts
Views
Activity
Jun ’25
Reply to Background App Refresh
Could you elaborate on how to build a model layer and how that differentiates from calling a function from a .task or .onappear function within the view level? What do I need to pass to handleAppRefresh? import Foundation import SwiftData import SwiftUI import BackgroundTasks func scheduleAppRefresh() { let request = BGAppRefreshTaskRequest(identifier: app.RoutineRefresh) // Fetch no earlier than 15 minutes from now. request.earliestBeginDate = Date(timeIntervalSinceNow: 60) do { try BGTaskScheduler.shared.submit(request) } catch { print(Could not schedule app refresh: (error)) } } func handleAppRefresh(task: BGAppRefreshTask) async { // Schedule a new refresh task. scheduleAppRefresh() // Create an operation that performs the main part of the background task. let operation = RefreshAppContentsOperation() // Provide the background task with an expiration handler that cancels the operation. task.expirationHandler = { operation.cancel() } // Inform the system that the background task is complete // whe
Replies
Boosts
Views
Activity
Jun ’25
Recent changes to the App Store Connect API has broken the ability to set the IN_APP_PASS_PROVISIONING capability type
We have been using this API call to set the In-App Provisioning capability for 2+ years and it just recently started returning errors. To set the In-App Provisioning capability we had been using the App Store Connect API directly: curl https://api.appstoreconnect.apple.com/v1/bundleIdCapabilities -X POST --header Authorization: Bearer #{appleApiToken} --header Content-Type: application/json -d '{data: {type: bundleIdCapabilities, attributes: {capabilityType: IN_APP_PASS_PROVISIONING}, relationships: {bundleId: {data: {id: #{appStoreBundleIdentifier}, type: bundleIds}}}}}' The IN_APP_PASS_PROVISIONING capability type is shown, by getting the bundle ID capabilities, when In-App Provisioning is set on a bundle ID: curl https://api.appstoreconnect.apple.com/v1/bundleIds/#{appStoreBundleIdentifier}/bundleIdCapabilities --header Authorization: Bearer #{appleApiToken} After manually setting the In-App Provisioning capability via the Apple Developer portal you will see the new capabilityType: { type : bundl
Replies
3
Boosts
0
Views
790
Activity
Jun ’25
Reply to Background Modes Capability Missing in App ID Configuration
UIBackgroundModes was already configured in info.plist: Great! That's all you need to do. Entitlement provisioning is not an LLM hallucination it's part of the error message: Yes, I'm afraid it is. Let me start with the error message here: Automatic signing failed Xcode failed to provision this target. Please file a bug report at https://feedbackassistant.apple.com and include the Update Signing report from the Report navigator. Provisioning profile iOS Team Provisioning Profile: [app id] doesn't include the com.apple.developer.location.always and com.apple.developer.location.background entitlements. Structurally, code signing entitlements involve comparing a list of keys/values from two different sources: The entitlements embedded in your app code signature, which come from your entitlements plist. The entitlements in the embedded provisioning profile, which came from our developer portal. Critically, that also means that failures can accurately be described in two different ways: The entitlement file define
Replies
Boosts
Views
Activity
Jun ’25
Fatal error: Duplicate keys of type 'AnyHashable2' were found in a Dictionary.
I have encountered the following error and reduced my code to the minimum necessary to reliably reproduce this error. Fatal error: Duplicate keys of type 'AnyHashable2' were found in a >Dictionary. This usually means either that the type violates Hashable's >requirements, or that members of such a dictionary were mutated after insertion. It occurs when instances of a swiftdata model are inserted (the error occurs reliably when inserting five or more instances. Fewer insertions seems to make the error either more rare or go away entirely) and a Picker with .menu pickerStyle is present. Any of the following changes prevents the error from occuring: adding id = UUID() to the Item class removing .tag(item) in the picker content using any pickerStyle other than .menu using an observable class instead of a swiftdata class I would greatly appreciate if anyone knows what exactly is going on here. Tested using XCode Version 16.4 (16F6), iPhone 16 Pro iOS 18.5 Simulator and iPhone 15 Pro iOS 18.
Replies
1
Boosts
0
Views
175
Activity
Jun ’25
Old CloudKit Data Repopulating after a Local Reset
We are trying to solve for the following condition with SwiftData + CloudKit: Lots of data in CloudKit Perform app-reset to clear data & App settings and start fresh. Reset data models with try modelContext.delete(model:_) myModel.count() confirms local deletion (0 records); but iCloud Console shows expectedly slow process to delete. Old CloudKit data is returning during the On Boarding process. Questions: • Would making a new iCloud Zone for each reset work around this, as the new zone would be empty? We're having trouble finding details about how to do this with SwiftData. • Would CKSyncEngine have a benefit over the default SwiftData methods? Open to hearing if anyone has experienced a similar challenge and how you worked around it!
Replies
2
Boosts
0
Views
233
Activity
Jun ’25
Reply to Unable to Start macOS VM via Virtualization API in a Sandboxed Launchd Service
I think the answer here is “Don’t do that.” Virtualization framework is meant to be used by virtualisation apps. Such apps obviously run in a user context. A launchd agent is sufficiently close to a GUI user context that I fully expect that Virtualization will work there. Old school Unix-y context switching techniques, like the double fork thing, are generally OK if you limit yourself to Unix-y APIs, but they often cause problems when you use higher-level frameworks. That’s because they result in an inconsistent execution context, where part of the context has switched and part hasn’t. I discuss this ideal in a lot more detail in TN2083 Daemons and Agents (it’s old, but still remarkably relevant). Having said that, the immediate cause of your crash seems to be an App Sandbox re-initialisation issue. See Resolving App Sandbox Inheritance Problems. That’s not super surprising given your current setup, because this process has inherited its sandbox from your app. The best path forward depends o
Replies
Boosts
Views
Activity
Jun ’25
Reply to When DHCP is used, the Network Extension will cause the machine to fail to obtain an IP address
getnameinfo() doesn't always fail. Its failure has nothing to do with being in this problematic state, but it is indeed because of this problem that I consider using getnameinfo() for reverse DNS. In fact, MyTransparentProxyProvider will obtain some domain names set by the extension user, which indicates that the user wants to block access to these domain names. Initially, MyTransparentProxyProvider, when intercepted UDP Flow, if the target port is 53, would take over the Flow, and deal with the relationship between the Flow data to get the IP addresses to domain names table. However, due to this DHCP issue, I added an exclusion rule, which made me no longer obtain the UDP Flow on port 53. In this case, I consider using getnameinfo() to have a look. During the process of using getnameinfo(), I will first check whether -[NEAppProxyTCPFlow remoteHostname] is available. If it can be used, there is no need for reverse DNS; otherwise, I will try reverse DNS. For Safari's Flow, the value of -[NEAppProxyTCP
Replies
Boosts
Views
Activity
Jun ’25
Using Observation class for multiple SwiftData Models
Greetings i have an app that uses three different SwiftData models and i want to know what is the best way to use the them accross the app. I though a centralized behaviour and i want to know if it a correct approach.First let's suppose that the first view of the app will load the three models using the @Enviroment that work with @Observation. Then to other views that add data to the swiftModels again with the @Environment. Another View that will use the swiftData models with graph and datas for average and min and max.Is this a corrent way? or i should use @Query in every view that i want and ModelContext when i add the data. @Observable class CentralizedDataModels { var firstDataModel: [FirstDataModel] = [] var secondDataModel: [SecondDataModel] = [] var thirdDataModel: [ThirdDataModel] = [] let context: ModelContext init(context:ModelContext) { self.context = context } }
Replies
0
Boosts
0
Views
150
Activity
Jun ’25
Are these @model classes correct for swiftdata with cloudkit?
I have used core data before via the model editor. This is the first time I'm using swift data and that too with CloudKit. Can you tell me if the following model classes are correct? I have an expense which can have only one sub category which in turn belongs to a single category. Here are my classes... // Expense.swift // Pocket Expense Diary // // Created by Neerav Kothari on 16/05/25. // import Foundation import SwiftData @Model class Expense { @Attribute var expenseDate: Date? = nil @Attribute var expenseAmount: Double? = nil @Attribute var expenseCategory: Category? = nil @Attribute var expenseSubCategory: SubCategory? = nil var date: Date { get { return expenseDate ?? Date() } set { expenseDate = newValue } } var amount: Double{ get { return expenseAmount ?? 0.0 } set { expenseAmount = newValue } } var category: Category{ get { return expenseCategory ?? Category.init(name: , icon: ) } set { expenseCategory = newValue } } var subCategory: SubCategory{ get { return expenseSubCategory ?? SubCatego
Replies
1
Boosts
0
Views
137
Activity
Jun ’25
CloudKit Console: No Containers
Background: Our non-production App was using SwiftData locally. Yesterday we followed the documentation to enable CloudKit: https://developer.apple.com/documentation/cloudkit/enabling-cloudkit-in-your-app iCloud Works: Data is properly syncing via iCloud between 2 devices. Add on one shows on the other; delete on one deletes on the other. Today we logged into CloudKit Console for the first time; but there are no databases showing. We verified: Users and Roles: we have “Access to Cloud Managed… Certificates” Certificates, Identifiers & Profiles: our app has iCloud capabilities and is using our iCloud Container Signed into CloudKit Console with same developer ID as AppStoreConnect This is also the Apple ID of the iCloud account that has synced data from our app. In Xcode > Signing & Capabilities we are signed in as our Company team. Any guidance or tips to understanding how to what’s going on in CloudKit Console and gaining access to the database is appreciated!
Replies
1
Boosts
0
Views
237
Activity
Jun ’25
Error - Never access a full future backing data
Hi, I am building an iOS app with SwiftUI and SwiftData for the first time and I am experiencing a lot of difficulty with this error: Thread 44: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID( /MySwiftDataModel/p1>)), backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID( /MySwiftDataModel/p1>)) with Optional() I have been trying to figure out what the problem is, but unfortunately I cannot find any information in the documentation or on other sources online. My only theory about this error is that it is somehow related to fetching an entity that has been created in-memory, but not yet saved to the modelContext in SwiftData. However, when I am trying to debug this, it's not clear this is the case. Sometimes the error happens, sometimes it doesn't. Saving manually does not always solve the error. Therefore, i
Replies
1
Boosts
0
Views
200
Activity
Jun ’25
Reply to Migrating a swiftData project to CloudKit to implement iCloudSync.
What do I do with relationships? class Category { var expenses: [Expense] = [] }
Replies
Boosts
Views
Activity
Jun ’25
Feedback/issues for SwiftData custom store
Hello, thank you Apple for supporting custom store with SwiftData and the Schema type is superb to work with. I have successfully set one up with SQL and have some feedback and issues regarding its APIs. There’s a highlighted message in the documentation about not using internal restricted symbols directly, but they contradict with the given protocols and I am concerned about breaking any App Store rules. Are we allowed to use these? If not, they should be opened up as they’re useful. BackingData is required to set up custom snapshots, initialization, and getting/setting values. And I want to use it with createBackingData() to directly initialize instances from snapshots when transferring them between server and client or concurrency. RelationshipCollection for casting to-many relationships from backing data or checking if an array contains a PersistentModel. SchemaProperty for type erasure in a collection. Schema.Relationship has KeyPath properties, but it is missing for Schema.Attribute an
Replies
0
Boosts
0
Views
164
Activity
May ’25
ShieldConfigurationExtension & SwiftData
Hi, I am developing a Screen Time App and I am having issues with the ShieldConfigurationExtension (ShieldConfigurationDataSource). I know this extensions is sandboxed but I should be able to read data from the main app. I am using SwiftData as my database, but I am unable to initialize it in the extensions with an error indicating insufficient file permissions. I have App Group set up and I am able to share data using UserDefaults but that is just inconvenient. Is there any way I could just open the SwiftData in read only mode so that I could display the user some info on the shield? SwiftData Init: private func setupContainer() throws { let schema = Schema([ DogEntity.self, HouseEntity.self ]) // Use app group container if available let config: ModelConfiguration if let containerURL = FileManager.default.containerURL( forSecurityApplicationGroupIdentifier: group.(Bundle.app.bundleIdentifier ?? ) ) { config = ModelConfiguration(schema: schema, url: containerURL.appendingPathCompone
Replies
1
Boosts
0
Views
195
Activity
May ’25