Search results for

“SwiftData inheritance relationship”

4,982 results found

Post

Replies

Boosts

Views

Activity

Can SMAppService Daemon replace SMJobBless for exclusive HID capture from keyboards?
To gain exclusive access to keyboard HID devices like Amazon Fire Bluetooth remote controls, my app has been installing a privileged helper tool with SMJobBless in the past. The app - which also has Accessibility permissions - then invoked and communicated with that helper tool through XPC. Now I'm looking into replacing that with a daemon installed through the newer SMAppService APIs, but running into a permission problem: If I try to exclusively open a keyboard HID device from the SMAppService-registered XPC service/daemon (which runs as root as seen in Activity Monitor), IOHIDDeviceOpen returns kIOReturnNotPermitted. I've spent many hours now trying to get it to work, but so far didn't find a solution. Could it be that XPC services registered as a daemon through SMAppService do not inherit the TCC permissions from the invoking process (here: Accessibility permissions) - and the exclusive IOHIDDeviceOpen therefore fails?
7
0
320
Aug ’25
Reply to es_mute_path() vs. deprecated es_mute_path_literal() - incompatibility and wrong documentation
That should be it. Thank you. But I urge you to re-read the canonical documentation in the headers. The difference you point out here (between PATH_TYPE_TARGET_LITERAL and PATH_TYPE_LITERAL) is not written there. The very simple distinction between the path of the executable creating the event and the path of the file which is the target of the event -- is simply not there. Yes, it could definitely be clearer on that point. It was fairly clear in the original API (when all you could block was by process), but when TARGET was added, it was documented in great detail, but we didn't go back and include a clear definition of the original constant. I just filed a bug asking for us to clarify the two roles in the enum definition comments. Having said that, this flowchart at line ~500 of ESClient.h does do a good job of describing what's going on, though it does not directly reference the specific constants involved: * The relationship between all three types of muting (proc,path,target-path) and how each c
Topic: App & System Services SubTopic: Core OS Tags:
Aug ’25
Reply to SwiftData crash when using a @Query sort descriptor with a relationship
@DTS Engineer this is still an issue in iOS 26 when sorting on a property of an optional relationship. @Query(sort: Item.info?.endDate, order: .reverse) private var items: [Item] @Model final class Item { var info: ItemInfo? init(info: ItemInfo) { self.info = info } } @Model final class ItemInfo { var endDate: Date init(endDate: Date) { self.endDate = endDate } } SwiftData/DataUtilities.swift:85: Fatal error: Couldn't find Item.)>?.? on Item with fields [SwiftData.Schema.PropertyMetadata(name: info, keypath: Item.)>, defaultValue: nil, metadata: nil)] iOS Simulator 26.0 beta 4 (23A5297i) Xcode Version 26.0 beta 4 (17A5285i) I made a minimal fork of the project @Atletismo343 provided: https://github.com/coughski/swiftdata-crash
Aug ’25
visionOS: Unable to programmatically close child WindowGroup when parent window closes
Hi , I'm struggling with visionOS window management and need help with closing child windows programmatically. App Structure My app has a Main-Sub window hierarchy: AWindow (Home/Main) BWindow (Main feature window) CWindow (Tool window - child of BWindow) Navigation flow: AWindow → BWindow (switch, 1 window on screen) BWindow → CWindow (opens child, 2 windows on screen) I want BWindow and CWindow to be separate movable windows (not sheet/popover) so users can position them independently in space. The Problem CWindow doesn't close when BWindow closes by tapping the X button below the app (next to the window bar) User clicks X on BWindow → BWindow closes but CWindow remains CWindow becomes orphaned on screen Can close CWindow programmatically when switching BWindow back to AWindow App launch issue After closing both windows, CWindow is remembered as last window Reopening app shows only CWindow instead of BWindow User gets stuck in CWindow with no way back to BWindow I've Tried Environment dismissWindow in clean
2
0
367
Aug ’25
Reply to Upgrading an SMAppService daemon and changing the plist
[quote='851343022, nkirby, /thread/795022?answerId=851343022#851343022, /profile/nkirby'] We split the application from a monolithic binary into separate GUI and daemon executables. [/quote] Oh, yeah, that makes sense now that I look back at the property lists in your first post. [quote='851343022, nkirby, /thread/795022?answerId=851343022#851343022, /profile/nkirby'] Is there a way to tell launchd about the change? [/quote] Not that I’m aware of. Just as an experiment, if you override the code signing identifier of the daemon to match that of the main app, does that fix this problem? If you’er using code, change the code signing identifier by setting the Other Code Signing Flags build setting to [ $(inherited), --identifier, org.mozilla.macos.FirefoxVPN]. IMPORTANT I see a lot of folks put a lot of weird stuff in the Other Code Signing Flags build setting. I recommend against that in general, but it is a reasonable way to override the code signing identifier in a program that has no bundle ID. Share
Topic: App & System Services SubTopic: Core OS Tags:
Jul ’25
UITabBar hitTest method is not triggered when click button that is a subview of UITabBar and the subview frame is beyond UITabBar when using Xcode26 build app on OS 26
In our project, we defined a CustomTabBar that inherits UITabBar, and we add some subviews and these subviews' frame is beyond UITabBar, see below picture(a beyond area button, this button is a subview of UITabBar, but frame is out of UITabBar's area): and in order to let this button response to click action, we override the UITabBar's hitTest method, this works well below OS 26 with Xcode version below 26: override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { let pointInCollectionView = self.beyondAreaButton.convert(point, from: self) if self.beyondAreaButton.bounds.contains(pointInCollectionView) { return self.beyondAreaButton.hitTest(pointInCollectionView, with: event) } return super.hitTest(point, with: event) } but when using Xcode26 build app on OS 26, I noticed the UITabBar is wrapped by a UIKit._UITabBarContainerView and UIKit._UITabBarContainerWrapperView, and it can not trigger the hitTest method. since the hitTest is not triggered, so the button action is no
1
0
228
Jul ’25
Reply to CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
Thanks for your clarification. For my curiosity: @main struct FoodGuardApp: App { var body: some Scene { WindowGroup { ContentView() } .modelContainer(for: FoodItem.self, configurations: [ ModelConfiguration(Default, cloudKitDatabase: .shared) ]) } } The above code doesn't build (because .shared isn't supported), does it? The sharing worked locally (between users in the same Apple ID)... If the code doesn't build, I am super curious how the sharing worked locally ... I am guessing that you probably added .shared with your own code by extending ModelConfiguration.CloudKitDatabase, and that SwiftData falled back to .private because it didn't know .shared. That will explain why the synchronization of the private database works, but is definitely not the way to support CloudKit sharing. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Jul ’25
Reply to CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
Thanks a lot, Ziqiao, for your quick response. You’re absolutely right – I now realize that .shared CloudKit containers are not yet supported with SwiftData. In my implementation, I attempted to use a SwiftData model with a ModelContainer(for:sharing:) configuration and used UICloudSharingController to manage sharing between Apple IDs. The ModelContainer was configured like this: @main struct FoodGuardApp: App { var body: some Scene { WindowGroup { ContentView() } .modelContainer(for: FoodItem.self, configurations: [ ModelConfiguration(Default, cloudKitDatabase: .shared) ]) } } The sharing worked locally (between users in the same Apple ID), but failed when another Apple ID accepted the share, producing this error: CKError: Bad Container (5/1014) Couldn't get container configuration from the server for container iCloud.com.de.seki.FoodGuard Based on your reply and DTS confirmation, I now plan to migrate my project to Core Data + CloudKit, using NSPersistentCloudKitContainer and UICloudSharin
Jul ’25
Reply to CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
As of today, SwiftData + CloudKit integration doesn't support CloudKit sharing, as you can see that ModelConfiguration.CloudKitDatabase only has private(_:). I am wondering what SwiftData with CloudKit sharing means in your context. If you don't mind to share more details about your implementation, together with the code snippet that triggers the CloudKit error, I'd probably have more to comment. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Jul ’25
CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
Hi everyone, I’m currently developing a SwiftUI app that uses SwiftData with CloudKit sharing enabled. The app works fine on my own Apple ID, and local syncing with iCloud is functioning correctly — but sharing with other Apple IDs consistently fails. Setup: SwiftUI + SwiftData using a ModelContainer with .shared configuration Sharing UI is handled via UICloudSharingController iCloud container: iCloud.com.de.SkerskiDev.FoodGuard Proper entitlements enabled (com.apple.developer.icloud-services, CloudKit, com.apple.developer.coredata.cloudkit.containers, etc.) Automatic provisioning profiles created by Xcode Error: What I’ve tried: Verified the iCloud container is correctly created and enabled in the Apple Developer portal Checked bundle identifier and container settings Rebuilt and reinstalled the app Ensured correct iCloud entitlements and signing capabilities Questions: Why does CloudKit reject the container for sharing while local syncing works fine? Are there known issues with SwiftData
4
0
278
Jul ’25
Structured concurrency + preconcurrency API (SFAuthorizationPluginView)
I'm having trouble dealing with concurrency with the SFAuthorizationPluginView. Does anybody know how this can be solved? https://developer.apple.com/documentation/securityinterface/sfauthorizationpluginview The crux of it is: If I inherit an object as part of an API, and the API is preconcurrency, and thus is nonisolated (but in reality is @MainActor), how do I return a @MainActor GUI element? https://developer.apple.com/documentation/securityinterface/sfauthorizationpluginview/firstresponder() The longer story: I made my view class inherit SFAuthorizationPluginView. The API is preconcurrency (but not marked as preconcurrency) I started using concurrency in my plugin to retrieve data over XPC. (https://developer.apple.com/documentation/xpc/xpcsession + https://developer.apple.com/documentation/swift/withcheckedthrowingcontinuation(isolation:function:_:)) Once I retrieve the data over XPC, I need to post it on GUI, hence I've set my view class as @MainActor in order to do the thread switch.
2
0
748
Jul ’25
TabView + NavigationStack + ScrollView navigationTitle bug
Hello there! I've been struggline with this thing for a two days now, and seems like it's a bug in SwiftUI. Navigation title is jumping on top of the ScrollView's content when switching tabs in TabView. Steps to reproduce: Scroll one tab to the bottom so that the large title is hidden and the floating toolbar appears. Go to another tab in the tab bar. Go back to the initial tab (it is still scrolled), and press the current tab button again to scroll to the top. The navigation title will glitch and be on top of the content. The animation fixes if you scroll again manually. Video: https://share.cleanshot.com/PFCSKMlH Code (simplified): import SwiftData import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { TabsContentView() } } } // ... struct TabsContentView: View { enum Tab { case library, profile } @State private var selectedTab: Tab = .library var body: some View { TabView(selection: $selectedTab) { NavigationStack { YourLibraryList() .navigationTitle(Your Library) } .tabItem
2
0
283
Jul ’25
Can SMAppService Daemon replace SMJobBless for exclusive HID capture from keyboards?
To gain exclusive access to keyboard HID devices like Amazon Fire Bluetooth remote controls, my app has been installing a privileged helper tool with SMJobBless in the past. The app - which also has Accessibility permissions - then invoked and communicated with that helper tool through XPC. Now I'm looking into replacing that with a daemon installed through the newer SMAppService APIs, but running into a permission problem: If I try to exclusively open a keyboard HID device from the SMAppService-registered XPC service/daemon (which runs as root as seen in Activity Monitor), IOHIDDeviceOpen returns kIOReturnNotPermitted. I've spent many hours now trying to get it to work, but so far didn't find a solution. Could it be that XPC services registered as a daemon through SMAppService do not inherit the TCC permissions from the invoking process (here: Accessibility permissions) - and the exclusive IOHIDDeviceOpen therefore fails?
Replies
7
Boosts
0
Views
320
Activity
Aug ’25
Reply to SwiftData crash when using a @Query sort descriptor with a relationship
Indeed... The original issue, which was fixed in iOS 18.4, doesn't sort with an optional relationship. I see this crash a different issue. Do you have a feedback report yet? If not, would you mind to file one for us and share your report ID here? Thanks! Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Aug ’25
Reply to es_mute_path() vs. deprecated es_mute_path_literal() - incompatibility and wrong documentation
That should be it. Thank you. But I urge you to re-read the canonical documentation in the headers. The difference you point out here (between PATH_TYPE_TARGET_LITERAL and PATH_TYPE_LITERAL) is not written there. The very simple distinction between the path of the executable creating the event and the path of the file which is the target of the event -- is simply not there. Yes, it could definitely be clearer on that point. It was fairly clear in the original API (when all you could block was by process), but when TARGET was added, it was documented in great detail, but we didn't go back and include a clear definition of the original constant. I just filed a bug asking for us to clarify the two roles in the enum definition comments. Having said that, this flowchart at line ~500 of ESClient.h does do a good job of describing what's going on, though it does not directly reference the specific constants involved: * The relationship between all three types of muting (proc,path,target-path) and how each c
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Aug ’25
Reply to Using relationships in SortDescriptor crashing on release
@DTS Engineer the issue @Ches Beiner brought up is still an issue, as detailed in my post on the thread you linked to: SwiftData crash when using a @Query sort descriptor with a relationship
Replies
Boosts
Views
Activity
Aug ’25
Reply to SwiftData crash when using a @Query sort descriptor with a relationship
@DTS Engineer this is still an issue in iOS 26 when sorting on a property of an optional relationship. @Query(sort: Item.info?.endDate, order: .reverse) private var items: [Item] @Model final class Item { var info: ItemInfo? init(info: ItemInfo) { self.info = info } } @Model final class ItemInfo { var endDate: Date init(endDate: Date) { self.endDate = endDate } } SwiftData/DataUtilities.swift:85: Fatal error: Couldn't find Item.)>?.? on Item with fields [SwiftData.Schema.PropertyMetadata(name: info, keypath: Item.)>, defaultValue: nil, metadata: nil)] iOS Simulator 26.0 beta 4 (23A5297i) Xcode Version 26.0 beta 4 (17A5285i) I made a minimal fork of the project @Atletismo343 provided: https://github.com/coughski/swiftdata-crash
Replies
Boosts
Views
Activity
Aug ’25
visionOS: Unable to programmatically close child WindowGroup when parent window closes
Hi , I'm struggling with visionOS window management and need help with closing child windows programmatically. App Structure My app has a Main-Sub window hierarchy: AWindow (Home/Main) BWindow (Main feature window) CWindow (Tool window - child of BWindow) Navigation flow: AWindow → BWindow (switch, 1 window on screen) BWindow → CWindow (opens child, 2 windows on screen) I want BWindow and CWindow to be separate movable windows (not sheet/popover) so users can position them independently in space. The Problem CWindow doesn't close when BWindow closes by tapping the X button below the app (next to the window bar) User clicks X on BWindow → BWindow closes but CWindow remains CWindow becomes orphaned on screen Can close CWindow programmatically when switching BWindow back to AWindow App launch issue After closing both windows, CWindow is remembered as last window Reopening app shows only CWindow instead of BWindow User gets stuck in CWindow with no way back to BWindow I've Tried Environment dismissWindow in clean
Replies
2
Boosts
0
Views
367
Activity
Aug ’25
Reply to Upgrading an SMAppService daemon and changing the plist
[quote='851343022, nkirby, /thread/795022?answerId=851343022#851343022, /profile/nkirby'] We split the application from a monolithic binary into separate GUI and daemon executables. [/quote] Oh, yeah, that makes sense now that I look back at the property lists in your first post. [quote='851343022, nkirby, /thread/795022?answerId=851343022#851343022, /profile/nkirby'] Is there a way to tell launchd about the change? [/quote] Not that I’m aware of. Just as an experiment, if you override the code signing identifier of the daemon to match that of the main app, does that fix this problem? If you’er using code, change the code signing identifier by setting the Other Code Signing Flags build setting to [ $(inherited), --identifier, org.mozilla.macos.FirefoxVPN]. IMPORTANT I see a lot of folks put a lot of weird stuff in the Other Code Signing Flags build setting. I recommend against that in general, but it is a reasonable way to override the code signing identifier in a program that has no bundle ID. Share
Topic: App & System Services SubTopic: Core OS Tags:
Replies
Boosts
Views
Activity
Jul ’25
UITabBar hitTest method is not triggered when click button that is a subview of UITabBar and the subview frame is beyond UITabBar when using Xcode26 build app on OS 26
In our project, we defined a CustomTabBar that inherits UITabBar, and we add some subviews and these subviews' frame is beyond UITabBar, see below picture(a beyond area button, this button is a subview of UITabBar, but frame is out of UITabBar's area): and in order to let this button response to click action, we override the UITabBar's hitTest method, this works well below OS 26 with Xcode version below 26: override public func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { let pointInCollectionView = self.beyondAreaButton.convert(point, from: self) if self.beyondAreaButton.bounds.contains(pointInCollectionView) { return self.beyondAreaButton.hitTest(pointInCollectionView, with: event) } return super.hitTest(point, with: event) } but when using Xcode26 build app on OS 26, I noticed the UITabBar is wrapped by a UIKit._UITabBarContainerView and UIKit._UITabBarContainerWrapperView, and it can not trigger the hitTest method. since the hitTest is not triggered, so the button action is no
Replies
1
Boosts
0
Views
228
Activity
Jul ’25
Reply to SwiftData migration error: NSCloudKitMirroringDelegate are not reusable
Did anyone have an update? I'm still facing the same issue. Not being able to do even trivial custom migrations seems like it makes SwiftData a complete non-starter.
Replies
Boosts
Views
Activity
Jul ’25
Reply to CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
Thanks for your clarification. For my curiosity: @main struct FoodGuardApp: App { var body: some Scene { WindowGroup { ContentView() } .modelContainer(for: FoodItem.self, configurations: [ ModelConfiguration(Default, cloudKitDatabase: .shared) ]) } } The above code doesn't build (because .shared isn't supported), does it? The sharing worked locally (between users in the same Apple ID)... If the code doesn't build, I am super curious how the sharing worked locally ... I am guessing that you probably added .shared with your own code by extending ModelConfiguration.CloudKitDatabase, and that SwiftData falled back to .private because it didn't know .shared. That will explain why the synchronization of the private database works, but is definitely not the way to support CloudKit sharing. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Jul ’25
Reply to CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
Thanks a lot, Ziqiao, for your quick response. You’re absolutely right – I now realize that .shared CloudKit containers are not yet supported with SwiftData. In my implementation, I attempted to use a SwiftData model with a ModelContainer(for:sharing:) configuration and used UICloudSharingController to manage sharing between Apple IDs. The ModelContainer was configured like this: @main struct FoodGuardApp: App { var body: some Scene { WindowGroup { ContentView() } .modelContainer(for: FoodItem.self, configurations: [ ModelConfiguration(Default, cloudKitDatabase: .shared) ]) } } The sharing worked locally (between users in the same Apple ID), but failed when another Apple ID accepted the share, producing this error: CKError: Bad Container (5/1014) Couldn't get container configuration from the server for container iCloud.com.de.seki.FoodGuard Based on your reply and DTS confirmation, I now plan to migrate my project to Core Data + CloudKit, using NSPersistentCloudKitContainer and UICloudSharin
Replies
Boosts
Views
Activity
Jul ’25
Reply to CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
As of today, SwiftData + CloudKit integration doesn't support CloudKit sharing, as you can see that ModelConfiguration.CloudKitDatabase only has private(_:). I am wondering what SwiftData with CloudKit sharing means in your context. If you don't mind to share more details about your implementation, together with the code snippet that triggers the CloudKit error, I'd probably have more to comment. Best, —— Ziqiao Chen  Worldwide Developer Relations.
Replies
Boosts
Views
Activity
Jul ’25
CloudKit Sharing Not Working with Other Apple IDs (SwiftData + SwiftUI)
Hi everyone, I’m currently developing a SwiftUI app that uses SwiftData with CloudKit sharing enabled. The app works fine on my own Apple ID, and local syncing with iCloud is functioning correctly — but sharing with other Apple IDs consistently fails. Setup: SwiftUI + SwiftData using a ModelContainer with .shared configuration Sharing UI is handled via UICloudSharingController iCloud container: iCloud.com.de.SkerskiDev.FoodGuard Proper entitlements enabled (com.apple.developer.icloud-services, CloudKit, com.apple.developer.coredata.cloudkit.containers, etc.) Automatic provisioning profiles created by Xcode Error: What I’ve tried: Verified the iCloud container is correctly created and enabled in the Apple Developer portal Checked bundle identifier and container settings Rebuilt and reinstalled the app Ensured correct iCloud entitlements and signing capabilities Questions: Why does CloudKit reject the container for sharing while local syncing works fine? Are there known issues with SwiftData
Replies
4
Boosts
0
Views
278
Activity
Jul ’25
Structured concurrency + preconcurrency API (SFAuthorizationPluginView)
I'm having trouble dealing with concurrency with the SFAuthorizationPluginView. Does anybody know how this can be solved? https://developer.apple.com/documentation/securityinterface/sfauthorizationpluginview The crux of it is: If I inherit an object as part of an API, and the API is preconcurrency, and thus is nonisolated (but in reality is @MainActor), how do I return a @MainActor GUI element? https://developer.apple.com/documentation/securityinterface/sfauthorizationpluginview/firstresponder() The longer story: I made my view class inherit SFAuthorizationPluginView. The API is preconcurrency (but not marked as preconcurrency) I started using concurrency in my plugin to retrieve data over XPC. (https://developer.apple.com/documentation/xpc/xpcsession + https://developer.apple.com/documentation/swift/withcheckedthrowingcontinuation(isolation:function:_:)) Once I retrieve the data over XPC, I need to post it on GUI, hence I've set my view class as @MainActor in order to do the thread switch.
Replies
2
Boosts
0
Views
748
Activity
Jul ’25
TabView + NavigationStack + ScrollView navigationTitle bug
Hello there! I've been struggline with this thing for a two days now, and seems like it's a bug in SwiftUI. Navigation title is jumping on top of the ScrollView's content when switching tabs in TabView. Steps to reproduce: Scroll one tab to the bottom so that the large title is hidden and the floating toolbar appears. Go to another tab in the tab bar. Go back to the initial tab (it is still scrolled), and press the current tab button again to scroll to the top. The navigation title will glitch and be on top of the content. The animation fixes if you scroll again manually. Video: https://share.cleanshot.com/PFCSKMlH Code (simplified): import SwiftData import SwiftUI @main struct MyApp: App { var body: some Scene { WindowGroup { TabsContentView() } } } // ... struct TabsContentView: View { enum Tab { case library, profile } @State private var selectedTab: Tab = .library var body: some View { TabView(selection: $selectedTab) { NavigationStack { YourLibraryList() .navigationTitle(Your Library) } .tabItem
Replies
2
Boosts
0
Views
283
Activity
Jul ’25