Squashed commit of the following:
Some checks failed
gitea-openium/resgen.swift/pipeline/head There was a failure building this commit

commit aa59ef28ea56315eb421ba044ddaf0c4066bfff8
Author: Thibaut Schmitt <t.schmitt@openium.fr>
Date:   Mon Nov 7 10:26:28 2022 +0100

    Add trailing carrier at the end of generated extension files

commit e985950aa1e39d81d4938e15f8724c0f7723b003
Author: Thibaut Schmitt <t.schmitt@openium.fr>
Date:   Fri Nov 4 16:37:34 2022 +0100

    Replace installation script by script that install completion file
    Setup a Makefile to install resgen

commit d574384c151259610a4c2f837b14068bb7716e44
Author: Thibaut Schmitt <t.schmitt@openium.fr>
Date:   Fri Nov 4 14:33:39 2022 +0100

    Refactor
    Improve testability
    Add tests on SwiftUI generated code
    Add tests on  command

commit d9e76632c3037da0ed9e1dd37056685416579da9
Author: Thibaut Schmitt <t.schmitt@openium.fr>
Date:   Thu Nov 3 15:43:47 2022 +0100

    Fixing bad merge on FontOptions

commit 76b5ebfcd1cde7a7d4c83f516a4fc937841e7715
Author: Thibaut Schmitt <t.schmitt@openium.fr>
Date:   Thu Nov 3 15:37:28 2022 +0100

    Squashed commit of the following:

    commit 085f1ffc33
    Author: Thibaut Schmitt <t.schmitt@openium.fr>
    Date:   Thu Nov 3 15:00:27 2022 +0100

        Refactor SwiftUI extension generation and generation SwiftUI extension for images

    commit 4f7d7e18b1
    Author: Thibaut Schmitt <t.schmitt@openium.fr>
    Date:   Mon Oct 31 16:21:32 2022 +0100

        Génération de composant SwiftUI: Color et Image

    commit 0797667b25
    Author: Thibaut Schmitt <t.schmitt@openium.fr>
    Date:   Mon Oct 31 16:21:12 2022 +0100

        Génération de composant SwiftUI: Color et Image

commit 417a2630925841dd486ae1d684d28ab7dca240e0
Author: Thibaut Schmitt <t.schmitt@openium.fr>
Date:   Wed Oct 19 17:13:03 2022 +0200

    Update Info.plist UIAppFonts key when generating fonts (if plist path if defined)
This commit is contained in:
2022-11-07 10:32:17 +01:00
parent 6203700b0c
commit 41733d2680
75 changed files with 1487 additions and 933 deletions

View File

@ -6,8 +6,9 @@ ResgenSwift is a package, fully written in Swift, to help you automatize ressour
## Fonts
Font generator generates an extension of `UIFont` (or a custom class). It also prints `UIAppFonts` to put in your project `.plist`.
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`.
Font generator generates an extension of `UIFont` and `Font` (or custom classes). It also prints content of `UIAppFonts` from your project `.plist`. If project `.plist` is specified, it will update `UIAppFonts` content of all `.plist`.
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 the `$PATH` contains path of `fc-scan`.
**Example**
@ -15,8 +16,10 @@ iOS required to use the **real name** of the font, this name can be different fr
swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/fonts.txt" \
--extension-output-path "./Fonts/Generated" \
--extension-name "AppFont" \
--extension-name-swift-ui "SUIAppFont" \
--extension-suffix "GreatApp" \
--static-members true
--static-members true \
--info-plist-paths "./path/one/to/Info.plist ./path/two/to/Info.plist"
```
**Parameters**
@ -24,9 +27,11 @@ swift run -c release ResgenSwift fonts $FORCE_FLAG "./Fonts/fonts.txt" \
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 thee class to add the extension
5. `--extension-suffix` *(optional)* : additional text which is added to the filename (ex: `AppFont+GreatApp.swift`)
6. `--static-members` *(optional)*: generate static properties or not
4. `--extension-name` *(optional)* : name of the class to add UIKit getters
5. `--extension-name-swift-ui` *(optional)* : name of the class to add SwiftUI 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
@ -39,6 +44,7 @@ swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \
--xcassets-path "./Colors/colors.xcassets" \
--extension-output-path "./Colors/Generated/" \
--extension-name "AppColor" \
--extension-name-swift-ui "SUIAppColor" \
--extension-suffix "GreatApp" \
--static-members true
```
@ -49,9 +55,10 @@ swift run -c release ResgenSwift colors $FORCE_FLAG "./Colors/colors.txt" \
2. Input colors file
3. `--style` can be `all` or `light`
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: `AppColor+GreatApp.swift`)
7. `--static-members` *(optional)*: generate static properties or not
5. `--extension-name` *(optional)* : name of the class to add UIKit getters
6. `--extension-name-swift-ui` *(optional)* : name of the class to add SwiftUI 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
## Strings
@ -135,6 +142,7 @@ swift run -c release ResgenSwift images $FORCE_FLAG "./Images/images.txt" \
--xcassets-path "./Images/app.xcassets" \
--extension-output-path "./Images/Generated" \
--extension-name "AppImage" \
--extension-name-swift-ui "SUIAppImage" \
--extension-suffix "GreatApp" \
--static-members true
```
@ -145,7 +153,8 @@ swift run -c release ResgenSwift images $FORCE_FLAG "./Images/images.txt" \
2. Input images definitions file
3. `--xcassets-path`: xcasset path where to generate imagesets
4. `--extension-output-path`: path where to generate generated extension
5. `--extension-name` *(optional)* : name of class to add the extension
5. `--extension-name` *(optional)* : name of the class to add UIKit getters
6. `--extension-name-swift-ui` *(optional)* : name of the class to add SwiftUI 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
@ -167,6 +176,7 @@ colors:
xcassetsPath: String
extensionOutputPath: String
extensionName: String?
extensionNameSwiftUI: String?
extensionSuffix: String?
staticMembers: Bool?
@ -175,15 +185,18 @@ fonts:
inputFile: String
extensionOutputPath: String
extensionName: String?
extensionNameSwiftUI: String?
extensionSuffix: String?
staticMembers: Bool?
infoPlistPaths: [String]
images:
-
inputFile: String
xcassetsPath: String
extensionOutputPath: String
extensionName: String?
extensionNameSwiftUI: String?
extensionSuffix: String?
staticMembers: Bool?
@ -223,6 +236,7 @@ colors:
xcassetsPath: String
extensionOutputPath: String
extensionName: String?
extensionNameSwiftUI: String?
extensionSuffix: String?
staticMembers: Bool?
-
@ -231,6 +245,7 @@ colors:
xcassetsPath: String
extensionOutputPath: String
extensionName: String?
extensionNameSwiftUI: String?
extensionSuffix: String?
staticMembers: Bool?
...
@ -263,4 +278,4 @@ Example:
```sh
ResgenSwift generate path/to/configuration.yml --project-directory ${PROJECT_DIR}
```
```