https://github.com/1998code/alternativeappicons
Let users choose app icons with SwiftUI on Apple OS 26
https://github.com/1998code/alternativeappicons
app icon ios logo macos
Last synced: 4 days ago
JSON representation
Let users choose app icons with SwiftUI on Apple OS 26
- Host: GitHub
- URL: https://github.com/1998code/alternativeappicons
- Owner: 1998code
- License: mit
- Created: 2022-08-06T12:59:08.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2025-07-27T08:48:19.000Z (12 months ago)
- Last Synced: 2025-10-23T22:02:38.515Z (9 months ago)
- Topics: app, icon, ios, logo, macos
- Language: Swift
- Homepage:
- Size: 2.25 MB
- Stars: 17
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# AlternativeAppIcons
Cross-platform SwiftUI app that lets users choose alternative app icons on iOS and macOS

## Features
### iOS / iPadOS
- ✅ Full alternative app icon support
- ✅ Permanent icon changes that persist between app launches
- ✅ Wheel picker interface
- ✅ Built-in system support via `UIApplication.setAlternateIconName()`
### macOS
- ✅ Temporary dock icon changes while app is running
- ✅ Menu picker interface (platform-appropriate)
- ✅ **Drag and drop custom icon support**
- ✅ **Custom icon upload with PNG, JPG, JPEG, SVG support**
- ✅ **Automatic image resizing to app icon dimensions**
- ✅ Icon preview functionality
- ✅ User feedback with clear explanations
## Platform Support
- **iOS / iPadOS 16+** - Full alternate app icon functionality
- **macOS 11.5+** - Temporary dock icon changes with custom icon support
- **Xcode 14+** - Development environment

## How It Works
### iOS / iPadOS Implementation
Uses the native `UIApplication.shared.setAlternateIconName()` API to permanently change the app icon. The changes persist between app launches and are fully supported by the iOS system.
### macOS Implementation
Changes the dock icon temporarily using `NSApplication.shared.applicationIconImage`. While macOS doesn't have built-in alternate app icon support like iOS, this provides a visual demonstration of the different icon options.
**New: Custom Icon Support**
- Select "Custom" from the picker to enable drag and drop
- Drag image files (PNG, JPG, JPEG, SVG) onto the drop zone
- Images are automatically resized to 1024x1024 (standard app icon size)
- Custom icons are applied immediately to the dock
## Setup Instructions
### 1. Icon Assets
The project includes two app icon sets:
- `AppIcon` - Default icon (Lando character)
- `AppIcon 2` - Alternative icon
For macOS support, the icons are also configured as individual image assets that can be accessed by name at runtime.
### 2. iOS Configuration
Add your alternative app icons to the `CFBundleIcons` key in your Info.plist:
```xml
CFBundleIcons
CFBundleAlternateIcons
AppIcon 2
CFBundleIconFiles
AppIcon 2
```
### 3. macOS Configuration
Ensure your alternative icons are available as named image assets in your Asset Catalog so they can be loaded with `NSImage(named:)`.
**New: Custom Icon Support**
- No additional configuration required for custom icon support
- The app automatically handles image loading, validation, and resizing
- Supports PNG, JPG, JPEG, and SVG file formats
- Images are automatically resized to 1024x1024 pixels
## Key Features
- **Cross-Platform Compatibility**: Works on both iOS and macOS with platform-appropriate UI
- **Visual Feedback**: Shows preview of selected icon and confirmation alerts
- **Conditional Compilation**: Uses `#if os()` directives for platform-specific code
- **Error Handling**: Proper error handling with user-friendly messages
- **Persistent Settings**: Uses `@AppStorage` to remember user's icon choice
- **Custom Icon Support**: Drag and drop functionality for macOS with automatic image processing
- **Smart UI**: Only shows relevant UI elements when they're meaningful

## Tutorial
Medium article: https://bit.ly/3A3M5Bs
## License
MIT