Skip to content

add support for app icon in ios#116

Open
Uttkarsh-Srivastava wants to merge 4 commits intofeature/launch-screenfrom
feature/appName-ios
Open

add support for app icon in ios#116
Uttkarsh-Srivastava wants to merge 4 commits intofeature/launch-screenfrom
feature/appName-ios

Conversation

@Uttkarsh-Srivastava
Copy link
Collaborator

@Uttkarsh-Srivastava Uttkarsh-Srivastava commented Oct 9, 2025

Changes

iOS App Icon Support (src/native/buildAppIos.js)

Added a new copyAppIcon() function that:

  • Searches for icon files in the public/ios/appIcons directory
  • Supports all required iOS icon sizes and scales
  • Recursively scans the directory for image files (.png, .jpg, .jpeg)
  • Automatically updates the AppIcon.appiconset with found icons
  • Provides helpful logging when icons are found or missing

📋 How to Use Custom Icons

For iOS:

Place your app icon files in the public/ios/appIcons directory using the following naming convention:

Required naming pattern: icon-{size}-{scale}.{ext}

Required Icon Sizes

Filename | Size (px) | Purpose
-- | -- | --
icon-20x20-2x.png | 40×40 | iPhone Notification
icon-20x20-3x.png | 60×60 | iPhone Notification
icon-29x29-2x.png | 58×58 | iPhone Settings
icon-29x29-3x.png | 87×87 | iPhone Settings
icon-40x40-2x.png | 80×80 | iPhone Spotlight
icon-40x40-3x.png | 120×120 | iPhone Spotlight
icon-60x60-2x.png | 120×120 | iPhone App
icon-60x60-3x.png | 180×180 | iPhone App
icon-1024x1024-1x.png | 1024×1024 | App Store

Supported formats: .png, .jpg, .jpeg

Example Directory Structure

public/
 ios/appIcons/
    icon-20x20-2x.png
    icon-20x20-3x.png
    icon-29x29-2x.png
    icon-29x29-3x.png
    icon-40x40-2x.png
    icon-40x40-3x.png
    icon-60x60-2x.png
    icon-60x60-3x.png
    icon-1024x1024-1x.png

@deputydev-agent
Copy link

DeputyDev will no longer review pull requests automatically.To request a review, simply comment #review on your pull request—this will trigger an on-demand review whenever you need it.

@mayankmahavar1mg
Copy link
Collaborator

⏺ Code Review: PR #116 - Add support for app icon in iOS

Summary: Adds copyAppIcon() function to handle custom iOS app icons from public/ios/appIcons directory.

✅ Strengths

  1. Comprehensive icon coverage - Supports all 9 required iOS icon sizes (20x20 @2x/@3x through 1024x1024 @1x)
  2. Flexible file format support - Handles PNG, JPG, and JPEG formats
  3. Graceful degradation - Logs helpful messages when icons not found with naming examples
  4. Proper error handling - Try-catch wrapping with warnings instead of crashes
  5. Contents.json management - Correctly updates/preserves existing AppIcon.appiconset metadata
  6. Duplicate prevention - Removes existing entries before adding new ones to avoid conflicts

⚠️ Issues & Concerns

  1. Unused recursive search logic (lines 31-53)
    - findImagesRecursively() is defined but only searches one level (no recursion in implementation)
    - The outer loop iterating subdirectories is missing
    - Consider: Remove "Recursively" from name or implement actual recursion
  2. Path construction inconsistency
    - Uses ${process.env.PWD}/public/ios/appIcons but other code uses relative paths
    - Consider: Use path.join() for cross-platform compatibility
  3. Silent file system errors (line 48)
    catch (err) {
    // Ignore directory read errors
    }
    - Completely silences errors - makes debugging difficult
    - Consider: Log at debug/trace level for troubleshooting
  4. Potential race condition (lines 67-77)
    - Reads existing Contents.json, then modifies and writes
    - If build runs in parallel, could have conflicts
    - Likely not an issue in practice, but worth noting
  5. No validation of icon dimensions
    - Accepts files matching naming pattern but doesn't verify actual pixel dimensions
    - Could lead to incorrect icons being used
    - Consider: Add image dimension validation (optional but recommended)

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.

3 participants