Search results for

Swift 6

49,194 results found

Post

Replies

Boosts

Views

Activity

Reply to Confused by new Swift XPC API's xpc_listener_t and xpc_session_t types
Thank you, it is nice to know these Swift-based CSR APIs are coming in macOS 26.0. However, I'm still wondering what these two functions are: xpc_session_set_peer_code_signing_requirement xpc_listener_set_peer_code_signing_requirement Because they are new in macOS 14.4, but seem to have basically zero use in Swift as per above. xpc_listener_t and xpc_session_t seem to be completely new objects from macOS 13.0, however the xpc C API - the convention they seem to follow - is way older. The two objects mentioned however gained a full set of new functions in macOS 13.0 and 14.0. E.g.: xpc_listener_create is a macOS 14.0+ function xpc_session_create_mach_service is a macOS 13.0+ function How am I supposed to treat these compared to the old C API using xpc_connection_create_mach_service + either XPC_CONNECTION_MACH_SERVICE_PRIVILEGED or XPC_CONNECTION_MACH_SERVICE_LISTENER? Are they supposed to be an easier-to-use session based API?
Topic: App & System Services SubTopic: General Tags:
2w
Reply to Confused by new Swift XPC API's xpc_listener_t and xpc_session_t types
Lemme see if I have this straight: You want to use the new Swift XPC API for app-to-daemon XPC communication. You want the daemon to validate the code signature of the client. Is that right? If so, the source of your confusion is that currently shipping systems have no support for this. Fortunately, that seems to have changed in macOS 26 (currently in beta). See Validating Signature Of XPC Process. Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: App & System Services SubTopic: General Tags:
2w
Should SwiftUI view models in Swift 6 be both @Observable and @MainActor?
Hi, In the WWDC25 session Elevate an app with Swift concurrency (timestamps: 8:04 and later), the StickerViewModel is shown annotated with @Observable but not @MainActor. The narration mentions that updates happen on the main thread, but that guarantee is left implicit in the calling code. In Swift 6, though, one of the major benefits is stronger compiler enforcement against data races and isolation rules. If a view model were also annotated with @MainActor, then the compiler could enforce that observable state is only updated on the main actor, preventing accidental background mutations or updates that can cause data races between nonisolated and main actor-isolated uses. Since @Observable already signals that state changes are intended to be observed (and in practice, usually by views), it seems natural that such types should also be main-actor isolated. Otherwise, we’re left with an implicit expectation that updates will always come from the main thread, but without the compiler’s help in
6
0
214
2w
Reply to SwiftData Inheritance Query Specialized Model
Hi Ziqiao, I've tried with iOS 26 Beta 7 and since Beta 8 (landed tonight) on device (because my Xcode is stuck on iOS Beta 6, don't know why) and the problem is solved. I can now query CollectionItem with predicate that contains inherited properties. Now I have only got problems with accesses to the children property in List. When i got the following hierarchy and the SwiftUI view List access to the Item.children property I got another kind of crash. Category: Work (parent: none) Category: Tech (parent: Work) Thread 1: Fatal error: Never access a full future backing data - PersistentIdentifier(id: SwiftData.PersistentIdentifier.ID(backing: SwiftData.PersistentIdentifier.PersistentIdentifierBacking.managedObjectID(0x9872c0007ba42159 ))) with Optional(7639D151-5D48-46AC-AB2A-7F0F50919AC5) But I guess it's a different kind of problem now.
2w
Confused by new Swift XPC API's xpc_listener_t and xpc_session_t types
Hey! I'm trying to create an XPC messaging feature between my daemon and main application. I'm trying to use the new Swift low-level API available from macOS 14.0. The documentation is extremely confusing when looking at it from Swift: The xpc_listener_t type Seems to be something I shouldn't use in the Swift API, and would rather have to use XPCListener. Also, it appears to have no public API other than the xpc_listener_set_peer_code_signing_requirement function. Which would make it impossible to create this type. However, when going into xpc.h, one can see that there is an API in fact: API_AVAILABLE(macos(14.0), macCatalyst(17.0)) API_UNAVAILABLE(ios, tvos, watchos) XPC_EXPORT XPC_SWIFT_NOEXPORT XPC_RETURNS_RETAINED XPC_WARN_RESULT xpc_listener_t _Nullable xpc_listener_create(const char * service, dispatch_queue_t _Nullable target_queue, xpc_listener_create_flags_t flags, xpc_listener_incoming_session_handler_t incoming_session_handler, xpc_rich_error_t _Nullable * _Nullable error
3
0
74
2w
Apple Watch Series 6 – Display Extremely Dim and Flickering After watchOS 26.0 Beta Update (23R5350a)
I have an Apple Watch Series 6 (Model: M00H3LL/A) that was working perfectly before I updated it to watchOS 26.0 beta on 21st August 2024. The update process completed smoothly while the watch was on the charger, but immediately after the update the display became extremely dim. It’s not completely black, but so faint that it’s very difficult to see. I’ve already tried setting the brightness to maximum and also enabled maximum brightness under Accessibility settings, but the issue remains. I also tried force restarting the watch (holding the Digital Crown and side button together), but that did not resolve the issue. I know this is not a hardware issue, since the problem appeared immediately after the update, and at times the display briefly returns to normal brightness for just a few milliseconds (like a flicker). My current watchOS version is 26.0 (23R5350a). Could you please advise on how I can fix this, or confirm if this is a known issue with the beta version? Thank you.
0
0
14
2w
Apple Watch Series 6 – Display Extremely Dim and Flickering After watchOS 26.0 Beta Update (23R5350a)
I have an Apple Watch Series 6 (Model: M00H3LL/A) that was working perfectly before I updated it to watchOS 26.0 beta on 21st August 2024. The update process completed smoothly while the watch was on the charger, but immediately after the update the display became extremely dim. It’s not completely black, but so faint that it’s very difficult to see. I’ve already tried setting the brightness to maximum and also enabled maximum brightness under Accessibility settings, but the issue remains. I also tried force restarting the watch (holding the Digital Crown and side button together), but that did not resolve the issue. I know this is not a hardware issue, since the problem appeared immediately after the update, and at times the display briefly returns to normal brightness for just a few milliseconds (like a flicker). My current watchOS version is 26.0 (23R5350a).Could you please advise on how I can fix this, or confirm if this is a known issue with the beta version? Thank you.
Topic: UI Frameworks SubTopic: General
2
0
33
2w
Reply to TextKit 2 calls NSTextLayoutFragment's draw method too often
The behavior should be that only the fragments that fall in the view port + estimated overdraw region are re-drawn, and that should be true for all system versions. Thanks for creating the demo project for me. I've tried your project with my Xcode 26 Beta 6 + iOS 26 Beta 7 + iPhone 16 Plus, and don't see that the system re-draws all the paragraph. Here is what I do: a. Use the following print instead to better observe the fragments that are re-drawn: print(draw called in (rangeInElement)) b. Add more paragraphs to textContents so the content is longer. With that, here is what I see: Launch the app. Xcode shows the following log, indicating that only the first fragment is drawn. draw called in 0...1531 (Happens one time) Scroll a bit. Xcode shows the following log, indicating that only the first and second fragments are drawn: draw called in 0...1531 draw called in 1532...3237 ... (Repeats many times.) Scroll down to the bottom, clear the log, and then scroll a bit. Xcode shows the following log, indi
Topic: UI Frameworks SubTopic: UIKit Tags:
2w
Xcode unit test "Creating more than one Application"
When I try to make a unit test target for my macOS app that uses Objective-C, running tests fails, and the debugging log shows a message Creating more than one Application. If, on the other hand, when I create the unit test target, I select None as the target to be tested, and then add all my sources to that target, my tests work. So, I can get my testing done, but I think I must be doing something wrong. By the way, along with the error message, there is a stack crawl: 0 CoreFoundation 0x00007ff8140410aa __exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007ff813b660b7 objc_exception_throw + 48 2 Foundation 0x00007ff814f19bd8 -[NSCalendarDate initWithCoder:] + 0 3 AppKit 0x00007ff817030062 -[NSApplication init] + 1718 4 XCTestCore 0x000000010774b0df -[XCTestDriver _createTestBundlePrincipalClassInstance] + 82 5 XCTestCore 0x0000000107749338 -[XCTestDriver _runTests] + 111 6 XCTestCore 0x000000010770f194 _XCTestMain + 126 7 libXCTestBundleInject.dylib 0x0000000106e8982d __copy_helper_block_e8_32s + 0
3
0
113
2w
Reply to XCode reverts CoreData's .xccurrentversion
I did some of investigation of this issue because I ran into the same problem when trying to convert an old project from groups to folders. I discovered what is happening is that Xcode 16 changes the model's current version to the last one alphabetically. I was able to reproduce it this way: Create a brand new, folder-based, Xcode project. Add an xcdatamodeld with one entity. Add a new model version and name it a. Make it current. Quit Xcode. Relaunch Xcode. Expected result: The a model version should still be current. Actual result: The original model version is current. I was able to reproduce with Xcode 16.2 and 16.4. It appears to be fixed in Xcode 26 beta 6. Based on these steps, one workaround appears to be to name the model versions alphabetically. Another workaround is to keep the xcdatamodeld file in a group, not a folder. And of course if you can switch to Xcode 26, then you don't need to workarounds above.
2w
How to install newer beta 26 SDKs into older Xcode 26 Betas?
Hello, It seems Xcode 26 beta is lagging the OS releases, which is fine. However, how does one install a Beta N + 1 or N + 2 SDK into the older Xcode beta? I'd like to use iOS 26 Beta 8 from the Xcode 26 Beta 6 install I have. I have tried Settings/Components and Devices & Simulators but nothing Beta 7 nor 8 shows up there. Thanks! -- Greg Bolsinga
2
0
138
2w