Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pawello2222/AppIconGenerator
A library for creating App Icons from SwiftUI views.
https://github.com/pawello2222/AppIconGenerator
appicon appicons appstore icons ios ios16 ios17 macos swift swift-package swift-package-manager swiftui
Last synced: 3 months ago
JSON representation
A library for creating App Icons from SwiftUI views.
- Host: GitHub
- URL: https://github.com/pawello2222/AppIconGenerator
- Owner: pawello2222
- License: mit
- Created: 2020-10-14T23:12:53.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-15T12:29:55.000Z (6 months ago)
- Last Synced: 2024-07-16T20:41:13.946Z (4 months ago)
- Topics: appicon, appicons, appstore, icons, ios, ios16, ios17, macos, swift, swift-package, swift-package-manager, swiftui
- Language: Swift
- Homepage:
- Size: 267 KB
- Stars: 19
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - pawello2222/AppIconGenerator - A library for creating App Icons from SwiftUI views. (Swift)
README
# App Icon Generator
A library for creating App Icons from SwiftUI views.
Table of Contents
1. [Installation](#installation)
2. [Highlights](#highlights)
3. [Icon sets](#iconsets)
4. [Demo](#demo)
5. [License](#license)### Requirements
* iOS 16.0+
* macOS 13.0+### Swift Package Manager
App Icon Generator is available as a Swift Package.
```swift
.package(url: "https://github.com/pawello2222/AppIconGenerator.git", .upToNextMajor(from: "1.0.0"))
```Generate icons using `AppIconGenerator`
```swift
AppIconGenerator {
IconView()
}
.generateIcons(for: .iOS)
```or directly from within a SwiftUI block
```swift
IconView()
.generateIcons(for: .iOS)
```### Output
Generated icons will be saved in the documents directory (the full path will be logged to the console):
- iOS
> Icon saved to: /Users/.../Library/Developer/CoreSimulator/.../Documents/AppIconGenerator/Icon/Icon-1024.png
- macOS
> Icon saved to: /Users/.../Documents/AppIconGenerator/Icon/Icon-1024.png
```swift
extension IconSet {
public var sizes: [CGFloat] {
switch self {
case .iOS:
return [40, 58, 60, 76, 80, 87, 114, 120, 128, 136, 152, 167, 180, 192, 1024]
case .macOS:
return [16, 32, 64, 128, 256, 512, 1024]
case .watchOS:
return [44, 48, 55, 58, 60, 64, 66, 80, 87, 88, 92, 100, 102, 108, 172, 196, 216, 234, 258, 1024]
case .single:
return [1024]
case .custom(let sizes):
return sizes
}
}
}
``````swift
import AppIconGenerator
import SwiftUIstruct ContentView: View {
var body: some View {
IconView()
.generateIcons(for: .iOS, name: "MyIcon")
}
}struct IconView: View {
var body: some View {
GeometryReader { geometry in
ZStack {
Color.blue
Circle()
.fill(Color.red)
.frame(
width: geometry.size.width / 2,
height: geometry.size.height / 2
)
}
}
}
}
```App Icon Generator is available under the MIT license. See the [LICENSE](./LICENSE.md) file for more info.