3

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.

dobranoc
  • 465
  • 1
  • 4
  • 17

2 Answers2

1

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.

Kwnstantinos Nikoloutsos
  • 1,832
  • 4
  • 18
  • 34
-1

This should work:

    strings:
        inputs:
            - First.strings
        outputs:
            output: FirstOutput.swift
    
        inputs:
            - Second.strings
        outputs:
            output: SecondOutput.swift
Bartosz Kunat
  • 1,485
  • 1
  • 23
  • 23