SwiftGen-Storyboard v4.2.0 Release Notes

  • ๐Ÿ”„ Changes in core dependencies of SwiftGen

    ๐Ÿ†• New Features

    • You can now pass custom parameters to your templates using the --param X=Y syntax.
      @djbe #265
      • This command-line option can be repeated at will and used to pass structured custom parameters (e.g. --param tabs=2 --param foo.bar=1 --param foo.baz=2).
      • You can then use them in your templates using e.g. {{param.tabs}}, {{param.foo.bar}} & {{param.foo.baz}}.
    • Templates can now access environment variables via the env key of the Stencil context (e.g. {{env.USER}}, {{env.LANG}}).
      @djbe #265
      • This is especially useful when integrating SwiftGen as a Script Build Phase in your Xcode project as you can then access Xcode Build Settings exposed as environment variables by Xcode, e.g. {{env.PRODUCT_MODULE_NAME}}.

    Notable new features from other SwiftGen repositories

    ๐Ÿ—„ Deprecations

    ๐Ÿšš In preparation for an upcoming cleanup of SwiftGen to remove some legacy code as well as Stencil old variables, tags and filters, and change the default templates to Swift 3, some things are being deprecated and will be removed in the next major version 5.0.

    As a result, if you wrote custom templates, you should already prepare for the upcoming 5.0 by migrating your templates to use the new variables (already avaiable in SwiftGen 4.2 / SwiftGenKit 1.0).

    ๐Ÿ“š See #244 and [the Migration Guide](Documentation/MigrationGuide.md) for a list of deprecations and their replacements.

    ๐Ÿ› Bug Fixes

    ๐Ÿ›  Notable bug fixes from other SwiftGen repositories

    Internal changes

    • SwiftGen has migrated to its own GitHub organization ๐ŸŽ‰.
    • SwiftGen has been split in multiple repositories and separate modules.
      Olivier Halligon @djbe #240 #265
      • The present SwiftGen is the CLI parsing. It is in charge of calling the frameworks, feeding them appropriate parameters according to the command line arguments.
      • SwiftGenKit is the framework responsible for parsing your assets/resources and turning them into a structured representation compatible with Stencil templates.
      • StencilSwiftKit is a framework adding some extensions to the template engine Stencil used by SwiftGen. It adds some tags and filters as well as convenience methods shared both by SwiftGen itself and by Sourcery.
      • The SwiftGen templates has been moved into a dedicated templates repo so they can evolve and be unit-tested separately of SwiftGen.

    ๐Ÿ“š Note: The next minor version will focus on bringing more documentation for all this new structure and improve ease of future contributions.