Giter VIP home page Giter VIP logo

bian's Introduction

Bian

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.

Minimum requirements

  • macOS 10.13 and higher
  • Xcode 11.0 and higher

Arguments

  • --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).

Example usage

Have a directory containing your alternative icon image assets, for example:

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.

Autogenerate Swift enum

Conditionally generates if a --swift-output path is provided.

⚠️ Any file which already exists at this location will be overwritten.

Example output .swift file

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
}

Autogenerate XCAssets

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.

⚠️ Any file which already exists at this location will be overwritten.


Integration

As build phase run script

  1. Download the latest Bian release or compile yourself from source.
  2. Copy Bian to a known location within your project directory.
  3. Create a new Build Phases run script from within Xcode (ensure it's before 'Compile Sources').
  4. Write a script to execute Bian on every build.
  5. 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}"

Manually

From terminal instance:

./Bian --icons-dir "/AwesomeApp/AltIcons" --info-plist "/AwesomeApp/Info.plist" --swift-output "/AwesomeApp/AltIcons.swift" --xcassets-output "/AwesomeApp/AltIcons.xcassets"

Dependencies


Why the name Bian?

Named after the Bian lian (face-changing) performance art.

bian's People

Contributors

ashleycameron avatar

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.