Coder Social home page Coder Social logo

assetchecker's Introduction

Localize

AssetChecker

Language: Swift Platform: iOS codebeat badge License: MIT GitHub tag

AssetChecker is a tiny run script that keeps your Assets.xcassets files clean and emits warnings when something is suspicious.

AssetChecker

Because Image Assets files are not safe, if an asset is ever deleted, nothing will warn you that an image is broken in your code.

Try it!

AssetChecker is part of freshOS iOS toolset. Try it in an example App! Download Starter Project

How

By using a script running automatically, you have a safety net that makes using Asset Catalog a breeze.

What

Automatically (On build)

  • Raises Errors for Missing Assets
  • Raises warnings for Unused Assets

Installation

Installation available via Cocoapods. Add the following to your Podfile:

pod 'AssetChecker', :git => 'https://github.com/freshOS/AssetChecker.git'

Or copy the script into your project.

Add the following Run Script in XCode, this will run the script at every build. If you installed via Cocoapods, you can use the following script:

${PODS_ROOT}/AssetChecker/run --catalog ${SRCROOT}/Resource/Images.xcassets

with arguments:

--catalog Absolute path to your Asset catalog (required)
--source Absolute path to your source directory.  Defaults to $SRCROOT

If you didn't use Cocoapods, use the path of where you copied AssetChecker script:

${SRCROOT}/{PATH_TO_THE_SCRIPT}/AssetChecker.swift ${SRCROOT}/Sources ${SRCROOT}/Resources/Images.xcassets

In this example your source files are located in /Sources and your Asset catalog is in /Resources/Images.xcassets.

And configure top section of the script :

// Configure me \o/
let sourcePath = "/Sources"
let assetCatalogPath = "/Resources/Assets.xcassets"
let ignoredUnusedNames = [String]()

Run and Enjoy \o/

False positives

Sometimes you're building the asset names dynamically so there is no way for AssetChecker to find out statically by looking at the codebase.

In this case the script will emit a false positive.

You can manually declare these false positives so that they get ignored !

Set the ignoredUnusedNames variable in the script file like so:

let ignoredUnusedNames = [
    "voteEN",
    "voteES",
    "voteFR"
]

Author

Sacha Durand Saint Omer, [email protected]

Contributing

Contributions to AssetChecker are very welcomed and encouraged!

License

AssetChecker is available under the MIT license. See LICENSE for more information.

Backers

Like the project? Offer coffee or support us with a monthly donation and help us continue our activities :)

Sponsors

Become a sponsor and get your logo on our README on Github with a link to your site :)

assetchecker's People

Contributors

fguchelaar avatar joeboyscout04 avatar michalsrutek avatar s4cha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

assetchecker's Issues

What if uses pdf

I am using pdf file for Xcode project in place of image 1x,2x,3x.
/Users/Akiran/Documents/WorkSpace/ProjectName/Resource/Images.xcassets:: error: [Asset Missing] AssertName

Its shows Assert Missing any solution for this?

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.