fastlane-community / fastlane-plugin-appicon

Generate required icon sizes and iconset from a master application icon.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add support for Mac icons

JakeSc opened this issue · comments

I was able to add rough support for Mac icon sizes by modifying appicon/actions/appicon_action.rb to include the Mac dimensions, like this:

      def self.needed_icons
        {
          iphone: {
            '2x' => ['20x20', '29x29', '40x40', '60x60'],
            '3x' => ['20x20', '29x29', '40x40', '60x60']
          },
          ipad: {
            '1x' => ['20x20', '29x29', '40x40', '76x76'],
            '2x' => ['20x20', '29x29', '40x40', '76x76', '83.5x83.5']
          },
          mac: {
            '1x' => ['16x16', '32x32', '128x128', '256x256', '512x512'],
            '2x' => ['16x16', '32x32', '128x128', '256x256', '512x512']
          },
        }
      end

This worked for my purposes. I would submit a PR, however this isn't completely correct. Because of the double array loop where the resizing occurs, the script also writes out the iphone and ipad sizes, resulting in some Unassigned / unknown-trait-combination entries in the resulting xcassets file. A better solution would be to not export he iphone and ipad sizes for the mac device. I don't know enough about how necessary these are for the other devices to make the change myself.

@KrauseFx is there a standard way in a Fastlane Plugin to check which is the current platform?

Yeah,FastlaneCore::Helper.project.mac? or FastlaneCore::Helper.project.mac_app?