feat(RES-58): Add new parameter "bundle" #19
432
README.md
432
README.md
@@ -10,57 +10,114 @@ Font generator generates an extension of `UIFont` and `Font` (or custom classes)
|
|||||||
|
|
||||||
iOS required to use the **real name** of the font, this name can be different from its filename. To get the **real name**, it uses `fc-scan`. So, be sure that your `$PATH` variable contains path of `fc-scan`.
|
iOS required to use the **real name** of the font, this name can be different from its filename. To get the **real name**, it uses `fc-scan`. So, be sure that your `$PATH` variable contains path of `fc-scan`.
|
||||||
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
USAGE:
|
||||||
|
swift run -c release ResgenSwift fonts [-f] <input-file> --extension-output-path <extension-output-path> \
|
||||||
|
[--static-members <static-members>] \
|
||||||
|
[--visibility <visibility>] \
|
||||||
|
[--extension-name <extension-name>] \
|
||||||
|
[--extension-name-ui-kit <extension-name-ui-kit>] \
|
||||||
|
[--extension-suffix <extension-suffix>] \
|
||||||
|
[--info-plist-paths <info-plist-paths>]
|
||||||
|
|
||||||
|
ARGUMENTS:
|
||||||
|
<input-file> Input files where fonts ared defined.
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
-f, -F Should force generation
|
||||||
|
--static-members <static-members>
|
||||||
|
Tell if it will generate static properties or methods (default: false)
|
||||||
|
--visibility <visibility>
|
||||||
|
Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal (default: internal)
|
||||||
|
--extension-output-path <extension-output-path>
|
||||||
|
Path where to generate the extension.
|
||||||
|
--extension-name <extension-name>
|
||||||
|
Extension name. If not specified, it will generate an Font extension. (default: Font)
|
||||||
|
--extension-name-ui-kit <extension-name-ui-kit>
|
||||||
|
Extension name. If not specified, no extension will be generated.
|
||||||
|
--extension-suffix <extension-suffix>
|
||||||
|
Extension suffix. Ex: MyApp, it will generate {extensionName}+FontsMyApp.swift
|
||||||
|
--info-plist-paths <info-plist-paths>
|
||||||
|
Info.plist paths (array). Will be used to update UIAppFonts content
|
||||||
|
--version Show the version.
|
||||||
|
-h, --help Show help information.
|
||||||
|
```
|
||||||
|
|
||||||
**Example**
|
**Example**
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/fonts.txt" \
|
swift run -c release ResgenSwift fonts -f "./Fonts/fonts.txt" \
|
||||||
--extension-output-path "./Fonts/Generated" \
|
--extension-output-path "./Fonts/Generated" \
|
||||||
|
--static-members true \
|
||||||
|
--visibility "public" \
|
||||||
--extension-name "AppFont" \
|
--extension-name "AppFont" \
|
||||||
--extension-name-ui-kit "UIAppFont" \
|
--extension-name-ui-kit "UIAppFont" \
|
||||||
--extension-suffix "GreatApp" \
|
--extension-suffix "GreatApp" \
|
||||||
--static-members true \
|
|
||||||
--info-plist-paths "./path/one/to/Info.plist ./path/two/to/Info.plist"
|
--info-plist-paths "./path/one/to/Info.plist ./path/two/to/Info.plist"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
1. `-f`: force generation
|
|
||||||
2. Font input folder, it will search for every `.ttf` and `.otf` files specified in `fonts.txt`
|
|
||||||
3. `--extension-output-path`: path where to generate generated extension
|
|
||||||
4. `--extension-name` *(optional)* : name of the class to add SwiftUI getters
|
|
||||||
5. `--extension-name-ui-kit` *(optional)* : name of the class to add UIKit getters
|
|
||||||
6. `--extension-suffix` *(optional)* : additional text which is added to the filename (ex: `AppFont+GreatApp.swift`)
|
|
||||||
7. `--static-members` *(optional)*: generate static properties or not
|
|
||||||
8. `--info-plist-paths` *(optional)*: array of `.plist`, you can specify multiple `Info.plist` for multiple targets
|
|
||||||
|
|
||||||
|
|
||||||
## Colors
|
## Colors
|
||||||
|
|
||||||
Colors generator generates colorsets in specified xcassets and an extension of `Color` (or a custom class) associated to those colorsets. If the extension name is not specified, no extension will be generated.
|
Colors generator generates colorsets in specified xcassets and an extension of `Color` (or a custom class) associated to those colorsets. If the extension name is not specified, no extension will be generated.
|
||||||
|
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \
|
USAGE:
|
||||||
--style all \
|
swift run -c release ResgenSwift colors [-f] <input-file> \
|
||||||
--xcassets-path "./Colors/colors.xcassets" \
|
--style <style> \
|
||||||
--extension-output-path "./Colors/Generated/" \
|
--xcassets-path <xcassets-path> \
|
||||||
--extension-name "AppColor" \
|
[--static-members <static-members>] \
|
||||||
--extension-name-ui-kit "UIAppColor" \
|
[--visibility <visibility>] \
|
||||||
--extension-suffix "GreatApp" \
|
[--asset-bundle <asset-bundle>] \
|
||||||
--static-members true
|
[--extension-output-path <extension-output-path>] \
|
||||||
|
[--extension-name <extension-name>] \
|
||||||
|
[--extension-name-ui-kit <extension-name-ui-kit>] \
|
||||||
|
[--extension-suffix <extension-suffix>]
|
||||||
|
|
||||||
|
ARGUMENTS:
|
||||||
|
<input-file> Input files where colors ared defined.
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
-f, -F Should force generation
|
||||||
|
--style <style> Color style to generate: light for light colors only, or all for dark and light colors (values: light, all)
|
||||||
|
--xcassets-path <xcassets-path>
|
||||||
|
Path of xcassets where to generate colors
|
||||||
|
--static-members <static-members>
|
||||||
|
Tell if it will generate static properties or not (default: false)
|
||||||
|
--visibility <visibility>
|
||||||
|
Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal (default: internal)
|
||||||
|
--asset-bundle <asset-bundle>
|
||||||
|
Bundle where the asset are generated (default: main)
|
||||||
|
--extension-output-path <extension-output-path>
|
||||||
|
Path where to generate the extension.
|
||||||
|
--extension-name <extension-name>
|
||||||
|
SwiftUI extension name. If not specified, no extension will be generated.
|
||||||
|
--extension-name-ui-kit <extension-name-ui-kit>
|
||||||
|
UIKit extension name. If not specified, no extension will be generated.
|
||||||
|
--extension-suffix <extension-suffix>
|
||||||
|
Extension suffix. Ex: MyApp, it will generate {extensionName}+ColorsMyApp.swift
|
||||||
|
--version Show the version.
|
||||||
|
-h, --help Show help information.
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
1. `-f`: force generation
|
**Example**
|
||||||
2. Input colors file
|
|
||||||
3. `--style` can be `all` or `light`
|
|
||||||
4. `--extension-output-path` *(optional)* : path where to generate generated extension
|
|
||||||
5. `--extension-name` *(optional)* : name of the class to add SwiftUI getters
|
|
||||||
6. `--extension-name-ui-kit` *(optional)* : name of the class to add UIKit getters
|
|
||||||
7. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppColor+GreatApp.swift`)
|
|
||||||
8. `--static-members` *(optional)*: generate static properties or not
|
|
||||||
|
|
||||||
> ⚠️ Passing a `extensionOutputPath` without any `extensionName` does not generate extension. **But** passing an `extensionName` without `extensionOutputPath` will result in a error.
|
```sh
|
||||||
|
swift run -c release ResgenSwift colors -f "./Colors/colors.txt" \
|
||||||
|
--style all \
|
||||||
|
--xcassets-path "./Colors/colors.xcassets" \
|
||||||
|
--static-members true \
|
||||||
|
--visibility internal \
|
||||||
|
--asset-bundle "main" \
|
||||||
|
--extension-output-path "./Colors/Generated/" \
|
||||||
|
--extension-name "AppColor \
|
||||||
|
--extension-name-ui-kit "UIAppColor" \
|
||||||
|
--extension-suffix "GreatApp"
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ Option `extensionOutputPath` will require an `extensionName` or `extensionNameUIKit` to generate extension files. Passing an `extensionName` or `extensionNameUIKit` without `extensionOutputPath` will not generate any extension file.
|
||||||
|
|
||||||
## Strings
|
## Strings
|
||||||
|
|
||||||
@@ -69,94 +126,190 @@ Strings command allows to generate `strings` files along with extensions to acce
|
|||||||
### Twine (not recommended)
|
### Twine (not recommended)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
swift run -c release ResgenSwift strings twine $FORCE_FLAG "./Twine/strings.txt" \
|
USAGE:
|
||||||
|
swift run -c release ResgenSwift strings twine [-f] <input-file> \
|
||||||
|
--output-path <output-path> \
|
||||||
|
--langs <langs> \
|
||||||
|
--default-lang <default-lang> \
|
||||||
|
--extension-output-path <extension-output-path>
|
||||||
|
|
||||||
|
ARGUMENTS:
|
||||||
|
<input-file> Input files where strings ared defined.
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
-f, -F Should force generation
|
||||||
|
--output-path <output-path>
|
||||||
|
Path where to strings file.
|
||||||
|
--langs <langs> Langs to generate.
|
||||||
|
--default-lang <default-lang>
|
||||||
|
Default langs.
|
||||||
|
--extension-output-path <extension-output-path>
|
||||||
|
Path where to generate the extension.
|
||||||
|
--version Show the version.
|
||||||
|
-h, --help Show help information.
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
```sh
|
||||||
|
swift run -c release ResgenSwift strings twine -f "./Twine/strings.txt" \
|
||||||
--output-path "./Twine/Generated" \
|
--output-path "./Twine/Generated" \
|
||||||
--langs "fr en en-us" \
|
--langs "fr en en-us" \
|
||||||
--default-lang "en" \
|
--default-lang "en" \
|
||||||
--extension-output-path "./Twine/Generated"
|
--extension-output-path "./Twine/Generated"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
1. `-f`: force generation
|
|
||||||
2. Input translations file (must be Twine formatted)
|
|
||||||
3. `--langs`: langs to generate (string with space between each lang)
|
|
||||||
4. `--default-lang`: default lang that will be in `Base.lproj`. It must be in `langs` as well
|
|
||||||
5. `--extension-output-path`: path where to generate generated extension
|
|
||||||
|
|
||||||
### Stringium (recommended)
|
### Stringium (recommended)
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
swift run -c release ResgenSwift strings stringium $FORCE_FLAG "./Strings/strings.txt" \
|
USAGE:
|
||||||
--output-path "./Strings/Generated" \
|
swift run -c release ResgenSwift strings stringium [-f] <input-file> \
|
||||||
--langs "fr en en-us" \
|
--output-path <output-path> \
|
||||||
--default-lang "en" \
|
--langs <langs> \
|
||||||
--extension-output-path "./Strings/Generated" \
|
--default-lang <default-lang> \
|
||||||
--extension-name "AppString" \
|
[--tags <tags>] \
|
||||||
--extension-suffix "GreatApp" \
|
[--static-members <static-members>] \
|
||||||
--xcStrings true
|
[--xc-strings <xc-strings>] \
|
||||||
--static-members true
|
[--visibility <visibility>] \
|
||||||
|
[--asset-bundle <asset-bundle>] \
|
||||||
|
[--extension-output-path <extension-output-path>] \
|
||||||
|
[--extension-name <extension-name>] \
|
||||||
|
[--extension-suffix <extension-suffix>]
|
||||||
|
|
||||||
|
ARGUMENTS:
|
||||||
|
<input-file> Input files where strings are defined.
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
-f, -F Should force generation
|
||||||
|
--output-path <output-path>
|
||||||
|
Path where to find the .xcStrings file or the lproj folders.
|
||||||
|
--langs <langs> Langs to generate.
|
||||||
|
--default-lang <default-lang>
|
||||||
|
Default langs.
|
||||||
|
--tags <tags> Tags to generate. (default: ios iosonly iosOnly notranslation)
|
||||||
|
--static-members <static-members>
|
||||||
|
Generate static properties. False by default (default: false)
|
||||||
|
--xc-strings <xc-strings>
|
||||||
|
Tell if it will generate xcStrings file or lproj file. True by default (default: true)
|
||||||
|
--visibility <visibility>
|
||||||
|
Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal (default: internal)
|
||||||
|
--asset-bundle <asset-bundle>
|
||||||
|
Bundle where the asset are generated (default: main)
|
||||||
|
--extension-output-path <extension-output-path>
|
||||||
|
Path where to generate the extension.
|
||||||
|
--extension-name <extension-name>
|
||||||
|
Extension name. If not specified, no extension will be generated.
|
||||||
|
--extension-suffix <extension-suffix>
|
||||||
|
Extension suffix: {extensionName}+{extensionSuffix}.swift
|
||||||
|
--version Show the version.
|
||||||
|
-h, --help Show help information.
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters**
|
|
||||||
|
|
||||||
1. `-f`: force generation
|
**Example**
|
||||||
2. Input translations file (must be Twine formatted)
|
|
||||||
3. `--langs`: langs to generate (string with space between each lang)
|
|
||||||
4. `--default-lang`: default lang that will be in `Base.lproj`. It must be in `langs` as well
|
|
||||||
4. `--extension-output-path`: path where to generate generated extension
|
|
||||||
5. `--extension-name` *(optional)* : name of class to add the extension
|
|
||||||
6. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppString+GreatApp.swift`)
|
|
||||||
6. `--xcStrings`*(optional)* : generate string catalog
|
|
||||||
7. `--static-members` *(optional)*: generate static properties or not
|
|
||||||
|
|
||||||
|
```sh
|
||||||
|
swift run -c release ResgenSwift strings stringium -f "./Strings/strings.txt" \
|
||||||
|
--output-path "./Strings/Generated" \
|
||||||
|
--langs "fr en en-us" \
|
||||||
|
--default-lang "en \
|
||||||
|
--tags "ios iosonly iosOnly notranslation" \
|
||||||
|
--static-members true \
|
||||||
|
--xc-strings true \
|
||||||
|
--visibility "package" \
|
||||||
|
--asset-bundle "module" \
|
||||||
|
--extension-output-path "./Strings/Generated" \
|
||||||
|
--extension-name "AppString \
|
||||||
|
--extension-suffix "GreatApp"
|
||||||
|
```
|
||||||
|
|
||||||
|
> ⚠️ Option `extensionOutputPath` will require an `extensionName` or `extensionNameUIKit` to generate extension files. Passing an `extensionName` or `extensionNameUIKit` without `extensionOutputPath` will not generate any extension file.
|
||||||
|
|
||||||
## Tags
|
## Tags
|
||||||
|
|
||||||
Tags is also a subcommand of `Strings`. Input files are formatted the same way. Tags will generate properties which return exactly what is specified in the input file. It was designed to be used for analytics purpose and to be shared with any other platform to have the same analytics keys.
|
Tags is also a subcommand of `Strings`. Input files are formatted the same way. Tags will generate properties which return exactly what is specified in the input file. It was designed to be used for analytics purpose and to be shared with any other platform to have the same analytics keys.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
swift run -c release ResgenSwift strings tags $FORCE_FLAG "./Tags/tags.txt" \
|
USAGE:
|
||||||
--lang "ium" \
|
swift run -c release ResgenSwift strings tags [-f] <input-file> \
|
||||||
--extension-output-path "./Tags/Generated" \
|
--extension-output-path <extension-output-path> \
|
||||||
--extension-name "AppTags" \
|
[--lang <lang>] \
|
||||||
--extension-suffix "GreatApp" \
|
[--visibility <visibility>] \
|
||||||
--static-members true
|
[--static-members <static-members>] \
|
||||||
|
[--extension-name <extension-name>] \
|
||||||
|
[--extension-suffix <extension-suffix>]
|
||||||
|
|
||||||
|
ARGUMENTS:
|
||||||
|
<input-file> Input files where tags ared defined.
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
-f, -F Should force generation
|
||||||
|
--lang <lang> Lang to generate. ("ium" by default) (default: ium)
|
||||||
|
--visibility <visibility>
|
||||||
|
Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal (default: internal)
|
||||||
|
--extension-output-path <extension-output-path>
|
||||||
|
Path where to generate the extension.
|
||||||
|
--static-members <static-members>
|
||||||
|
Tell if it will generate static properties or not (default: false)
|
||||||
|
--extension-name <extension-name>
|
||||||
|
Extension name. If not specified, it will generate a Tag extension. (default: Tags)
|
||||||
|
--extension-suffix <extension-suffix>
|
||||||
|
Extension suffix. Ex: MyApp, it will generate {extensionName}+Tag{extensionSuffix}.swift
|
||||||
|
--version Show the version.
|
||||||
|
-h, --help Show help information.
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters**
|
**Example**
|
||||||
|
|
||||||
1. `-f`: force generation
|
```sh
|
||||||
2. Input tags file (must be Twine formatted)
|
swift run -c release ResgenSwift strings tags -f "./Tags/tags.txt" \
|
||||||
3. `--lang`: langs to look at in input file
|
--extension-output-path "./Tags/Generated" \
|
||||||
4. `--extension-output-path`: path where to generate generated extension
|
--lang "ium" \
|
||||||
5. `--extension-name` *(optional)* : name of class to add the extension
|
--visibility "public" \
|
||||||
6. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppTags+GreatApp.swift`)
|
--static-members true \
|
||||||
7. `--static-members` *(optional)*: generate static properties or not
|
--extension-name "AppTags" \
|
||||||
|
--extension-suffix "GreatApp"
|
||||||
|
```
|
||||||
|
|
||||||
> ⚠️ If extension name is not set or is `Tags`, it will generate the following typealias `typealias Tags = String`.
|
> ⚠️ If extension name is not set or is `Tags`, it will generate the following typealias `typealias Tags = String`.
|
||||||
|
|
||||||
|
|
||||||
## Analytics
|
## Analytics
|
||||||
|
|
||||||
Analytics will generate all you need to analyze UX with Matomo or Firebase Analytics. Input files are formatted in YAML. This command will generate a manager for each target and an AnalyticsManager. This is this one you will need to use. And it will generate a method for all tags you have declared in the YAML file. Next, you will need to use the `configure()` method of AnalyticsManager and if you want to use matomo to set up the `siteId` and the `url` of the site.
|
Analytics will generate all you need to analyze UX with Matomo or Firebase Analytics. Input files are formatted in YAML. This command will generate a manager for each target and an AnalyticsManager. This is this one you will need to use. And it will generate a method for all tags you have declared in the YAML file. Next, you will need to use the `configure()` method of AnalyticsManager and if you want to use matomo to set up the `siteId` and the `url` of the site.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
swift run -c release ResgenSwift analytics $FORCE_FLAG "./Tags/analytics.yml" \
|
USAGE:
|
||||||
--target "matomo firebase" \
|
swift run -c release ResgenSwift analytics [-f] <input-file> \
|
||||||
--output-file "./Analytics/Generated/AppAnalytics+GreatApp.swift" \
|
--target <target> \
|
||||||
--static-members true
|
--output-file <output-file> \
|
||||||
|
[--static-members <static-members>] \
|
||||||
|
[--visibility <visibility>]
|
||||||
|
|
||||||
|
ARGUMENTS:
|
||||||
|
<input-file> Input files where tags ared defined.
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
-f, -F Should force generation
|
||||||
|
--target <target> Target(s) analytics to generate. ("matomo" | "firebase")
|
||||||
|
--output-file <output-file>
|
||||||
|
Where to generate the analytics manager (path with filename)
|
||||||
|
--static-members <static-members>
|
||||||
|
Tell if it will generate static properties or not (default: false)
|
||||||
|
--visibility <visibility>
|
||||||
|
Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal (default: internal)
|
||||||
|
--version Show the version.
|
||||||
|
-h, --help Show help information.
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters**
|
**Example**
|
||||||
|
|
||||||
1. `-f`: force generation
|
```sh
|
||||||
2. Input tags file (must be YAML formatted)
|
swift run -c release ResgenSwift analytics -f "./Tags/analytics.yml" \
|
||||||
3. `--target`: target with you will log UX
|
--target "matomo firebase" \
|
||||||
4. `--output-file`: file where where to generate generated code, must contains path and filename (ex: `./Analytics/Generated/AppAnalytics+GreatApp.swift`)
|
--output-file "./Analytics/Generated/AppAnalytics+GreatApp.swift" \
|
||||||
7. `--static-members` *(optional)*: generate static properties or not
|
--static-members false \
|
||||||
|
--visibility "public"
|
||||||
> ⚠️ If extension name is not set or is `Analytics`, it will generate the following typealias `typealias Analytics = String`.
|
```
|
||||||
|
|
||||||
### YAML
|
### YAML
|
||||||
|
|
||||||
@@ -266,27 +419,59 @@ events:
|
|||||||
Images generator will generate images assets along with extensions to access those images easily. If the extension name is not specified, no extension will be generated.
|
Images generator will generate images assets along with extensions to access those images easily. If the extension name is not specified, no extension will be generated.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
swift run -c release ResgenSwift images $FORCE_FLAG "./Images/images.txt" \
|
USAGE:
|
||||||
|
resgen-swift images [-f] [-F] <input-file> \
|
||||||
|
--xcassets-path <xcassets-path> \
|
||||||
|
[--static-members <static-members>] \
|
||||||
|
[--visibility <visibility>] \
|
||||||
|
[--asset-bundle <asset-bundle>] \
|
||||||
|
[--extension-output-path <extension-output-path>] \
|
||||||
|
[--extension-name <extension-name>] \
|
||||||
|
[--extension-name-ui-kit <extension-name-ui-kit>] \
|
||||||
|
[--extension-suffix <extension-suffix>]
|
||||||
|
|
||||||
|
ARGUMENTS:
|
||||||
|
<input-file> Input files where strings ared defined.
|
||||||
|
|
||||||
|
OPTIONS:
|
||||||
|
-f Should force script execution
|
||||||
|
-F Regenerate all images
|
||||||
|
--xcassets-path <xcassets-path>
|
||||||
|
Xcassets path where to generate images.
|
||||||
|
--static-members <static-members>
|
||||||
|
Tell if it will generate static properties or not (default: false)
|
||||||
|
--visibility <visibility>
|
||||||
|
Visibility of extension and properties. Possibles values: public, private, package, internal. Default is internal (default: internal)
|
||||||
|
--asset-bundle <asset-bundle>
|
||||||
|
Bundle where the asset are generated (default: main)
|
||||||
|
--extension-output-path <extension-output-path>
|
||||||
|
Path where to generate the extension.
|
||||||
|
--extension-name <extension-name>
|
||||||
|
SwiftUI extension name. If not specified, no extension will be generated.
|
||||||
|
--extension-name-ui-kit <extension-name-ui-kit>
|
||||||
|
UIKit extension name. If not specified, no extension will be generated.
|
||||||
|
--extension-suffix <extension-suffix>
|
||||||
|
Extension suffix. Ex: MyApp, it will generate {extensionName}+Image{extensionSuffix}.swift
|
||||||
|
--version Show the version.
|
||||||
|
-h, --help Show help information.
|
||||||
|
```
|
||||||
|
|
||||||
|
**Example**
|
||||||
|
|
||||||
|
```sh
|
||||||
|
swift run -c release ResgenSwift images -F "./Images/images.txt" \
|
||||||
--xcassets-path "./Images/app.xcassets" \
|
--xcassets-path "./Images/app.xcassets" \
|
||||||
|
--static-members false \
|
||||||
|
--visibility "public" \
|
||||||
|
--asset-bundle "module" \
|
||||||
--extension-output-path "./Images/Generated" \
|
--extension-output-path "./Images/Generated" \
|
||||||
--extension-name "AppImage" \
|
--extension-name "AppImage" \
|
||||||
--extension-name-ui-kit "UIAppImage" \
|
--extension-name-ui-kit "UIAppImage" \
|
||||||
--extension-suffix "GreatApp" \
|
--extension-suffix "GreatApp"
|
||||||
--static-members true
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Parameters**
|
> ⚠️ Option `extensionOutputPath` will require an `extensionName` or `extensionNameUIKit` to generate extension files. Passing an `extensionName` or `extensionNameUIKit` without `extensionOutputPath` will not generate any extension file.
|
||||||
|
|
||||||
1. `-f`: force generation
|
|
||||||
2. Input images definitions file
|
|
||||||
3. `--xcassets-path`: xcasset path where to generate imagesets
|
|
||||||
4. `--extension-output-path` *(optional)* : path where to generate generated extension
|
|
||||||
5. `--extension-name` *(optional)* : name of the class to add SwiftUI getters
|
|
||||||
6. `--extension-name-ui-kit` *(optional)* : name of the class to add UIKit getters
|
|
||||||
6. `--extension-suffix` *(optional)* : additional text which is added to filename (ex: `AppImage+GreatApp.swift`)
|
|
||||||
7. `--static-members` *(optional)*: generate static properties or not
|
|
||||||
|
|
||||||
> ⚠️ Passing a `extensionOutputPath` without any `extensionName` does not generate extension. **But** passing an `extensionName` without `extensionOutputPath` will result in a error.
|
|
||||||
> ⚠️ Svg images will be copied in the assets and rendered as "Original", however if those images are not rendered correctly you can force the png generation by adding the key word "png" like this: id arrow_back 15 ? png
|
> ⚠️ Svg images will be copied in the assets and rendered as "Original", however if those images are not rendered correctly you can force the png generation by adding the key word "png" like this: id arrow_back 15 ? png
|
||||||
|
|
||||||
## All at once
|
## All at once
|
||||||
@@ -302,13 +487,15 @@ All parameters can be specified in a configuration file in `Yaml`:
|
|||||||
colors:
|
colors:
|
||||||
-
|
-
|
||||||
inputFile: String
|
inputFile: String
|
||||||
style: [light/all]
|
style: String
|
||||||
xcassetsPath: String
|
xcassetsPath: String
|
||||||
extensionOutputPath: String
|
extensionOutputPath: String
|
||||||
extensionName: String?
|
extensionName: String?
|
||||||
extensionNameUIKit: String?
|
extensionNameUIKit: String?
|
||||||
extensionSuffix: String?
|
extensionSuffix: String?
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
|
visiblity: String?
|
||||||
|
assetBundle: String?
|
||||||
|
|
||||||
fonts:
|
fonts:
|
||||||
-
|
-
|
||||||
@@ -318,6 +505,7 @@ fonts:
|
|||||||
extensionNameUIKit: String?
|
extensionNameUIKit: String?
|
||||||
extensionSuffix: String?
|
extensionSuffix: String?
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
|
visiblity: String?
|
||||||
infoPlistPaths: [String]
|
infoPlistPaths: [String]
|
||||||
|
|
||||||
images:
|
images:
|
||||||
@@ -329,6 +517,8 @@ images:
|
|||||||
extensionNameUIKit: String?
|
extensionNameUIKit: String?
|
||||||
extensionSuffix: String?
|
extensionSuffix: String?
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
|
visiblity: String?
|
||||||
|
assetBundle: String?
|
||||||
|
|
||||||
strings:
|
strings:
|
||||||
-
|
-
|
||||||
@@ -340,6 +530,9 @@ strings:
|
|||||||
extensionName: String?
|
extensionName: String?
|
||||||
extensionSuffix: String?
|
extensionSuffix: String?
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
|
visiblity: String?
|
||||||
|
assetBundle: String?
|
||||||
|
xcStrings: Bool?
|
||||||
|
|
||||||
tags:
|
tags:
|
||||||
-
|
-
|
||||||
@@ -349,14 +542,14 @@ tags:
|
|||||||
extensionName: String?
|
extensionName: String?
|
||||||
extensionSuffix: String?
|
extensionSuffix: String?
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
|
visiblity: String?
|
||||||
|
|
||||||
analytics:
|
analytics:
|
||||||
-
|
-
|
||||||
inputFile: String
|
inputFile: String
|
||||||
target: String
|
target: String
|
||||||
extensionOutputPath: String
|
outputFile: String
|
||||||
extensionName: String?
|
visibility: String?
|
||||||
extensionSuffix: String?
|
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -371,22 +564,26 @@ Sample for 2 colors configurations:
|
|||||||
colors:
|
colors:
|
||||||
-
|
-
|
||||||
inputFile: String
|
inputFile: String
|
||||||
style: [light/all]
|
style: String
|
||||||
xcassetsPath: String
|
xcassetsPath: String
|
||||||
extensionOutputPath: String
|
extensionOutputPath: String
|
||||||
extensionName: String?
|
extensionName: String?
|
||||||
extensionNameUIKit: String?
|
extensionNameUIKit: String?
|
||||||
extensionSuffix: String?
|
extensionSuffix: String?
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
|
visiblity: String?
|
||||||
|
assetBundle: String?
|
||||||
-
|
-
|
||||||
inputFile: String
|
inputFile: String
|
||||||
style: [light/all]
|
style: String
|
||||||
xcassetsPath: String
|
xcassetsPath: String
|
||||||
extensionOutputPath: String
|
extensionOutputPath: String
|
||||||
extensionName: String?
|
extensionName: String?
|
||||||
extensionNameUIKit: String?
|
extensionNameUIKit: String?
|
||||||
extensionSuffix: String?
|
extensionSuffix: String?
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
|
visiblity: String?
|
||||||
|
assetBundle: String?
|
||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -430,8 +627,9 @@ architecture:
|
|||||||
```
|
```
|
||||||
|
|
||||||
This will generate a file named as the architecture classname: `R.swift`. Based on the previous architecture, it will generate:
|
This will generate a file named as the architecture classname: `R.swift`. Based on the previous architecture, it will generate:
|
||||||
```
|
|
||||||
class R {
|
```swift
|
||||||
|
class R: Sendable {
|
||||||
static let images = R2Image()
|
static let images = R2Image()
|
||||||
static let strings = R2String()
|
static let strings = R2String()
|
||||||
static let fonts = R2Font()
|
static let fonts = R2Font()
|
||||||
@@ -439,25 +637,25 @@ class R {
|
|||||||
static let uikit = R2UI()
|
static let uikit = R2UI()
|
||||||
}
|
}
|
||||||
|
|
||||||
class R2Image {}
|
class R2Image: Sendable {}
|
||||||
|
|
||||||
class R2String {}
|
class R2String: Sendable {}
|
||||||
|
|
||||||
class R2Font {}
|
class R2Font: Sendable {}
|
||||||
|
|
||||||
class R2Image {}
|
class R2Image: Sendable {}
|
||||||
|
|
||||||
class R2UI {
|
class R2UI: Sendable {
|
||||||
let images = R2UIImage()
|
let images = R2UIImage()
|
||||||
let fonts = R2UIFont()
|
let fonts = R2UIFont()
|
||||||
let images = R2UIImage()
|
let images = R2UIImage()
|
||||||
}
|
}
|
||||||
|
|
||||||
class R2UIImage {}
|
class R2UIImage: Sendable {}
|
||||||
|
|
||||||
class R2UIFont {}
|
class R2UIFont: Sendable {}
|
||||||
|
|
||||||
class R2UIImage {}
|
class R2UIImage: Sendable {}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@@ -126,6 +126,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
let extensionNameUIKit: String?
|
let extensionNameUIKit: String?
|
||||||
let extensionSuffix: String?
|
let extensionSuffix: String?
|
||||||
let visibility: String?
|
let visibility: String?
|
||||||
|
let assetBundle: String?
|
||||||
let staticMembers: Bool?
|
let staticMembers: Bool?
|
||||||
|
|
||||||
internal init(
|
internal init(
|
||||||
@@ -137,6 +138,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
extensionNameUIKit: String?,
|
extensionNameUIKit: String?,
|
||||||
extensionSuffix: String?,
|
extensionSuffix: String?,
|
||||||
visibility: String?,
|
visibility: String?,
|
||||||
|
assetBundle: String?,
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
) {
|
) {
|
||||||
self.inputFile = inputFile
|
self.inputFile = inputFile
|
||||||
@@ -147,6 +149,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
self.extensionNameUIKit = extensionNameUIKit
|
self.extensionNameUIKit = extensionNameUIKit
|
||||||
self.extensionSuffix = extensionSuffix
|
self.extensionSuffix = extensionSuffix
|
||||||
self.visibility = visibility
|
self.visibility = visibility
|
||||||
|
self.assetBundle = assetBundle
|
||||||
self.staticMembers = staticMembers
|
self.staticMembers = staticMembers
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,6 +164,7 @@ struct ColorsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||||
- Extension suffix: \(extensionSuffix ?? "-")
|
- Extension suffix: \(extensionSuffix ?? "-")
|
||||||
- Visiblity: \(visibility ?? "default")
|
- Visiblity: \(visibility ?? "default")
|
||||||
|
- Asset Bundle: \(assetBundle ?? "default")
|
||||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@@ -221,6 +225,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
let extensionNameUIKit: String?
|
let extensionNameUIKit: String?
|
||||||
let extensionSuffix: String?
|
let extensionSuffix: String?
|
||||||
let visibility: String?
|
let visibility: String?
|
||||||
|
let assetBundle: String?
|
||||||
let staticMembers: Bool?
|
let staticMembers: Bool?
|
||||||
|
|
||||||
internal init(
|
internal init(
|
||||||
@@ -231,6 +236,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
extensionNameUIKit: String?,
|
extensionNameUIKit: String?,
|
||||||
extensionSuffix: String?,
|
extensionSuffix: String?,
|
||||||
visibility: String?,
|
visibility: String?,
|
||||||
|
assetBundle: String?,
|
||||||
staticMembers: Bool?
|
staticMembers: Bool?
|
||||||
) {
|
) {
|
||||||
self.inputFile = inputFile
|
self.inputFile = inputFile
|
||||||
@@ -240,6 +246,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
self.extensionNameUIKit = extensionNameUIKit
|
self.extensionNameUIKit = extensionNameUIKit
|
||||||
self.extensionSuffix = extensionSuffix
|
self.extensionSuffix = extensionSuffix
|
||||||
self.visibility = visibility
|
self.visibility = visibility
|
||||||
|
self.assetBundle = assetBundle
|
||||||
self.staticMembers = staticMembers
|
self.staticMembers = staticMembers
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,6 +260,7 @@ struct ImagesConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
- Extension name UIKit: \(extensionNameUIKit ?? "-")
|
||||||
- Extension suffix: \(extensionSuffix ?? "-")
|
- Extension suffix: \(extensionSuffix ?? "-")
|
||||||
- Visiblity: \(visibility ?? "default")
|
- Visiblity: \(visibility ?? "default")
|
||||||
|
- Asset Bundle: \(assetBundle ?? "default")
|
||||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
@@ -268,6 +276,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
let extensionName: String?
|
let extensionName: String?
|
||||||
let extensionSuffix: String?
|
let extensionSuffix: String?
|
||||||
let visibility: String?
|
let visibility: String?
|
||||||
|
let assetBundle: String?
|
||||||
let staticMembers: Bool?
|
let staticMembers: Bool?
|
||||||
let xcStrings: Bool?
|
let xcStrings: Bool?
|
||||||
|
|
||||||
@@ -280,6 +289,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
extensionName: String?,
|
extensionName: String?,
|
||||||
extensionSuffix: String?,
|
extensionSuffix: String?,
|
||||||
visibility: String?,
|
visibility: String?,
|
||||||
|
assetBundle: String?,
|
||||||
staticMembers: Bool?,
|
staticMembers: Bool?,
|
||||||
xcStrings: Bool?
|
xcStrings: Bool?
|
||||||
) {
|
) {
|
||||||
@@ -291,6 +301,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
self.extensionName = extensionName
|
self.extensionName = extensionName
|
||||||
self.extensionSuffix = extensionSuffix
|
self.extensionSuffix = extensionSuffix
|
||||||
self.visibility = visibility
|
self.visibility = visibility
|
||||||
|
self.assetBundle = assetBundle
|
||||||
self.staticMembers = staticMembers
|
self.staticMembers = staticMembers
|
||||||
self.xcStrings = xcStrings
|
self.xcStrings = xcStrings
|
||||||
}
|
}
|
||||||
@@ -306,6 +317,7 @@ struct StringsConfiguration: Codable, CustomDebugStringConvertible {
|
|||||||
- Extension name: \(extensionName ?? "-")
|
- Extension name: \(extensionName ?? "-")
|
||||||
- Extension suffix: \(extensionSuffix ?? "-")
|
- Extension suffix: \(extensionSuffix ?? "-")
|
||||||
- Visiblity: \(visibility ?? "default")
|
- Visiblity: \(visibility ?? "default")
|
||||||
|
- Asset Bundle: \(assetBundle ?? "default")
|
||||||
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
- Static members: \(staticMembers != nil ? "\(String(describing: staticMembers))" : "default")
|
||||||
- XC Strings: \(xcStrings != nil ? "\(String(describing: xcStrings))" : "default")
|
- XC Strings: \(xcStrings != nil ? "\(String(describing: xcStrings))" : "default")
|
||||||
"""
|
"""
|
||||||
|
@@ -36,6 +36,7 @@ extension ColorsConfiguration: Runnable {
|
|||||||
("--extension-name-ui-kit", extensionNameUIKit),
|
("--extension-name-ui-kit", extensionNameUIKit),
|
||||||
("--extension-suffix", extensionSuffix),
|
("--extension-suffix", extensionSuffix),
|
||||||
("--visibility", visibility),
|
("--visibility", visibility),
|
||||||
|
("--asset-bundle", assetBundle),
|
||||||
("--static-members", staticMembers?.description)
|
("--static-members", staticMembers?.description)
|
||||||
].forEach { argumentName, argumentValue in
|
].forEach { argumentName, argumentValue in
|
||||||
if let argumentValue {
|
if let argumentValue {
|
||||||
|
@@ -34,6 +34,7 @@ extension ImagesConfiguration: Runnable {
|
|||||||
("--extension-name-ui-kit", extensionNameUIKit),
|
("--extension-name-ui-kit", extensionNameUIKit),
|
||||||
("--extension-suffix", extensionSuffix),
|
("--extension-suffix", extensionSuffix),
|
||||||
("--visibility", visibility),
|
("--visibility", visibility),
|
||||||
|
("--asset-bundle", assetBundle),
|
||||||
("--static-members", staticMembers?.description)
|
("--static-members", staticMembers?.description)
|
||||||
].forEach { argumentName, argumentValue in
|
].forEach { argumentName, argumentValue in
|
||||||
if let argumentValue {
|
if let argumentValue {
|
||||||
|
@@ -37,6 +37,7 @@ extension StringsConfiguration: Runnable {
|
|||||||
("--extension-name", extensionName),
|
("--extension-name", extensionName),
|
||||||
("--extension-suffix", extensionSuffix),
|
("--extension-suffix", extensionSuffix),
|
||||||
("--visibility", visibility),
|
("--visibility", visibility),
|
||||||
|
("--asset-bundle", assetBundle),
|
||||||
("--xc-strings", staticMembers?.description),
|
("--xc-strings", staticMembers?.description),
|
||||||
("--static-members", xcStrings?.description)
|
("--static-members", xcStrings?.description)
|
||||||
].forEach { argumentName, argumentValue in
|
].forEach { argumentName, argumentValue in
|
||||||
|
@@ -25,6 +25,7 @@ final class ColorsConfigurationTests: XCTestCase {
|
|||||||
extensionNameUIKit: nil,
|
extensionNameUIKit: nil,
|
||||||
extensionSuffix: nil,
|
extensionSuffix: nil,
|
||||||
visibility: nil,
|
visibility: nil,
|
||||||
|
assetBundle: nil,
|
||||||
staticMembers: false
|
staticMembers: false
|
||||||
)
|
)
|
||||||
// When
|
// When
|
||||||
@@ -58,6 +59,7 @@ final class ColorsConfigurationTests: XCTestCase {
|
|||||||
extensionNameUIKit: "AppColor",
|
extensionNameUIKit: "AppColor",
|
||||||
extensionSuffix: "Testing",
|
extensionSuffix: "Testing",
|
||||||
visibility: "public",
|
visibility: "public",
|
||||||
|
assetBundle: "module",
|
||||||
staticMembers: false
|
staticMembers: false
|
||||||
)
|
)
|
||||||
// When
|
// When
|
||||||
@@ -84,6 +86,8 @@ final class ColorsConfigurationTests: XCTestCase {
|
|||||||
"Testing",
|
"Testing",
|
||||||
"--visibility",
|
"--visibility",
|
||||||
"public",
|
"public",
|
||||||
|
"--asset-bundle",
|
||||||
|
"module",
|
||||||
"--static-members",
|
"--static-members",
|
||||||
"false"
|
"false"
|
||||||
]
|
]
|
||||||
|
@@ -24,6 +24,7 @@ final class ImagesConfigurationTests: XCTestCase {
|
|||||||
extensionNameUIKit: nil,
|
extensionNameUIKit: nil,
|
||||||
extensionSuffix: nil,
|
extensionSuffix: nil,
|
||||||
visibility: nil,
|
visibility: nil,
|
||||||
|
assetBundle: nil,
|
||||||
staticMembers: nil
|
staticMembers: nil
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ final class ImagesConfigurationTests: XCTestCase {
|
|||||||
extensionNameUIKit: "AppImage",
|
extensionNameUIKit: "AppImage",
|
||||||
extensionSuffix: "Testing",
|
extensionSuffix: "Testing",
|
||||||
visibility: "private",
|
visibility: "private",
|
||||||
|
assetBundle: "module",
|
||||||
staticMembers: true
|
staticMembers: true
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -78,6 +80,8 @@ final class ImagesConfigurationTests: XCTestCase {
|
|||||||
"Testing",
|
"Testing",
|
||||||
"--visibility",
|
"--visibility",
|
||||||
"private",
|
"private",
|
||||||
|
"--asset-bundle",
|
||||||
|
"module",
|
||||||
"--static-members",
|
"--static-members",
|
||||||
"true"
|
"true"
|
||||||
]
|
]
|
||||||
|
@@ -24,6 +24,7 @@ final class StringsConfigurationTests: XCTestCase {
|
|||||||
extensionName: nil, // String
|
extensionName: nil, // String
|
||||||
extensionSuffix: nil, // Testing
|
extensionSuffix: nil, // Testing
|
||||||
visibility: nil, // "internal"
|
visibility: nil, // "internal"
|
||||||
|
assetBundle: nil, // .main
|
||||||
staticMembers: nil, // true
|
staticMembers: nil, // true
|
||||||
xcStrings: nil // true
|
xcStrings: nil // true
|
||||||
)
|
)
|
||||||
@@ -59,6 +60,7 @@ final class StringsConfigurationTests: XCTestCase {
|
|||||||
extensionName: "AppString",
|
extensionName: "AppString",
|
||||||
extensionSuffix: "Testing",
|
extensionSuffix: "Testing",
|
||||||
visibility: "internal",
|
visibility: "internal",
|
||||||
|
assetBundle: "module",
|
||||||
staticMembers: true,
|
staticMembers: true,
|
||||||
xcStrings: true
|
xcStrings: true
|
||||||
)
|
)
|
||||||
@@ -87,6 +89,8 @@ final class StringsConfigurationTests: XCTestCase {
|
|||||||
"Testing",
|
"Testing",
|
||||||
"--visibility",
|
"--visibility",
|
||||||
"internal",
|
"internal",
|
||||||
|
"--asset-bundle",
|
||||||
|
"module",
|
||||||
"--xc-strings",
|
"--xc-strings",
|
||||||
"true",
|
"true",
|
||||||
"--static-members",
|
"--static-members",
|
||||||
|
Reference in New Issue
Block a user