Post

Replies

Boosts

Views

Activity

Did GCD change in macOS 26
Some users of my Mac app are complaining of redrawing delays. Based on what I see in logs, my GCD timer event handlers are not being run in a timely manner although the runloop is still pumping events: sometimes 500ms pass before a 15ms timer runs. During this time, many keypresses are routed through -[NSApplication sendEvent:], which is how I know it's not locked up in synchronous code. This issue has not been reported in older versions of macOS. I start the timer like this: _gcdUpdateTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue()); dispatch_source_set_timer(_gcdUpdateTimer, dispatch_time(DISPATCH_TIME_NOW, period * NSEC_PER_SEC), period * NSEC_PER_SEC, 0.0005 * NSEC_PER_SEC); dispatch_source_set_event_handler(_gcdUpdateTimer, ^{ …redraw… });
1
0
104
Sep ’25
What is the least painful way to start using Swift packages in my very old app?
My project has been around for twenty years and has over a thousand .m files. They all build into one of two static library targets. I believe I cannot use swift packages from a static library, or at least I couldn't get it to work. Moving my code into a dynamic library also seems like an overwhelming task; when I tried, it looked like I would need to change every single #import to use <> instead of "". I also tried using the open source swift-create-xcframework but it didn't work, and I would rather not depend on third party build tools. Do I have any good options?
1
0
46
Jun ’25
What are the CAMetalLayer.nextDrawable threading rules?
What evidence exists that it's safe to call nextDrawable() on CAMetalLayer off the main thread? I have seen developers claiming that it's OK, but the official docs are silent on the topic. Attempting to do so with Strict Concurrency Checking set to Complete complains that CAMetalLayer is not @Sendable. I want to call it off the main thread since there doesn't seem to be any way to prevent it from blocking the UI for up to a second. I have read hints and allegations that this won't happen if you avoid asking for too many drawables, but that doesn't seem to be true 100% of the time in my experience. Supposing it is allowed, I wonder how races are handled such as when the layer's size is changed on the main thread, or if the layer is removed from the layer hierarchy.
0
0
514
Dec ’24
IntentsKit in AppKit not working for me
I'm trying to add support for Shortcuts to my Mac app. I followed the steps here: https://developer.apple.com/documentation/sirikit/adding_user_interactivity_with_siri_shortcuts_and_the_shortcuts_app?language=objc but my app does not show up in Shortcuts. In addition to those steps, I also added my intent to (main app target) > General > Supported Intents. This had no effect. I believe that I don't need to create a separate intents extension for mac as you would on iOS. I tried that as well, but it still didn't show up in Shortcuts. This is a pure AppKit app, not iOS, not Catalyst. Is there a magic Info.plist key I'm missing? This problem is frustrating because there doesn't seem to be any way to analyze it. If you want to see what I've done it's at https://github.com/gnachman/iterm2.git in these branches: intents_extension main_app_intent
1
0
1.1k
Nov ’21