SwiftUI App Icon Creator
Create iOS and macOS application icon in Xcode with SwiftUI
Xcode 12 and macOS 11 required
? How to
TL;DR: check out example project in this repository.
1️⃣ Create a new Swift Package
Define two products in your Package.swift
:
- Library that will contain your icon source code
- Executable that you will use to export icon images
Add swiftui-app-icon-creator
package as a dependency.
Your Package.swift
should like this:
2️⃣ Create icon view in the library taget, using SwiftUI
Just create a new SwiftUI view in the library target:
3️⃣ Use IconPreviews
to live-preview your icon in Xcode
Add this code to the file which contains your icon view:
Make sure your have selected the build scheme connected with your library target (MyAppIcon
in this example).
You should be able to live-preview the icon in Xcode previews.
You can adjust the configs
parameter to specify which types of the icon you want to preview. Check out IconConfig.swift
for possible options.
4️⃣ Add exporting code to the executable target
Add this code to main.swift
file in your executable target:
You can adjust the configs
variable to specify which types of the icon you want to export. Check out IconConfig.swift
for possible options.
In above example the images will be exported to MyAppIcon
directory on current user's desktop. Feel free to adjust the exportURL
variable to your needs.
5️⃣ Run the executable from Xcode to export your icon images
Make sure you have selected the build scheme connected with your executable target (export
in this example).
Images of your icon should be exported into a directory specified in exportURL
variable.