I recently spotted this article on Big Sur's new document icon system: https://developer.apple.com/news/?id=5i6jlf4d and thought it'd be fun to implement.
Sadly, actually implementing it seems to be nowhere as easy as the article makes it look.
My app can open and play MIDI files and as such, I have registered MIDI files as a document type:
Now the article shows that it's only possible to specify new document icon layers in imported or exported type identifiers, so I specified imported type identifiers for all three file types my app can handle.
One of them is .mid/.midi since those files launch my app when they're opened.
The two other files types are .sf2 and .dls. These are files that are usually never intended to be opened directly, but my app can use them to customize MIDI playback, and so I'd like to supply custom icons for them as well.
Here's the relevant part of my Info.plist:
The problem I'm now facing is that none of the custom icons are working. All I see in the Finder (even after clearing various caches manually) are the default auto-generated icons: i.imgur.com/BoZvQKn.png
Am I doing something wrong? Is this feature one that'll ship in a later version of Big Sur? What's going on here?
Sadly, actually implementing it seems to be nowhere as easy as the article makes it look.
My app can open and play MIDI files and as such, I have registered MIDI files as a document type:
Code Block plist <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeExtensions</key> <array> <string>mid</string> <string>midi</string> </array> <key>CFBundleTypeIconSystemGenerated</key> <integer>1</integer> <key>CFBundleTypeName</key> <string>MIDI file</string> <key>CFBundleTypeRole</key> <string>Viewer</string> <key>LSHandlerRank</key> <string>Default</string> <key>LSItemContentTypes</key> <array> <string>public.midi-audio</string> </array> <key>LSTypeIsPackage</key> <false/> <key>NSDocumentClass</key> <string>$(PRODUCT_MODULE_NAME).MIDIDocument</string> </dict> </array>
Now the article shows that it's only possible to specify new document icon layers in imported or exported type identifiers, so I specified imported type identifiers for all three file types my app can handle.
One of them is .mid/.midi since those files launch my app when they're opened.
The two other files types are .sf2 and .dls. These are files that are usually never intended to be opened directly, but my app can use them to customize MIDI playback, and so I'd like to supply custom icons for them as well.
Here's the relevant part of my Info.plist:
Code Block plist <key>UTImportedTypeDeclarations</key> <array> <dict> <key>UTTypeConformsTo</key> <array> <string>public.midi-audio</string> </array> <key>UTTypeDescription</key> <string>MIDI File</string> <key>UTTypeIcons</key> <dict> <key>UTTypeIconBackgroundName</key> <string>DocumentFill</string> <key>UTTypeIconBadgeName</key> <string>DocumentIcon</string> <key>UTTypeIconText</key> <string>midi</string> </dict> <key>UTTypeIdentifier</key> <string>de.peterwunder.MinimalMIDIPlayer.midi</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>midi</string> <string>mid</string> </array> </dict> </dict> <dict> <key>UTTypeConformsTo</key> <array> <string>com.soundblaster.soundfont</string> </array> <key>UTTypeDescription</key> <string>Soundfont (SF2)</string> <key>UTTypeIcons</key> <dict> <key>UTTypeIconBackgroundName</key> <string>DocumentFillSoundfont</string> <key>UTTypeIconBadgeName</key> <string>DocumentIcon</string> <key>UTTypeIconText</key> <string>sf2</string> </dict> <key>UTTypeIdentifier</key> <string>de.peterwunder.MinimalMIDIPlayer.sf2</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>sf2</string> </array> </dict> </dict> <dict> <key>UTTypeConformsTo</key> <array> <string>public.downloadable-sound</string> </array> <key>UTTypeDescription</key> <string>Soundfont (DLS)</string> <key>UTTypeIcons</key> <dict> <key>UTTypeIconBackgroundName</key> <string>DocumentFillSoundfont</string> <key>UTTypeIconBadgeName</key> <string>DocumentIcon</string> <key>UTTypeIconText</key> <string>dls</string> </dict> <key>UTTypeIdentifier</key> <string>de.peterwunder.MinimalMIDIPlayer.dls</string> <key>UTTypeTagSpecification</key> <dict> <key>public.filename-extension</key> <array> <string>dls</string> </array> </dict> </dict> </array>
The problem I'm now facing is that none of the custom icons are working. All I see in the Finder (even after clearing various caches manually) are the default auto-generated icons: i.imgur.com/BoZvQKn.png
Am I doing something wrong? Is this feature one that'll ship in a later version of Big Sur? What's going on here?