Post

Replies

Boosts

Views

Activity

Reply to Finder Quick Action icon rendering when using custom SF Symbol
I was able to fix the size issue, but still not the templated rendering. I rendered my icon out as a 1024x1024px PNG, used Image2Icon to make an Iconset out of it (without clipping it to any of the built-in shapes) and then used this in the extension's Info.plist to load it: <key>CFBundleIcons</key> <dict> <key>CFBundlePrimaryIcon</key> <dict> <key>CFBundleIconName</key> <string>Icon_Template</string> <key>CFBundleIconFile</key> <string>Extract</string> </dict> </dict> which can then be referred to by name for the finder preview icon: <key>NSExtensionServiceFinderPreviewIconName</key> <string>Icon_Template</string> Of interesting note, it's also possible to use the same undocumented thing that Apple uses to make an icon out of an SF Symbol and some colours, but that doesn't work with a custom symbol. For future travellers' reference: <key>ISGraphicIconConfiguration</key> <dict> <key>ISRenderingMode</key> <string>automatic</string> <key>ISSymbolName</key> <string>rectangle.compress.vertical</string> <key>ISEnclosureColor</key> <string>gray</string> <key>ISSymbolColor</key> <string>white</string> </dict>
Topic: App & System Services SubTopic: General Tags:
Jun ’25
Reply to Finder Quick Action icon rendering when using custom SF Symbol
After much experimentation I believe that the docs for NSExtensionServiceFinderPreviewIconName are just wrong, the images supplied should never be a template image because that always leads to incorrect rendering. From my testing, it seems like the only way to achieve correctly coloured icons is to supply an Image Set in your asset bundle that contains a 16x16px @1x bitmap image and a 32x32px @2x bitmap image. If you supply a larger image, it is not scaled, but merely cropped. If you supply an SVG image it will be rendered at some random scale, and multiple layers seem to be ignored If you supply a template image (ie black only) it will be rendered as black and never treated like a proper template image If you supply an SFSymbol name (system or custom) it will be rendered as black and never treated like a proper template image The rabbit hole goes even deeper though because despite these images being limited to 32x32px, Apple's own images seem to be 64x64px and they render correctly, leading to wild visual inconsistency like that seen in the System Settings panel for enabling Finder Actions: In that screenshot, "Compress" and "Extract" are mine, "Make Gif" and "Meme Maker" are 64x64px images from Shortcuts, "Remove Background" is from Pixelmator Pro, and the other three are from Apple's sample code for making Finder Actions. I have yet to figure out how Pixelmator is able to supply an image larger than 32x32px.
Topic: App & System Services SubTopic: General Tags:
Jun ’25
Reply to onDrop() modifier with multiple UTTypes giving the least helpful one?
To summarise some of my replies outside the 500 character limit... Here is another sample project: https://github.com/cmsj/SwiftUITransferableOrderWrong This uses Transferable, and declares it can import three different ways, a ProxyRepresentation for URL, a FileRepresentation, or a DataRepresentation. Drag some files in from Finder: Non-image files use the ProxyRepresentation and work fine If the Proxy is commented out, those non-image files use the FileRepresentation and the provided URL is nonsense. If the DataRepresentation is not commented out, no matter which of the other two are present first, drags of image files from Finder will always choose the DataRepresentation. Surely this has to be a bug?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
May ’25
Reply to quickLookPreview keyboard issues on macOS
CommandGroup(after: .sidebar) { Button("Quicklook") { guard activeViewModel != nil else { return } activeViewModel?.extractForQuicklook() } .keyboardShortcut(.space, modifiers: []) // FIXME: This doesn't work if it's .space, but does work if it's "a" .disabled(activeViewModel?.selectedEntries.count == 0) Divider() } This is how I'm trying to set Space as the keyboard shortcut.
Topic: UI Frameworks SubTopic: SwiftUI
Jun ’24