Ihor M.
Ihor M.

Reputation: 302

Use SwiftGen 6.1.0 for multiple assets in multiple directories

I have a very large project with multiple modules. I use separated Assets.xcassets in each of modules. Is it possible to use universal .yml declaration for use images? Now my .yml looks like listing below:

xcassets:
inputs: 
    - /Assets.xcassets

outputs:
    - templateName: swift4
    output: /UIImage+Assets.swift

But I have problems when I try to buld the project:

[31mMissing entry for key xcassets.paths.[0m
Command /bin/sh failed with exit code 1

I need to create right .yml for universal using in different modules by one scheme.

Upvotes: -1

Views: 1051

Answers (1)

Ihor M.
Ihor M.

Reputation: 302

ok, google, thanks for answer =)

FILENAMES = "assetPaths.txt"
EXTENSION = ".xcassets"

find . -name *$EXTENSION -print > $FILENAMES

while read assetsPath; do
if [[ $assetsPath != *"Pods"* ]]; then

dir = `dirname "$assetsPath"`
fileName = `basename "$assetsPath" "$EXTENSION"`
outputFile = $dir"/"$fileName".swift"
swiftgen xcassets "$assetsPath" -t swift4 --output "$outputFile"

fi
done < $FILENAMES

rm $FILENAMES

It works fine !

Upvotes: 1

Related Questions