A small macOS command line utility for managing alternative iOS icons in Xcode projects.
Given a directory of icon images, Bian will automatically update your Info.plist with alternative icon entries and optionally autogenerate an associated Swift enum and .xcassets resource.
- macOS 10.13 and higher
- Xcode 11.0 and higher
--icons-dir
- Directory of icon image files to parse (e.g./AwesomeApp/AltIcons
).--info-plist
- Path to the Info.plist for your iOS app (e.g./AwesomeApp/Info.plist
).--swift-output
- (Optional) Output path for autogenerated Swift enum (e.g./AwesomeApp/AltIcons.swift
).--xcassets-output
- (Optional) Output path for autogenerated .xcassets (e.g./AwesomeApp/AltIcons.xcassets
).
Have a directory containing your alternative icon image assets, for example:
AltAppIcons/
dark@2x.png
dark@3x.png
pride@2x.png
pride@3x.png
festive@2x.png
festive@3x.png
The filename for each icon will be used as the identifier for Info.plist entries as well as any autogenerated file.
Multiple scale identfiers (e.g. @2x
) for the same icon will be parsed correctly and will not result in duplicate cases.
Any autogenerated files will need to be added to your Xcode project (including target membership). If you do this once for each given file, assuming the filename or path has not changed - subsequent runs of Bian will automatically update the added files.
Conditionally generates if a --swift-output
path is provided.
Each enum case .rawValue
property will match the file name parsed.
//
// Autogenerated file, changes will be overwritten.
//
enum AlternativeAppIcon: String, CaseIterable {
case dark
case pride
case festive
}
Conditionally generates if a --xcassets-output
path is provided.
The names of each asset in the generated .xcassets file will match the filename of the parsed icon image.
- Download the latest Bian release or compile yourself from source.
- Copy Bian to a known location within your project directory.
- Create a new Build Phases run script from within Xcode (ensure it's before 'Compile Sources').
- Write a script to execute Bian on every build.
- Add autogenerated files to Xcode target if needed.
Example script:
#!/bin/bash
echo "Generating alternative app icons"
bian="${SRCROOT}/AwesomeApp/Tools/Bian"
icons_dir="${SRCROOT}/AwesomeApp/Resources/App icons"
info_plist_path="${SRCROOT}/AwesomeApp/Info.plist"
swift_path="${SRCROOT}/AwesomeApp/Resources/AlternativeAppIcon.swift"
xcassets_path="${SRCROOT}/AwesomeApp/Resources/AlternativeAppIcons.xcassets"
"${bian}" --icons-dir "${icons_dir}" --info-plist "${info_plist_path}" --swift-output "${swift_path}" --xcassets-output "${xcassets_path}"
From terminal instance:
./Bian --icons-dir "/AwesomeApp/AltIcons" --info-plist "/AwesomeApp/Info.plist" --swift-output "/AwesomeApp/AltIcons.swift" --xcassets-output "/AwesomeApp/AltIcons.xcassets"
Named after the Bian lian (face-changing) performance art.