Search results for

Swift 6

49,192 results found

Post

Replies

Boosts

Views

Activity

Reply to Using raise in GCD can cause timing issues with the signal mechanism.
Sorry I didn’t reply sooner. I was notified of your earlier posts )-: [quote='850943022, SilverFruity, /thread/794589?answerId=850943022#850943022, /profile/SilverFruity'] calling raise to throw SIGABRT does not block the thread under GCD. [/quote] By “under GCD” I presume you mean “when using a Dispatch signal event source to handle the signal”. If so, then, yes, that’s expected. Dispatch signal event sources are very much like kqueues, in that they are delivered asynchronously. Thus if you raise a signal by calling raise (or kill with your own pid) then the thread calling raise may well return before the signal is delivered to the queue. If you’re building your own crash reporter — which, as I noted above, is something I specifically discourage — and you choose to implement in-process crash reporting via signals — again, not something I recommend — then you have to use a signal handler rather than a Dispatch signal event source. [quote='851087022, SilverFruity, /thread/794589?answerId=851087022#851087022, /
5d
Reply to Drag-and-Drop from macOS Safari to NSItemProvider fails due to URL not being a file:// URL
I also try to be a good app, and provide asynchronous support. I think that's your problem. It's too difficult to keep up with that. Your asynchronous code is already deprecated and disavowed. First of all, make sure you try using the ClipboardViewer tool. I think it's in Xcode's AdditionalTools as a separate download. I know you're dealing with Drag and Drop, which is not quite the same, but it may be enlightening as most people implement Copy and Paste with the same data. I've never tried dragging from Safari, but I certainly never seen any TIFF conversions. I even support data types that the system doesn't, so there's no way it ever could convert it. Again, I think you're trying too hard. Instead of itemProvider.loadInPlaceFileRepresentation, try just loadItem. That should give you the actual URL. You might run into concurrency problems. I seem to have encountered that myself with these APIs. Unfortunately, there's no easy solution. You definitely don't want to try those old dispatch queues, at least not i
Topic: UI Frameworks SubTopic: AppKit Tags:
5d
Reply to NWConnection: how to recover data connection after RF cellular data connection loss
[quote='856588022, jumbopilot, /thread/798431?answerId=856588022#856588022, /profile/jumbopilot'] But the connection using the same NWConnection instance (self.connection) does not succeed. [/quote] I’m actually a bit confused here, because your code uses two different syntaxes to refer to the connection. With reference to your most recent snippet, line 1 is this: self.connection.cancel() which uses self.connection and line 6 is this: connection = NWConnection(…) which just uses connection. I believe that these are referencing the same thing, that is, the connection property of the enclosing class. However, it’s hard to be 100% certain without seeing more context. Stilly, I can explain some basics… NWConnection is a class, so self.connection is a reference to that class. So, when talking about “the same connection” you have to distinguish between an object reference and the object itself. Any given NWConnection object has a one way state flow. It starts in the .setup state and ends in either .failed(
5d
Verifying TLS 1.3 early_data behavior on iOS 26
Development environment Xcode 26.0 Beta 6 iOS 26 Simulator macOS 15.6.1 To verify TLS 1.3 session resumption behavior in URLSession, I configured URLSessionConfiguration as follows and sent an HTTP GET request: let config = URLSessionConfiguration.ephemeral config.tlsMinimumSupportedProtocolVersion = .TLSv13 config.tlsMaximumSupportedProtocolVersion = .TLSv13 config.httpMaximumConnectionsPerHost = 1 config.httpAdditionalHeaders = [Connection: close] config.enablesEarlyData = true let session = URLSession(configuration: config, delegate: nil, delegateQueue: nil) let url = URL(string: https://www.google.com)! var request = URLRequest(url: url) request.assumesHTTP3Capable = true request.httpMethod = GET let task = session.dataTask(with: request) { data, response, error in if let error = error { print(Error during URLSession data task: (error)) return } if let data = data, let responseString = String(data: data, encoding: .utf8) { print(Received data via URLSession: (responseString)) } else { print(No da
1
0
52
1w
UIMenuBuilder - some menus refuse customization
I'm trying to customize the menu in my iPad app for iOS 26, since most of the default menu options aren't relevant to my app. Fortunately, I already have the code for this from my Mac Catalyst implementation. However, the functionality to replace menus with new sets of options has no effect on some menus on iOS. For example, updating the Format menu works fine on Mac Catalyst and iOS 26: override func buildMenu(with builder: UIMenuBuilder) { super.buildMenu(with: builder) let transposeUpItem = UIKeyCommand(title: NSLocalizedString(TRANSPOSE_UP), image: nil, action: #selector(TransposeToolbar.transposeUp(_:)), input: =, modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let transposeDownItem = UIKeyCommand(title: NSLocalizedString(TRANSPOSE_DOWN), image: nil, action: #selector(TransposeToolbar.transposeDown(_:)), input: -, modifierFlags: UIKeyModifierFlags.command, propertyList: nil, alternates: []) let transposeGroup = UIMenu(title: , image: nil, identifier: UIMenu.Identifier(rawVal
Topic: UI Frameworks SubTopic: UIKit
3
0
302
5d
FSKit volume mount fails with "Permission denied"
I'm trying to use FSKit to create a File System Extension that can read MFS-formatted disk images, following the old MFSLives sample project for reference. I have a well-formed MFS formatted img file that I'm trying to mount, but I'm having trouble getting the system to actually use my FSModule. DiskImageMounter fails to mount the img file, but I'm able to use it to attach the image as a device by clicking Ignore when it prompts me that it isn't able to read the disk. This is effectively the same as using the hdiutil command in Terminal. hdiutil attach -imagekey diskimage-class=CRawDiskImage -nomount Sample.img I've read that FSKit isn't fully integrated with Disk Arbitration yet, so I decided to see if I could force the system to use my extension by using the mount command. mkdir /tmp/Sample mount -F -t MFS disk54 /tmp/Sample Watching the logs in Console, I can see that fskit_agent sees my extension in its New Modules List, and I see an MFS process gets launched and logs messages from com.apple.running and c
4
0
151
5d
Misaligned visionOS Simulator Home Position
Using Xcode v26 Beta 6 on macOS v26 Beta 25a5349a When pressing on the home button of the visionOS simulator, I am not positioned in the middle of the room like would normally be. This occurred when moving a lot in the space to find an element added to an ImmersiveSpace. How to resolve: restart simulator device. See attached the pictures of the visionOSSimulatorCorrectHomePosition and the visionOSSimulatorMisallignedHomePosition.
2
0
849
6d
Unable to Launch Tests/UITests in Xcode 16 with iOS 18 Simulator
Hello, I'm unable to run any test cases in Xcode 16 with the iOS 18 simulator. Steps to Reproduce: Create a new iOS project in Xcode 16 using the default iOS app template with the testing option checked. Run any test or UI test case by clicking the Play icon in the Test navigator. Xcode gets stuck at the Testing state indefinitely. Environment: macOS 15 beta 8 Xcode 16 beta 6 iOS 18 beta 7 simulator
11
0
3.1k
6d
Reply to XPCEndpoint cannot be encoded
[quote='856395022, erdeszbalazs, /thread/798938?answerId=856395022#856395022, /profile/erdeszbalazs'] How can one XPCSession transfer let's say two distinct types of Codable messages? [/quote] Again, I don’t have a lot of concrete experience with the low-level Swift API, but my natural inclination here is to use an enum as your Codable message, with a case for each message type and an associated value with the payload for that message type. So, something like this: enum WaffleRequest: Codable { case cook(Cook) case varnish(Varnish) struct Cook: Codable { var minutes: Int } struct Varnish: Codable { var finish: Finish } enum Finish: Codable { case matt case gloss } } Share and Enjoy — Quinn “The Eskimo!” @ Developer Technical Support @ Apple let myEmail = eskimo + 1 + @ + apple.com
Topic: App & System Services SubTopic: General Tags:
6d
Reply to RealityKit / visionOS – Memory not released after dismissing ImmersiveSpace with USDZ models
Hello @giovanniR2U , thank you for your question! Swift uses automatic reference counting (ARC), which means memory is automatically cleaned up for any object that is no longer referenced. Often, this is as simple as removing a root entity from the scene (thereby removing each of its descendants) or dismissing the ImmersiveScene entirely. Going through each entity in the scene and calling removeFromParent() for every entity and setting texture references to nil should not be necessary. The important thing is to verify there are no more references in memory, so make sure you don't have any variables lying around that might still be pointing to the objects you want to unload. When you load your textures sequentially, are you keeping a reference to these textures in the system that loads them? This would prevent ARC from unloading those textures. You mention your app goes from 30 MB to 3.3 GB after loading just the textures, and then only goes to 2.6 GB after dismissing the experience. This to me sugges
Topic: Spatial Computing SubTopic: General Tags:
6d
Core Data + CKSyncEngine with Swift 6 — concurrency, Sendable, and best practices validation
Hi everyone, I’ve been working on migrating my app (SwimTimes, which helps swimmers track their times) to use Core Data + CKSyncEngine with Swift 6. After many iterations, forum searches, and experimentation, I’ve created a focused sample project that demonstrates the architecture I’m using. The good news: 👉 I believe the crashes I was experiencing are now solved, and the sync behavior is working correctly. 👉 The demo project compiles and runs cleanly with Swift 6. However, before adopting this as the final architecture, I’d like to ask the community (and hopefully Apple engineers) to validate a few critical points, especially regarding Swift 6 concurrency and Core Data contexts. Architecture Overview Persistence layer: Persistence.swift sets up the Core Data stack with a main viewContext and a background context for CKSyncEngine. Repositories: All Core Data access is abstracted into repository classes (UsersRepository, SwimTimesRepository), with async/await methods. SyncEngine: W
1
0
333
6d
Learn to code / beginner
Hello everyone, I’m completely new to programming and Apple development, but I’ve always had the strong wish to learn coding and to work more deeply with Apple’s system structures. My main questions are: How should I best start learning? For example, is Swift Playgrounds the right first step? How should I continue afterwards to gain further knowledge, possibly in areas like system architecture, cybersecurity, or cloud computing (even though I don’t want to commit too early to one direction)? Can you recommend a learning schedule or intensity (e.g., how often per day or week I should practice) for someone who works full-time? Is my current MacBook Air (2020, Intel i3, 8 GB RAM, 250 GB SSD) still suitable for learning and beginner development, or would you recommend upgrading to a newer model? On top of that, my English is not perfect yet – is it possible to improve it alongside learning coding? I’m very motivated to finally start this journey, even though I once turned down an IBM apprenticeship when
4
0
139
2w
When applied to a nested struct, @Generable macro results in infinite nested response from Foundation Model
When the @Generable is applied toward a Swift struct declared within another struct, and when said nested struct is defined as the type of one of the properties of another @Generable type, which is in turn defined as the output format of Foundation Model session, Foundation Model can stuck in a loop trying to create a infinitely nested response, until the context window limit exceeded error is triggered. I have filed feedback FB19987191 with a demo project. Is this expected behavior?
1
0
506
1w