Giter Club home page Giter Club logo

viewtoappiconset's Introduction

ViewToAppIconSet

ViewToAppIconSet a Swift Library to generate an Xcode AppIcon.appiconset from a SwiftUI view.

Supported Platforms

macos macos macos macos macos

Getting Started

This is how you get started using ViewToAppIconSet in your project.

Installation

ViewToAppIconSet is distributed using the Swift Package Manager. Install it in a project by adding it as a dependency in your Package.swift manifest or through "Package Dependencies" in project settings.

[email protected]:StefKors/ViewToAppIconSet.git
let package = Package(
    dependencies: [
        .package(url: "[email protected]:StefKors/ViewToAppIconSet.git", from: "0.1.0")
    ]
)

If you find this package useful, please star the repo ⭐️

Usage

Create a view with your App Icon and use SwiftUI Previews to design.

import ViewToAppIconSet
import SwiftUI

struct AppIcon: View {
    @IconRelativeMetric var padding = 10 /// 10% padding
    let color: Color
    var body: some View {
        ContainerRelativeShape()
            .fill(Color.accentColor)
            .overlay(content: {
                Image(systemName: "circle.hexagongrid.fill")
                    .resizable()
                    .scaledToFit()
                    .padding(padding)
            })
    }
}

struct AppIcon_Previews: PreviewProvider {
    static var previews: some View {
        AppIcon()
            .iconStyle(.macOS)
            .frame(width: 100, height: 100, alignment: .center)
            .scenePadding()
    }
}

Call generateAppIconSet to generate the AppIconSet images

import ViewToAppIconSet

let path = try generateAppIconSet(from: AppIcon())

The output has the following structure:

AppIcon.appiconset
    ├── Contents.json
    ├── appstore1024.png
    ├── ipad152.png
    ├── ipad76.png
    ├── ipadNotification20.png
    ├── ipadNotification40.png
    ├── ipadPro167.png
    ├── ipadSettings29.png
    ├── ipadSettings58.png
    ├── ipadSpotlight40.png
    ├── ipadSpotlight80.png
    ├── iphone120.png
    ├── iphone180.png
    ├── mac1024.png
    ├── mac128.png
    ├── mac16.png
    ├── mac256.png
    ├── mac32.png
    ├── mac512.png
    ├── mac64.png
    ├── notification40.png
    ├── notification60.png
    ├── settings58.png
    ├── settings87.png
    ├── spotlight120.png
    └── spotlight80.png

Built by Stef Kors

viewtoappiconset's People

Contributors

stefkors avatar

Stargazers

 avatar  avatar

Forkers

oscar810429

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.