SwiftGen -来自单独字符串输入的多个输出

efzxgjgh  于 2023-01-29  发布在  Swift
关注(0)|答案(2)|浏览(185)

我在Xcode项目中有两个.strings文件,例如:First.stringsSecond.strings,并希望SwiftGen为每个文件生成单独的.swift文件-一个包含First.strings文件的内容,另一个包含Second.strings文件的内容。
我应该如何配置strings:参数下的swiftgen.yml文件,以便它知道如何做到这一点?我希望避免运行SwiftGen脚本两次。

toiithl6

toiithl61#

以下是有关构建swiftgen的文档

xcassets:
  - inputs: Foo/Assets.xcassets
    outputs:
      - templateName: swift5
        output: Foo/Resources/Assets.swift

  - inputs: SwiftPackages/Foo/Sources/Foo/Assets/Assets.xcassets
    outputs:
      - templateName: swift5
        output: SwiftPackages/Foo/Sources/Foo/Assets/Assets.swift

上面的配置给出了预期的结果。你可以通过运行swiftgen --verbose来验证它。上面的例子使用了xcassets,但是你也可以用字符串来做。

yrwegjxp

yrwegjxp2#

这应该行得通:

strings:
        inputs:
            - First.strings
        outputs:
            output: FirstOutput.swift
    
        inputs:
            - Second.strings
        outputs:
            output: SecondOutput.swift

相关问题