Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

CATiledLayer flashes and re-draws entirely when re-drawing a single tile
I have filed a bug report for this (FB17734946), but I'm posting it here verbatim in case others have the same issue and in hopes of getting attention from an Apple engineer sooner. When calling setNeedsDisplayInRect on a CATiledLayer - or a UIView whose backing layer is CATiledLayer - one would expect to re-draw only a region identified by the rect passed to the method. This is even written in the documentation for the class: Regions of the layer may be invalidated using the setNeedsDisplayInRect: method however the update will be asynchronous. While the next display update will most likely not contain the updated content, a future update will. However, upon calling this method, CATiledLayer redraws whole contents instead of just the tile at the specified rect, and it flashes when doing so. It behaves exactly the same as if one had called setNeedsDisplay without passing any rect; all contents are cleared and re-drawn again. I'm 100% sure I've passed in the correct rect of the exact tile that I need to redraw
3
0
204
May ’25
Reply to No persistent stores error in SwiftData
The crash you’re seeing— FAULT: NSInternalInconsistencyException: This NSPersistentStoreCoordinator has no persistent stores (unknown). It cannot perform a save operation. (Apple Developer) —happens because by the time your onAppear runs, the debug block has already loaded and then removed the only store from the underlying NSPersistentCloudKitContainer. When you immediately call newContainer = try ModelContainer(for: Page.self, configurations: config) SwiftData’s internal coordinator finds no stores to save into and throws. The fix is to perform both the CloudKit‐schema initialization and your ModelContainer setup early, in your App struct (or in its init), rather than inside an onAppear. That way SwiftData creates its SQLite store after you’ve torn down the temporary CloudKit container, so it can recreate a fresh store. For example: @main struct MyApp: App { // 1) Build your debug store, initializeCloudKitSchema, remove it… // 2) Then immediately create the SwiftData ModelContaine
May ’25
Reply to Mixing ReferenceFileDocument and @Observable
When I register Undos, I name them so that I can make the undo available via a menu selection that shows specifically what will be undone or redone. Hoping that a shake gesture will work seems much less desirable than giving the user explicit control over undo / redo - and in any event, I've read that the Undo manager doesn't actually work with SwiftData.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to Does adding a bar button item to the navigation bar programmatically when offering scene support differ from the old app delegate approach
Ok, now I understand. In my original project, I mistakenly made my root view controller be the initial controller when I was upgrading to a scene lifecycle. I did have a navigation controller, but when I made my root view controller the initial controller, it removed the initial controller status from the navigation controller. That prevented the navigation bar item from working. So in this test project, once I added a navigation controller (as you suggested) and made the ViewController have a root view controller relationship to the navigation controller, then it works. Thanks.
Topic: UI Frameworks SubTopic: UIKit Tags:
May ’25
Reply to Mixing ReferenceFileDocument and @Observable
Unfortunately, ReferenceFileDocument inherits from ObservableObject, which seems to not play nice with @Observable. Is there any specific reason to make the document type a class, you could have a FileDocument-conforming struct and vent that to your View as a State or through a model object that conforms to @Observable.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to How to distribute DEXT during development and to the public
With regard to this issue, I confirmed that this error occurs when the bundle ID length is longer than 64 characters. Are there any such limitation? Yes. More specifically, because of how DEXTs are integrated into the kernel, they end up inheriting limitation/restrictions that the kernel implements but the larger system does not. As another example, many Xcode project use CFBundleVersion for an incrementing build number but the kernel actually enforces it's own fairly rigid format which the kextload system then enforces on DEXTs. __ Kevin Elliott DTS Engineer, CoreOS/Hardware
May ’25
Reply to iOS Camera access issues in Developer mode on real device - PermissionStatus.permanentlyDenied
Looks like I had to modify iOS/Podfile to make this work # --- BEGIN: permission_handler camera macro --- # The following block explicitly enables camera permission for the permission_handler plugin. # Remove or comment out this block if you want to revert to default behavior. post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ '$(inherited)', 'PERMISSION_CAMERA=1', # <-- Explicitly enable camera permission ] end end end # --- END: permission_handler camera macro ---
May ’25
Retrieving each user’s “last login” timestamp via the App Store Connect API – is it possible?
Hello everyone, I’m building a custom tool that uses the App Store Connect API (v1) to manage my team’s users. I can successfully list all users with: GET https://api.appstoreconnect.apple.com/v1/users …but the JSON response only includes fields like firstName, lastName, email, allAppsVisible, provisioningAllowed, and roles. There is no lastLogin or timestamp field anywhere in the User object: { data: [ { id: USER_ID, type: users, attributes: { firstName: mohit, lastName: tiwari, email: , allAppsVisible: false, provisioningAllowed: false }, relationships: { … } }, … ] } My main question is: How can I retrieve each user’s “last login” timestamp via the App Store Connect API? Is this even possible with the current endpoints? If it isn’t exposed, has Apple any plans to add this? Or are there any recommended workarounds—perhaps via audit logs or another API—to track when each user last accessed App Store Connect? Thanks in advance for your guidance and any code/endpoint examples you can share!
0
0
127
May ’25
No persistent stores error in SwiftData
I am following Apple's instruction to sync SwiftData with CloudKit. While initiating the ModelContainer, right after removing the store from Core Data, the error occurs: FAULT: NSInternalInconsistencyException: This NSPersistentStoreCoordinator has no persistent stores (unknown). It cannot perform a save operation.; (user info absent) I've tried removing default.store and its related files/folders before creating the ModelContainer with FileManager but it does not resolve the issue. Isn't it supposed to create a new store when the ModelContainer is initialized? I don't understand why this error occurs. Error disappears when I comment out the #if DEBUG block. Code: import CoreData import SwiftData import SwiftUI struct InitView: View { @Binding var modelContainer: ModelContainer? @Binding var isReady: Bool @State private var loadingDots = @State private var timer: Timer? var body: some View { VStack(spacing: 16) { Text(Loading(loadingDots)) .font(.title2) .foregroundColor(.gray) } .padding()
2
0
197
May ’25
Mixing ReferenceFileDocument and @Observable
I have an app in which the data model is @Observable, and views see it through @Environment(dataModel.self) private var dataModel. Since there are a large number of views, only some of which may need to be redrawn at a given time, I believe that @Observable is more efficient at run time than @Published and @ObservedObject I’ve been trying to make the app document based. Although I started using SwiftData, it has trouble with Codable, and a long thread in the Developer forum suggests that SwiftData does not support the Undo manager - and in any event, simple JSON serialization is all that this app requires. Unfortunately, ReferenceFileDocument inherits from ObservableObject, which seems to not play nice with @Observable. I’d like to keep using @Observable, but haven’t been able to figure out how. When I deserialize a JSON ReferenceFileDocument, I can’t seem to connect it to an @Observable class instance and to let the various views and view models know where to find and update it. I’
4
0
170
May ’25
SwiftData + CloudKit causes watchOS app termination during WKExtendedRuntimeSession (FB17685611)
Hi all, I’m encountering a consistent issue with SwiftData on watchOS when using CloudKit sync. After enabling: let config = ModelConfiguration(schema: schema, cloudKitDatabase: .automatic) …the app terminates ~30–60 seconds into a WKExtendedRuntimeSession. This happens specifically when: Always-On Display is OFF The iPhone is disconnected or in Airplane Mode The app is running in a WKExtendedRuntimeSession (e.g., used for meditation tracking) The Xcode logs show a warning: Background Task (CoreData: CloudKit Setup), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. It appears CloudKit sync setup is being triggered automatically and flagged by the system as an unmanaged long-running task, leading to termination. Workaround: Switching to: let config = ModelConfiguration(schema: schema, cloudKitDatabase: .none) …prevents the issue entirely — no background task warning, no crash. Feedback ID submitted: FB17685611 Just wanted to check if other
1
0
277
May ’25
Migrating a swiftData project to CloudKit to implement iCloudSync.
My project is using swiftData and I want to implement iCloud sync in it. Now, my data base doesnt have any optional attributes or relationships and CloudKit wants them to be optional. So, rather than editing all code with unwrapping code for the optionals, how can I provide a bridge that does so in the last stage of actually saving to the store? Sort of, capture it in a proxy object before writing and after reading from the store. Is there a neat way that can save a lot of debugging? I have code snippets from chat gpt and they are hard to debug. This is my first project in swiftUI. Thanks. Neerav
3
0
190
May ’25
CoreData error: SQLCore dispatchRequest: no such table: ZAPPSETTINGS. I/O error opening
Issue with SwiftData: “no such table: ZAPPSETTINGS” and SQLite I/O error on app launch Hello, I’m encountering persistent errors with SwiftData in my SwiftUI app related to Core Data’s underlying SQLite database. Despite defining my models correctly, the app fails to initialize the persistent store, throwing the following error on startup: CoreData error: SQLCore dispatchRequest: no such table: ZAPPSETTINGS. I/O error opening database at /.../default.store. SQLite error code:1, NSSQLiteErrorDomain=1. File “default.store” couldn’t be opened. Context The error only appears concerning my AppSettings model. I have another model, LocationPoint, which appears correctly defined and used. I have tried deleting the app, resetting the device, and cleaning builds but the error persists. The error message suggests the database file is present but the table for ZAPPSETTINGS (the Core Data table for AppSettings) does not exist. Code Samples Main App Entry import SwiftData import SwiftUI @main str
1
0
127
May ’25
CATiledLayer flashes and re-draws entirely when re-drawing a single tile
I have filed a bug report for this (FB17734946), but I'm posting it here verbatim in case others have the same issue and in hopes of getting attention from an Apple engineer sooner. When calling setNeedsDisplayInRect on a CATiledLayer - or a UIView whose backing layer is CATiledLayer - one would expect to re-draw only a region identified by the rect passed to the method. This is even written in the documentation for the class: Regions of the layer may be invalidated using the setNeedsDisplayInRect: method however the update will be asynchronous. While the next display update will most likely not contain the updated content, a future update will. However, upon calling this method, CATiledLayer redraws whole contents instead of just the tile at the specified rect, and it flashes when doing so. It behaves exactly the same as if one had called setNeedsDisplay without passing any rect; all contents are cleared and re-drawn again. I'm 100% sure I've passed in the correct rect of the exact tile that I need to redraw
Replies
3
Boosts
0
Views
204
Activity
May ’25
Reply to No persistent stores error in SwiftData
The crash you’re seeing— FAULT: NSInternalInconsistencyException: This NSPersistentStoreCoordinator has no persistent stores (unknown). It cannot perform a save operation. (Apple Developer) —happens because by the time your onAppear runs, the debug block has already loaded and then removed the only store from the underlying NSPersistentCloudKitContainer. When you immediately call newContainer = try ModelContainer(for: Page.self, configurations: config) SwiftData’s internal coordinator finds no stores to save into and throws. The fix is to perform both the CloudKit‐schema initialization and your ModelContainer setup early, in your App struct (or in its init), rather than inside an onAppear. That way SwiftData creates its SQLite store after you’ve torn down the temporary CloudKit container, so it can recreate a fresh store. For example: @main struct MyApp: App { // 1) Build your debug store, initializeCloudKitSchema, remove it… // 2) Then immediately create the SwiftData ModelContaine
Replies
Boosts
Views
Activity
May ’25
Reply to Mixing ReferenceFileDocument and @Observable
When I register Undos, I name them so that I can make the undo available via a menu selection that shows specifically what will be undone or redone. Hoping that a shake gesture will work seems much less desirable than giving the user explicit control over undo / redo - and in any event, I've read that the Undo manager doesn't actually work with SwiftData.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Does adding a bar button item to the navigation bar programmatically when offering scene support differ from the old app delegate approach
Ok, now I understand. In my original project, I mistakenly made my root view controller be the initial controller when I was upgrading to a scene lifecycle. I did have a navigation controller, but when I made my root view controller the initial controller, it removed the initial controller status from the navigation controller. That prevented the navigation bar item from working. So in this test project, once I added a navigation controller (as you suggested) and made the ViewController have a root view controller relationship to the navigation controller, then it works. Thanks.
Topic: UI Frameworks SubTopic: UIKit Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to Mixing ReferenceFileDocument and @Observable
Unfortunately, ReferenceFileDocument inherits from ObservableObject, which seems to not play nice with @Observable. Is there any specific reason to make the document type a class, you could have a FileDocument-conforming struct and vent that to your View as a State or through a model object that conforms to @Observable.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Reply to How to distribute DEXT during development and to the public
With regard to this issue, I confirmed that this error occurs when the bundle ID length is longer than 64 characters. Are there any such limitation? Yes. More specifically, because of how DEXTs are integrated into the kernel, they end up inheriting limitation/restrictions that the kernel implements but the larger system does not. As another example, many Xcode project use CFBundleVersion for an incrementing build number but the kernel actually enforces it's own fairly rigid format which the kextload system then enforces on DEXTs. __ Kevin Elliott DTS Engineer, CoreOS/Hardware
Replies
Boosts
Views
Activity
May ’25
Reply to iOS Camera access issues in Developer mode on real device - PermissionStatus.permanentlyDenied
Looks like I had to modify iOS/Podfile to make this work # --- BEGIN: permission_handler camera macro --- # The following block explicitly enables camera permission for the permission_handler plugin. # Remove or comment out this block if you want to revert to default behavior. post_install do |installer| installer.pods_project.targets.each do |target| flutter_additional_ios_build_settings(target) target.build_configurations.each do |config| config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ '$(inherited)', 'PERMISSION_CAMERA=1', # <-- Explicitly enable camera permission ] end end end # --- END: permission_handler camera macro ---
Replies
Boosts
Views
Activity
May ’25
Retrieving each user’s “last login” timestamp via the App Store Connect API – is it possible?
Hello everyone, I’m building a custom tool that uses the App Store Connect API (v1) to manage my team’s users. I can successfully list all users with: GET https://api.appstoreconnect.apple.com/v1/users …but the JSON response only includes fields like firstName, lastName, email, allAppsVisible, provisioningAllowed, and roles. There is no lastLogin or timestamp field anywhere in the User object: { data: [ { id: USER_ID, type: users, attributes: { firstName: mohit, lastName: tiwari, email: , allAppsVisible: false, provisioningAllowed: false }, relationships: { … } }, … ] } My main question is: How can I retrieve each user’s “last login” timestamp via the App Store Connect API? Is this even possible with the current endpoints? If it isn’t exposed, has Apple any plans to add this? Or are there any recommended workarounds—perhaps via audit logs or another API—to track when each user last accessed App Store Connect? Thanks in advance for your guidance and any code/endpoint examples you can share!
Replies
0
Boosts
0
Views
127
Activity
May ’25
No persistent stores error in SwiftData
I am following Apple's instruction to sync SwiftData with CloudKit. While initiating the ModelContainer, right after removing the store from Core Data, the error occurs: FAULT: NSInternalInconsistencyException: This NSPersistentStoreCoordinator has no persistent stores (unknown). It cannot perform a save operation.; (user info absent) I've tried removing default.store and its related files/folders before creating the ModelContainer with FileManager but it does not resolve the issue. Isn't it supposed to create a new store when the ModelContainer is initialized? I don't understand why this error occurs. Error disappears when I comment out the #if DEBUG block. Code: import CoreData import SwiftData import SwiftUI struct InitView: View { @Binding var modelContainer: ModelContainer? @Binding var isReady: Bool @State private var loadingDots = @State private var timer: Timer? var body: some View { VStack(spacing: 16) { Text(Loading(loadingDots)) .font(.title2) .foregroundColor(.gray) } .padding()
Replies
2
Boosts
0
Views
197
Activity
May ’25
Reply to SwiftData/ModelSnapshot.swift:46: Fatal error: A ModelSnapshot must be initialized with a known-keys dictionary
I have the same issue in my app, which a user pointed out to me yesterday. However, in my case, the crash only occurs when a widget on the Home Screen is using the SwiftData model object I'm trying to delete. Does your app use widgets, out of interest?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
May ’25
Mixing ReferenceFileDocument and @Observable
I have an app in which the data model is @Observable, and views see it through @Environment(dataModel.self) private var dataModel. Since there are a large number of views, only some of which may need to be redrawn at a given time, I believe that @Observable is more efficient at run time than @Published and @ObservedObject I’ve been trying to make the app document based. Although I started using SwiftData, it has trouble with Codable, and a long thread in the Developer forum suggests that SwiftData does not support the Undo manager - and in any event, simple JSON serialization is all that this app requires. Unfortunately, ReferenceFileDocument inherits from ObservableObject, which seems to not play nice with @Observable. I’d like to keep using @Observable, but haven’t been able to figure out how. When I deserialize a JSON ReferenceFileDocument, I can’t seem to connect it to an @Observable class instance and to let the various views and view models know where to find and update it. I’
Replies
4
Boosts
0
Views
170
Activity
May ’25
SwiftData + CloudKit causes watchOS app termination during WKExtendedRuntimeSession (FB17685611)
Hi all, I’m encountering a consistent issue with SwiftData on watchOS when using CloudKit sync. After enabling: let config = ModelConfiguration(schema: schema, cloudKitDatabase: .automatic) …the app terminates ~30–60 seconds into a WKExtendedRuntimeSession. This happens specifically when: Always-On Display is OFF The iPhone is disconnected or in Airplane Mode The app is running in a WKExtendedRuntimeSession (e.g., used for meditation tracking) The Xcode logs show a warning: Background Task (CoreData: CloudKit Setup), was created over 30 seconds ago. In applications running in the background, this creates a risk of termination. It appears CloudKit sync setup is being triggered automatically and flagged by the system as an unmanaged long-running task, leading to termination. Workaround: Switching to: let config = ModelConfiguration(schema: schema, cloudKitDatabase: .none) …prevents the issue entirely — no background task warning, no crash. Feedback ID submitted: FB17685611 Just wanted to check if other
Replies
1
Boosts
0
Views
277
Activity
May ’25
Reply to CoreData error: SQLCore dispatchRequest: no such table: ZAPPSETTINGS. I/O error opening
You could enable Core Data debug logging (also used by SwiftData) to see if that gives you any important information, see https://www.hackingwithswift.com/quick-start/swiftdata/using-launch-arguments-to-debug-swiftdata-and-core-data
Topic: Community SubTopic: Apple Developers Tags:
Replies
Boosts
Views
Activity
May ’25
Migrating a swiftData project to CloudKit to implement iCloudSync.
My project is using swiftData and I want to implement iCloud sync in it. Now, my data base doesnt have any optional attributes or relationships and CloudKit wants them to be optional. So, rather than editing all code with unwrapping code for the optionals, how can I provide a bridge that does so in the last stage of actually saving to the store? Sort of, capture it in a proxy object before writing and after reading from the store. Is there a neat way that can save a lot of debugging? I have code snippets from chat gpt and they are hard to debug. This is my first project in swiftUI. Thanks. Neerav
Replies
3
Boosts
0
Views
190
Activity
May ’25
CoreData error: SQLCore dispatchRequest: no such table: ZAPPSETTINGS. I/O error opening
Issue with SwiftData: “no such table: ZAPPSETTINGS” and SQLite I/O error on app launch Hello, I’m encountering persistent errors with SwiftData in my SwiftUI app related to Core Data’s underlying SQLite database. Despite defining my models correctly, the app fails to initialize the persistent store, throwing the following error on startup: CoreData error: SQLCore dispatchRequest: no such table: ZAPPSETTINGS. I/O error opening database at /.../default.store. SQLite error code:1, NSSQLiteErrorDomain=1. File “default.store” couldn’t be opened. Context The error only appears concerning my AppSettings model. I have another model, LocationPoint, which appears correctly defined and used. I have tried deleting the app, resetting the device, and cleaning builds but the error persists. The error message suggests the database file is present but the table for ZAPPSETTINGS (the Core Data table for AppSettings) does not exist. Code Samples Main App Entry import SwiftData import SwiftUI @main str
Replies
1
Boosts
0
Views
127
Activity
May ’25