Skip to content

Add IconComposer support for .icon folders #1555

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

danielendler
Copy link

📋 PR Description - Add IconComposer Support for .icon Folders

Problem

IconComposer-generated .icon folders from Xcode beta were being treated as regular folders by XcodeGen, causing build failures. These folders contain complex structures with SVGs and JSON files that need to be handled as special file references, similar to .xcassets.

Solution

Added comprehensive support for .icon folders to be treated as file references with lastKnownFileType = "wrapper.icon" instead of regular directory groups.

Changes Made

Core Implementation:

  • FileType.swift: Added .icon extension mapping to FileType(buildPhase: .resources)
  • XCProjExtensions.swift: Added "wrapper.icon" file type mapping
  • SourceGenerator.swift: Special handling for .icon folders as directory file wrappers
  • PBXProjGenerator.swift: Dynamic ASSETCATALOG_COMPILER_APPICON_NAME build setting detection

New File:

  • IconComposerSupport.swift: Utility functions for detecting and handling IconComposer icons

Test Coverage:

  • IconComposerSupportTests.swift: Comprehensive test suite covering:
    • File reference handling (.icon folders as files, not groups)
    • Build settings configuration
    • IconComposer detection logic
  • Test Fixture: Generic TestIcon.icon with proper structure for validation

How It Works

  1. Detection: Scans asset catalogs for IconComposer-generated icons (identified by IconComposerAppIcon pattern)
  2. File Handling: Treats .icon folders as PBXFileReference with wrapper.icon type
  3. Build Settings: Automatically sets ASSETCATALOG_COMPILER_APPICON_NAME to detected icon name

Usage Example

# project.yml
targets:
  MyApp:
    sources:
      - path: Assets/MyIcon.icon  # Now works properly!

Testing

  • ✅ All existing tests pass (74/74)
  • ✅ New comprehensive test suite for IconComposer functionality
  • ✅ Test fixture validates end-to-end functionality

Backwards Compatibility

  • ✅ No breaking changes to existing functionality
  • ✅ Only adds new capability for .icon folders
  • ✅ Standard asset catalogs continue to work as before

Resolves: Support for IconComposer-generated icons from Xcode beta that would previously fail to build when treated as regular folders.

- Treat .icon folders as file references with wrapper.icon type instead of regular folders
- Add proper file type mapping for .icon extension in FileType.swift
- Update SourceGenerator to handle .icon folders as directory file wrappers
- Set ASSETCATALOG_COMPILER_APPICON_NAME build setting dynamically for IconComposer icons
- Add comprehensive test suite covering file reference handling and build settings
- Include test fixture with generic TestIcon.icon for validation

Resolves support for IconComposer-generated icons from Xcode beta that would
previously fail to build when treated as regular folders.
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.

1 participant