Search code examples
iosxcodecfbundledocumenttypes

Adding file icon to custom file type in Xcode


I'm trying to add an icon (a PNG named "FileIcon") to a custom file type in Xcode 13, but can't seem to actually add it via the interface in Xcode:

enter image description here

Any other way to do this?

enter image description here

enter image description here

enter image description here


Solution

  • Per Apple's article Setting Up a Document Browser App, there is a snippet in there for the plist:

    <key>CFBundleDocumentTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeIconFiles</key>
            <array/>
            <key>CFBundleTypeName</key>
            <string>Text</string>
            <key>LSHandlerRank</key>
            <string>Alternate</string>
            <key>LSItemContentTypes</key>
            <array>
                <string>public.data</string>
            </array>
        </dict>
    </array>
    

    Is this set up correctly in your plist?