Skip to content

Add support for iOS 18 layered icons and Xcode 14+ single-size format#126

Open
radu-ciobanu-fresha wants to merge 1 commit intoHazAT:masterfrom
surgeventures:master
Open

Add support for iOS 18 layered icons and Xcode 14+ single-size format#126
radu-ciobanu-fresha wants to merge 1 commit intoHazAT:masterfrom
surgeventures:master

Conversation

@radu-ciobanu-fresha
Copy link
Copy Markdown

@radu-ciobanu-fresha radu-ciobanu-fresha commented Feb 2, 2026

Add support for iOS 18 layered icons and Xcode 14+ single-size format

Problem

The badge gem currently uses a simple glob pattern (/**/*.appiconset/*.{png,PNG}) to find app icons, which doesn't understand modern iOS icon formats:

  • iOS 18 layered icons: Separate files for light mode (all.png), dark mode (dark.png), and tinted variant (tint.png)
  • Xcode 14+ single-size: Single 1024x1024 icon instead of multiple sizes

This causes issues where either icons aren't badged correctly or the tool doesn't recognize the new format.

Solution

Added intelligent icon detection by parsing Contents.json from asset catalogs:

New IconCatalog class

  • Parses Contents.json to understand icon structure
  • Detects three icon format types:
    • Layered (iOS 18+): Badges all variants (all.png, dark.png, tint.png)
    • Single-size (Xcode 14+): Badges the single 1024x1024 icon
    • Legacy: Badges all size variants (existing behavior)
  • Falls back to original glob behavior when Contents.json is missing

Backward Compatibility

✅ Fully backward compatible:

  • Legacy multi-size icons work exactly as before
  • Custom --glob option still works (bypasses new logic)
  • Falls back to glob if Contents.json parsing fails

Changes

  • Added lib/badge/icon_catalog.rb - Contents.json parser
  • Modified lib/badge/runner.rb - Uses IconCatalog when no custom glob
  • Modified lib/badge.rb - Requires icon_catalog module
  • Bumped version to 0.13.1

Testing

Tested with:

  • ✅ iOS 18 layered icons (all.png, dark.png, tint.png)
  • ✅ Xcode 14+ single-size format
  • ✅ Legacy multi-size format (backward compatibility)

Backward Compatibility

  • ✅ Custom --glob option preserved (uses original code path, unchanged)
  • ✅ Falls back to glob when Contents.json missing or malformed

Related Issues

Fixes iOS 18 layered icon support (mentioned in #122)

- Create IconCatalog class to parse Contents.json intelligently
- Detect icon format types: legacy multi-size, single-size, or layered
- For layered icons (all.png, dark.png, tint.png), badge all variants
- Maintain backward compatibility with custom glob option
- Bump version to 0.13.1 to satisfy fastlane-plugin-badge constraint (~> 0.13.0)

Fixes issues with iOS 17/18 layered app icons that were breaking
the badge overlay functionality.
@radu-ciobanu-fresha radu-ciobanu-fresha marked this pull request as ready for review February 2, 2026 13:35
@mhyassin
Copy link
Copy Markdown

Hello @HazAT, would be great if we can get this merged 🙌

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants