Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

Reply to Importing Data into SwiftData in the Background Using ModelActor and @Query
[quote='808703022, Shirk, /thread/759364?answerId=808703022#808703022, /profile/Shirk'] One point especially is giving me grey hairs right now - if an @Model contains an array of other @Model's and a property of one of those changes via a background context the changes do not propagate at all even if the workaround by DTS Engineer is applied. [/quote] Sadly, this still seems to be broken even in iOS 26 beta. The one workaround that seems to work is to add the related model to the FetchDescriptor.relationshipKeyPathsForPrefetching pased to a Query (for directly related models) or add a @Query specifically for the related models. For the latter, one need not use the actual result of the @Query itself (though the results must be faulted, by for instance, calling items.isEmpty). Rather simply fetching them through a @Query appears to allow update notifications to work even if a view uses a model accessed via a relationship. For instance. Suppose one has two models, Shelf and Item. Shelf.items is [Item] a
Aug ’25
Reply to DocumentBrowser toolbar behavior in SwiftUI apps
Hi Ziqiao, the problem is that when you want to use SwiftData for an enterprise app, the user needs proper navigation. In such apps, you usually have more than one screen or form. I did some additional tests with your code and replaced the NavigationStack with a NavigationView. The reason is that I need the automatic two-column split for a sidebar menu and a detail view, not just a single view. The NavigationSplitView doesn’t seem to work as expected. Using it as a root view with an embedded TabView was my first attempt, but that didn’t work either. That’s why I tried embedding the NavigationSplitViews inside the TabView. When I replace your NavigationStack with a NavigationView, I get the automatic two-column view on iPad — but with a second navigation view below the DocumentGroup navigation view. This looks bugged. The NavigationSplitView also has issues with the back button and the document title in sheets. I’ll file a feedback report for now as you suggested and try to find a workaround for my ap
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Aug ’25
DocumentBrowser toolbar behavior in SwiftUI apps
I’m building a document-based SwiftData app (iPhone/iPad/Mac). Here’s a minimal example of how I’m using DocumentGroup. DocumentGroup(editing: Trip.self, contentType: .trips) { ContentView() } if #available(iOS 18.0, *) { DocumentGroupLaunchScene { NewDocumentButton(New Trip) } } I’m struggling with the toolbar behavior in DocumentGroup apps. My content view uses a TabView, and each tab contains a NavigationSplitView. After I select a document in the document browser, I see my tabs. Regardless of which tab is selected, there’s a navigation bar showing the document name and a back button to the document browser. However, only the first tab shows the disclosure button to rename the document. I’d expect to be able to rename the document anywhere the name is shown. When I navigate to the detail view of my NavigationSplitView (or when using NavigationView/NavigationStack), I still see that back button to the document browser. When the user taps it, they expect to go back to the previous view, not to the d
4
0
214
Aug ’25
Xcode 26 beta 5 - actool version decode error killing CI builds
Getting a weird build failure with Xcode 26 beta 5 that I haven't seen before. Build works fine locally but fails in CI when building with xcodebuild with this error: build description signature: 7cb0bf47dd6decc14090f5ae23d66594 Build description path: /Users/user/Library/Developer/Xcode/DerivedData/ProjectName-dpklhpaqruhpwdbkihszqtqogzfb/Build/Intermediates.noindex/XCBuildData/7cb0bf47dd6decc14090f5ae23d66594.xcbuilddata error: Failed to decode version info for '/Applications/Xcode-beta.app/Contents/Developer/usr/bin/actool': The data couldn’t be read because it is missing. (stdout: ' com.apple.ibtool.version bundle-version 24118.1 short-bundle-version 26.0 ', stderr: '' The thing is, the data is definitely there - actool is outputting valid XML: com.apple.ibtool.version bundle-version 24118.1 short-bundle-version 26.0 But xcodebuild keeps saying it's missing. This error repeats like 15 times in the build log. Build command: set -o pipefail && xcodebuild -workspace ProjectName/ProjectName.x
2
0
229
Aug ’25
Reply to Mixing in-memory and persistent SwiftData containers in a Document-based App?
Please correct me if my understanding is incorrect, but it seems to me that: Your app handles some document files (.myfile). Each document file has an associated KML/GPS file. You need to access the KML/GPS file with your own code when the document file is opened with DocumentGroup. When using DocumentGroup + SwiftData, the document file is a SwiftData store, and the framework manages the SwiftData model container (hence the store file) and provides a model context via a SwiftUI environment for you to access the data. With the model context and its model container, you are free to look into the SwiftData store, find the path of the associated KML/GPS file (assuming it is part of your SwiftData store), and access the KML/GPS data in your way (step 3). If you need to make the document file a bundle package that includes the SwiftData store file and the associated KML/GPS file, that is unsupported by today's DocumentGroup + SwiftData. Best, —— Ziqiao
Aug ’25
Mixing in-memory and persistent SwiftData containers in a Document-based App?
Hello, I'm trying to work on an iPadOS and macOS app that will rely on the document-based system to create some kind of orientation task to follow. Let say task1.myfile will be a check point regulation from NYC to SF and task2.myfile will be a visit as many key location as you can in SF. The file represent the specific landmark location and rules of the game. And once open, I will be able to read KML/GPS file to evaluate their score based with the current task. But opened GPS files does not have to be stored in the task file itself, it stay alongside. I wanted to use that scenario to experiment with SwiftData (I'm a long time CoreData user, I even wrote my own WebDAV based persistent store back in the day), and so, mix both on file and in memory persistent store, with distribution based on object class. With CoreData it would have been possible, but I do not see how to achieve that with SwiftData and DocumentGroup integration. Any idea how to do that?
1
0
135
Aug ’25
Reply to Matching between raw and APFS disk number
I have a raw device number, as an input, for external usb/thunderbolt device (i.e. for /dev/disk9 - it is 9). And I want to format it to APFS or read/confirm APFS FS type if it is already formatted. But I can see that APFS container/volume have another disk number (i.e /dev/disk10) in compare with for my raw disk. Yes and keep in mind that this is just one of many edge cases. IMHO, using the the content/structure of disk name to infer relationships between disks/volumes is a dangerous mistake- it works well enough to function under basic testing, but it will fail catastrophically. Disk paths should all treated as opaque values* which are retrieved through API, NOT strings which can be interpreted or built. *Note that the same exists between volume names and volume mount paths. That is, assuming that the volume named foo is mounted at /Volumes/foo is also dangerous programmatic error. Making this point explicitly: Or just add +1 to raw disk number for getting APFS container/volume disk device number?
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’25
SwiftData migration error: NSCloudKitMirroringDelegate are not reusable
Hello everyone, I used SwiftData for v1 of an app and am now trying to make changes to the schema for v2. I created the v2 schema that adds a property to one of the models. I need to populate the new property so I made a custom migration using didMigrate. However that doesn't seem to matter what I do in the migration because creating the ModelContainer throws an error before didMigrate ever gets called. The error is: Unresolved error loading container Error Domain=NSCocoaErrorDomain Code=134060 A Core Data error occurred. UserInfo={NSLocalizedFailureReason=Instances of NSCloudKitMirroringDelegate are not reusable and should have a lifecycle tied to a given instance of NSPersistentStore.} Higher up in the Xcode output I see things like this (in order): Request 'D25A8CB8-7341-4FA8-B2F8-3DE2D35B5273' was cancelled because the store was removed from the coordinator. BUG IN CLIENT OF CLOUDKIT: Registering a handler for a CKScheduler activity identifier that has already been registered CloudKit setup faile
16
0
1.6k
Aug ’25
.navigationTitle causes hang when creating a new item on a separate page, then navigating back to a TabView with PageTabViewStyle that is displaying that data on iOS 18.2
After a lot of testing and diagnosing, I found that when going to a item creation page, creating an item, navigating back to a TabView with a tabViewStyle of PageTabViewStyle and a navigationTitle that is displaying that data, and all inside of a NavigationStack, the app hangs. I have tested this on iOS 18.2, on both a simulator and a physical iPhone 16 Pro Max, and it always hangs, not crashing. However, when run on My Mac (Designed for iPad) and the iPad simulator, it doesn't crash. This could just be a really niche problem, but it might be the result of some other issue that could cause other problems. I have created a minimal reproducible example, stemming from the iOS App template, with SwiftUI and SwiftData. ContentView.swift import SwiftUI import SwiftData struct ContentView: View { @Environment(.modelContext) private var modelContext @Query private var items: [Item] var body: some View { NavigationStack { TabView { ForEach(items) { item in Text(item.timestamp, format: Date.FormatStyl
Topic: UI Frameworks SubTopic: SwiftUI
4
0
333
Aug ’25
Compile Error
When I added the ExcelIO library to my app and compiled it, the following error occurred: Framework 'SwiftSpreadsheet' not found Linker command failed with exit code 1 (use -v to see invocation) I added the following to my Podfile and installed it, but the error persists. (No errors occurred during pod install.) platform :ios, '9.0' Pods for medical_expense target 'medical_expense' do Comment the next line if you don't want to use dynamic frameworks use_frameworks! pod 'SwiftyTesseract', '~ 2.0' pod 'SwiftSpreadsheet' end Pods for Petty_staff target 'Petty_staffTests' do inherit! :search_paths pod 'ReachabilitySwift' Pods for testing end target 'Petty_staffUITests' do inherit! :search_paths Pods for testing end Note that SwiftSpreadsheet exists in /Users/ymdakr/MyAppli/Medical_Expense/Pods/Target Support Files/Pods-medical_expense/Pods-medical_expense.debug.xcconfig and /Users/ymdakr/MyAppli/Medical_Expense/Pods/Target Support Files/Pods-medical_expense/Pods-medical_expense.release.xcconfig
1
0
69
Aug ’25
Reply to Dynamic Library cannot call exposed C function
@DTS Engineer after much tweaking I've managed to reduce the working configuration to: s.user_target_xcconfig = { 'STRIP_STYLE' => 'non-global' } This works but sets the stripping style of the whole user project. I took a look at the output of Xcode build phases for the pod target and -exported_symbols_list doesn't work with cocoapods (out of the box) because cocoapods generates static lib by default. However setting s.static_framework = false did produce a dynamic framework but the symbols still are stripped. I'm not sure what other consequences STRIP_STYLE would have... sounds like a setting this only for my library is a bad idea, but I'm out of ideas on how to keep the symbols. I also tried passing each symbol directly to the linker and that also did not work s.user_target_xcconfig = { 'OTHER_LDFLAGS' => '$(inherited) -Wl,-u,_ios_prepare_request -Wl,-u,_ios_set_request_header -Wl,-u,_ios_present_webview -W...' }
Topic: Code Signing SubTopic: General Tags:
Aug ’25
SwiftData crash when using a @Query sort descriptor with a relationship
I am using SwiftData for storage and have a view that uses the @Query property wrapper with a sort descriptor that points to a relationship on a model. In a release build on device running iOS 18.3, the app crashes. This is the line that crashes: @Query(sort: Item.info.endDate, order: .reverse) private var items: [Item] Item has a relationship to ItemInfo, which is where the endDate property is defined. This code works in debug and on a simulator. In the project referenced here: https://github.com/lepolt/swiftdata-crash, change the scheme build configuration to “Release” and run on device. The app will crash. Using Xcode Version 16.2 (16C5032a) iPhone 12, iOS 18.3 (22D60)
9
0
1.5k
Aug ’25
SwiftData unversioned migration
Hi, I'm struggling with SwiftData and the components for migration and could really use some guidance. My specific questions are Is it possible to go from an unversioned schema to a versioned schema? Do all @Model classes need to be converted? Is there one VersionedSchema for the entire app that handles all models or one VersionedSchema per model? What is the relationship, if any, between the models given to ModelContainer in a [Schema] and the models in the VersionedSchema in a [any PersistentModel.Type] I have an app in the AppStore. I use SwiftData and have four @Models defined. I was not aware of VersionedSchema when I started, so they are unversioned. I want to update the model and am trying to convert to a VersionedSchema. I've tried various things and can't even get into the migration plan yet. All posts and tutorials that I've come across only deal with one Model, and create a VersionedSchema for that model. I've tried to switch the one Model I want to update, as well as swi
14
0
3.8k
Aug ’25
Reply to OpenIntent not executed with Visual Intelligence
I created a testing project where the issue could be repro. https://github.com/Helen-Xu/kitchen-app-visual-intelligence Excellent, thank you for that. With beta 5, I see displayed error message now change to Search results are limited, but perform method is still not hit and there's no error/logs in console. This is because your EntityQuery is returning an empty array: struct RecipeQuery: EntityQuery { func entities(for identifiers: [UUID]) async throws -> [RecipeEntity] { [] } However, there's one more important thing you need to do: struct RecipeEntity: AppEntity, Sendable { var id: UUID = UUID() AppEntity inherits the Identifiable protocol, and one of the key things about Identifiable is that it must be a stable identifier, which using the UUID initializer does not provide. This is a common mistake! The stability is foundational to a successful App Intents implementation, because these identifiers are sent to your EntityQuery implementation above from different invocations around the system — i
Aug ’25
Reply to Importing Data into SwiftData in the Background Using ModelActor and @Query
[quote='808703022, Shirk, /thread/759364?answerId=808703022#808703022, /profile/Shirk'] One point especially is giving me grey hairs right now - if an @Model contains an array of other @Model's and a property of one of those changes via a background context the changes do not propagate at all even if the workaround by DTS Engineer is applied. [/quote] Sadly, this still seems to be broken even in iOS 26 beta. The one workaround that seems to work is to add the related model to the FetchDescriptor.relationshipKeyPathsForPrefetching pased to a Query (for directly related models) or add a @Query specifically for the related models. For the latter, one need not use the actual result of the @Query itself (though the results must be faulted, by for instance, calling items.isEmpty). Rather simply fetching them through a @Query appears to allow update notifications to work even if a view uses a model accessed via a relationship. For instance. Suppose one has two models, Shelf and Item. Shelf.items is [Item] a
Replies
Boosts
Views
Activity
Aug ’25
Reply to DocumentBrowser toolbar behavior in SwiftUI apps
Hi Ziqiao, the problem is that when you want to use SwiftData for an enterprise app, the user needs proper navigation. In such apps, you usually have more than one screen or form. I did some additional tests with your code and replaced the NavigationStack with a NavigationView. The reason is that I need the automatic two-column split for a sidebar menu and a detail view, not just a single view. The NavigationSplitView doesn’t seem to work as expected. Using it as a root view with an embedded TabView was my first attempt, but that didn’t work either. That’s why I tried embedding the NavigationSplitViews inside the TabView. When I replace your NavigationStack with a NavigationView, I get the automatic two-column view on iPad — but with a second navigation view below the DocumentGroup navigation view. This looks bugged. The NavigationSplitView also has issues with the back button and the document title in sheets. I’ll file a feedback report for now as you suggested and try to find a workaround for my ap
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Aug ’25
DocumentBrowser toolbar behavior in SwiftUI apps
I’m building a document-based SwiftData app (iPhone/iPad/Mac). Here’s a minimal example of how I’m using DocumentGroup. DocumentGroup(editing: Trip.self, contentType: .trips) { ContentView() } if #available(iOS 18.0, *) { DocumentGroupLaunchScene { NewDocumentButton(New Trip) } } I’m struggling with the toolbar behavior in DocumentGroup apps. My content view uses a TabView, and each tab contains a NavigationSplitView. After I select a document in the document browser, I see my tabs. Regardless of which tab is selected, there’s a navigation bar showing the document name and a back button to the document browser. However, only the first tab shows the disclosure button to rename the document. I’d expect to be able to rename the document anywhere the name is shown. When I navigate to the detail view of my NavigationSplitView (or when using NavigationView/NavigationStack), I still see that back button to the document browser. When the user taps it, they expect to go back to the previous view, not to the d
Replies
4
Boosts
0
Views
214
Activity
Aug ’25
Xcode 26 beta 5 - actool version decode error killing CI builds
Getting a weird build failure with Xcode 26 beta 5 that I haven't seen before. Build works fine locally but fails in CI when building with xcodebuild with this error: build description signature: 7cb0bf47dd6decc14090f5ae23d66594 Build description path: /Users/user/Library/Developer/Xcode/DerivedData/ProjectName-dpklhpaqruhpwdbkihszqtqogzfb/Build/Intermediates.noindex/XCBuildData/7cb0bf47dd6decc14090f5ae23d66594.xcbuilddata error: Failed to decode version info for '/Applications/Xcode-beta.app/Contents/Developer/usr/bin/actool': The data couldn’t be read because it is missing. (stdout: ' com.apple.ibtool.version bundle-version 24118.1 short-bundle-version 26.0 ', stderr: '' The thing is, the data is definitely there - actool is outputting valid XML: com.apple.ibtool.version bundle-version 24118.1 short-bundle-version 26.0 But xcodebuild keeps saying it's missing. This error repeats like 15 times in the build log. Build command: set -o pipefail && xcodebuild -workspace ProjectName/ProjectName.x
Replies
2
Boosts
0
Views
229
Activity
Aug ’25
Reply to Mixing in-memory and persistent SwiftData containers in a Document-based App?
Please correct me if my understanding is incorrect, but it seems to me that: Your app handles some document files (.myfile). Each document file has an associated KML/GPS file. You need to access the KML/GPS file with your own code when the document file is opened with DocumentGroup. When using DocumentGroup + SwiftData, the document file is a SwiftData store, and the framework manages the SwiftData model container (hence the store file) and provides a model context via a SwiftUI environment for you to access the data. With the model context and its model container, you are free to look into the SwiftData store, find the path of the associated KML/GPS file (assuming it is part of your SwiftData store), and access the KML/GPS data in your way (step 3). If you need to make the document file a bundle package that includes the SwiftData store file and the associated KML/GPS file, that is unsupported by today's DocumentGroup + SwiftData. Best, —— Ziqiao
Replies
Boosts
Views
Activity
Aug ’25
Mixing in-memory and persistent SwiftData containers in a Document-based App?
Hello, I'm trying to work on an iPadOS and macOS app that will rely on the document-based system to create some kind of orientation task to follow. Let say task1.myfile will be a check point regulation from NYC to SF and task2.myfile will be a visit as many key location as you can in SF. The file represent the specific landmark location and rules of the game. And once open, I will be able to read KML/GPS file to evaluate their score based with the current task. But opened GPS files does not have to be stored in the task file itself, it stay alongside. I wanted to use that scenario to experiment with SwiftData (I'm a long time CoreData user, I even wrote my own WebDAV based persistent store back in the day), and so, mix both on file and in memory persistent store, with distribution based on object class. With CoreData it would have been possible, but I do not see how to achieve that with SwiftData and DocumentGroup integration. Any idea how to do that?
Replies
1
Boosts
0
Views
135
Activity
Aug ’25
Reply to Matching between raw and APFS disk number
I have a raw device number, as an input, for external usb/thunderbolt device (i.e. for /dev/disk9 - it is 9). And I want to format it to APFS or read/confirm APFS FS type if it is already formatted. But I can see that APFS container/volume have another disk number (i.e /dev/disk10) in compare with for my raw disk. Yes and keep in mind that this is just one of many edge cases. IMHO, using the the content/structure of disk name to infer relationships between disks/volumes is a dangerous mistake- it works well enough to function under basic testing, but it will fail catastrophically. Disk paths should all treated as opaque values* which are retrieved through API, NOT strings which can be interpreted or built. *Note that the same exists between volume names and volume mount paths. That is, assuming that the volume named foo is mounted at /Volumes/foo is also dangerous programmatic error. Making this point explicitly: Or just add +1 to raw disk number for getting APFS container/volume disk device number?
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’25
SwiftData migration error: NSCloudKitMirroringDelegate are not reusable
Hello everyone, I used SwiftData for v1 of an app and am now trying to make changes to the schema for v2. I created the v2 schema that adds a property to one of the models. I need to populate the new property so I made a custom migration using didMigrate. However that doesn't seem to matter what I do in the migration because creating the ModelContainer throws an error before didMigrate ever gets called. The error is: Unresolved error loading container Error Domain=NSCocoaErrorDomain Code=134060 A Core Data error occurred. UserInfo={NSLocalizedFailureReason=Instances of NSCloudKitMirroringDelegate are not reusable and should have a lifecycle tied to a given instance of NSPersistentStore.} Higher up in the Xcode output I see things like this (in order): Request 'D25A8CB8-7341-4FA8-B2F8-3DE2D35B5273' was cancelled because the store was removed from the coordinator. BUG IN CLIENT OF CLOUDKIT: Registering a handler for a CKScheduler activity identifier that has already been registered CloudKit setup faile
Replies
16
Boosts
0
Views
1.6k
Activity
Aug ’25
Reply to SwiftData migration error: NSCloudKitMirroringDelegate are not reusable
Sadly there is not much change in SwiftData in WWDC25 while fatal issues like this one must be fixed as soon as possible. Just to allow SwiftData works normally.
Replies
Boosts
Views
Activity
Aug ’25
.navigationTitle causes hang when creating a new item on a separate page, then navigating back to a TabView with PageTabViewStyle that is displaying that data on iOS 18.2
After a lot of testing and diagnosing, I found that when going to a item creation page, creating an item, navigating back to a TabView with a tabViewStyle of PageTabViewStyle and a navigationTitle that is displaying that data, and all inside of a NavigationStack, the app hangs. I have tested this on iOS 18.2, on both a simulator and a physical iPhone 16 Pro Max, and it always hangs, not crashing. However, when run on My Mac (Designed for iPad) and the iPad simulator, it doesn't crash. This could just be a really niche problem, but it might be the result of some other issue that could cause other problems. I have created a minimal reproducible example, stemming from the iOS App template, with SwiftUI and SwiftData. ContentView.swift import SwiftUI import SwiftData struct ContentView: View { @Environment(.modelContext) private var modelContext @Query private var items: [Item] var body: some View { NavigationStack { TabView { ForEach(items) { item in Text(item.timestamp, format: Date.FormatStyl
Topic: UI Frameworks SubTopic: SwiftUI
Replies
4
Boosts
0
Views
333
Activity
Aug ’25
Compile Error
When I added the ExcelIO library to my app and compiled it, the following error occurred: Framework 'SwiftSpreadsheet' not found Linker command failed with exit code 1 (use -v to see invocation) I added the following to my Podfile and installed it, but the error persists. (No errors occurred during pod install.) platform :ios, '9.0' Pods for medical_expense target 'medical_expense' do Comment the next line if you don't want to use dynamic frameworks use_frameworks! pod 'SwiftyTesseract', '~ 2.0' pod 'SwiftSpreadsheet' end Pods for Petty_staff target 'Petty_staffTests' do inherit! :search_paths pod 'ReachabilitySwift' Pods for testing end target 'Petty_staffUITests' do inherit! :search_paths Pods for testing end Note that SwiftSpreadsheet exists in /Users/ymdakr/MyAppli/Medical_Expense/Pods/Target Support Files/Pods-medical_expense/Pods-medical_expense.debug.xcconfig and /Users/ymdakr/MyAppli/Medical_Expense/Pods/Target Support Files/Pods-medical_expense/Pods-medical_expense.release.xcconfig
Replies
1
Boosts
0
Views
69
Activity
Aug ’25
Reply to Dynamic Library cannot call exposed C function
@DTS Engineer after much tweaking I've managed to reduce the working configuration to: s.user_target_xcconfig = { 'STRIP_STYLE' => 'non-global' } This works but sets the stripping style of the whole user project. I took a look at the output of Xcode build phases for the pod target and -exported_symbols_list doesn't work with cocoapods (out of the box) because cocoapods generates static lib by default. However setting s.static_framework = false did produce a dynamic framework but the symbols still are stripped. I'm not sure what other consequences STRIP_STYLE would have... sounds like a setting this only for my library is a bad idea, but I'm out of ideas on how to keep the symbols. I also tried passing each symbol directly to the linker and that also did not work s.user_target_xcconfig = { 'OTHER_LDFLAGS' => '$(inherited) -Wl,-u,_ios_prepare_request -Wl,-u,_ios_set_request_header -Wl,-u,_ios_present_webview -W...' }
Topic: Code Signing SubTopic: General Tags:
Replies
Boosts
Views
Activity
Aug ’25
SwiftData crash when using a @Query sort descriptor with a relationship
I am using SwiftData for storage and have a view that uses the @Query property wrapper with a sort descriptor that points to a relationship on a model. In a release build on device running iOS 18.3, the app crashes. This is the line that crashes: @Query(sort: Item.info.endDate, order: .reverse) private var items: [Item] Item has a relationship to ItemInfo, which is where the endDate property is defined. This code works in debug and on a simulator. In the project referenced here: https://github.com/lepolt/swiftdata-crash, change the scheme build configuration to “Release” and run on device. The app will crash. Using Xcode Version 16.2 (16C5032a) iPhone 12, iOS 18.3 (22D60)
Replies
9
Boosts
0
Views
1.5k
Activity
Aug ’25
SwiftData unversioned migration
Hi, I'm struggling with SwiftData and the components for migration and could really use some guidance. My specific questions are Is it possible to go from an unversioned schema to a versioned schema? Do all @Model classes need to be converted? Is there one VersionedSchema for the entire app that handles all models or one VersionedSchema per model? What is the relationship, if any, between the models given to ModelContainer in a [Schema] and the models in the VersionedSchema in a [any PersistentModel.Type] I have an app in the AppStore. I use SwiftData and have four @Models defined. I was not aware of VersionedSchema when I started, so they are unversioned. I want to update the model and am trying to convert to a VersionedSchema. I've tried various things and can't even get into the migration plan yet. All posts and tutorials that I've come across only deal with one Model, and create a VersionedSchema for that model. I've tried to switch the one Model I want to update, as well as swi
Replies
14
Boosts
0
Views
3.8k
Activity
Aug ’25
Reply to OpenIntent not executed with Visual Intelligence
I created a testing project where the issue could be repro. https://github.com/Helen-Xu/kitchen-app-visual-intelligence Excellent, thank you for that. With beta 5, I see displayed error message now change to Search results are limited, but perform method is still not hit and there's no error/logs in console. This is because your EntityQuery is returning an empty array: struct RecipeQuery: EntityQuery { func entities(for identifiers: [UUID]) async throws -> [RecipeEntity] { [] } However, there's one more important thing you need to do: struct RecipeEntity: AppEntity, Sendable { var id: UUID = UUID() AppEntity inherits the Identifiable protocol, and one of the key things about Identifiable is that it must be a stable identifier, which using the UUID initializer does not provide. This is a common mistake! The stability is foundational to a successful App Intents implementation, because these identifiers are sent to your EntityQuery implementation above from different invocations around the system — i
Replies
Boosts
Views
Activity
Aug ’25