dobranoc
dobranoc

Reputation: 475

SwiftGen - multiple outputs each from a separate strings input

I have two .strings files in Xcode project, say: First.strings and Second.strings, and would like SwiftGen to generate a separate .swift file for each of them — one with contents of First.strings file and second with the contents of Second.strings file.

How should I configure the swiftgen.yml file under strings: param so that it knows how to do that? I wanted to avoid running the SwiftGen script twice.

Upvotes: 4

Views: 1310

Answers (2)

Konstantinos Nikoloutsos
Konstantinos Nikoloutsos

Reputation: 2180

Here is the documentation on constructing the 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

The above configuration gives the expected result. You can verify it by running swiftgen --verbose. The above example uses xcassets but you can do it with strings as well.

Upvotes: 2

Bartosz
Bartosz

Reputation: 1594

This should work:

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

Upvotes: -1

Related Questions