Post #634952
2026-01-30 23:23 UTC
Another day another hacky solution to go around SwiftUI limitations on macOS.
I wanted to be able to use the "Select All" item from the app menu without having to replace the built items that SwiftUI provides.
I was pretty sure that implementing a `selectAll` method in my AppDelegate *should* work but it just would not happen.
Turns out you must also make the app delegate conform to `NSStandardKeyBindingResponding` *which doesn't even have this method in it!!*
#swift #swiftui #indiedev
Replies (2)
-
@dfortes@mastodon.social 2026-01-30 23:25
The `@ActiveViewObject` property wrapper above is actually another hack I had to come up with because, for some wild reason, `@FocusedValue`/ `.focusedSceneValue` would cause memory leaks that I could not get hid of.
-
@ctietze@mastodon.social 2026-01-31 10:31
@dfortes@mastodon.social 🙄 oh man. At least they kept the tradition to not expose essential methods in any formal protocol from AppKit! :)