Skip to content

Latest commit

 

History

History
1571 lines (1276 loc) · 84.6 KB

CHANGELOG.md

File metadata and controls

1571 lines (1276 loc) · 84.6 KB

SwiftGen CHANGELOG


6.6.2

Changes in core dependencies of SwiftGen

Bug Fixes

Internal Changes

6.6.1

Changes in core dependencies of SwiftGen

Bug Fixes

  • CLI: fixed run parser when no params or options are provided (broken in 6.6.0).
    David Jennes #983
  • JSON/Plist/YAML: fixed code generation (broken in 6.6.0).
    David Jennes #983

6.6.0

Changes in core dependencies of SwiftGen

Breaking Changes

  • Strings: due to the bugfix for fallback translations, custom lookupFunctions will need to accept 3 arguments (table, key and value), up from 2 arguments (table and key).
    David Jennes #964

Deprecations

  • The Swift 4 templates are now deprecated. This means we will no longer test if the generated output is valid Swift code. We will still try to keep these up-to-date with context changes.
    David Jennes #955
  • Our spacing & trimming "hack" is now considered deprecated, and in the next major version we'll switch to Stencil's new "smart" trimming behaviour (see Stencil documentation for more information). Our built-in templates have already switched to this modern behaviour, you can try it with your own templates by using the --experimental-modern-spacing flag.
    David Jennes #977
  • XCAssets: some old properties & parameters are being deprecated. Read the migration guides for more information.
    David Jennes #978

New Features

  • Added support for --quiet/-q flag, to suppress all logs (except errors).
    Andre113 #823 #846
  • CoreData: ensure generated classes are final when model isn't abstract.
    grsouza #940
  • Added .artifactbundle release uploads to support SE-0325 Swift Plugins.
    nicorichard #913 #926
  • Strings: added support for .strings files comments. The built-in templates will now use them for comments instead of the translation of a key.
    CraigSiemens #563 #813
  • CoreData: support derived attributes.
    David Jennes #928 #961
  • Added an experimental flag --experimental-modern-spacing to enable modern spacing control, see Stencil documentation for more information. It will disable our own trimming "hack", and enable Stencil's "smart" trimming.
    David Jennes #977
  • XCAssets & Fonts: added support for SwiftUI. You can now easily access colors images, symbols and custom fonts from your SwiftUI code.
    David Jennes #979

Bug Fixes

Internal Changes

6.5.1

Bug Fixes

Internal Changes

  • Tweak release script to handle both universal & slim builds.
    David Jennes #884

6.5.0

Changes in core dependencies of SwiftGen

New Features

Bug Fixes

  • XCAssets: fixed some availability annotations that were incorrect.
    David Jennes #789
  • Strings: objc-h template now emits valid documentation comments.
    @szotp #822
  • Generate xcfilelist: Adds the template file path to the inputs xcfilelist (for custom templates).
    Craig Siemens #815
  • Strings: built-in templates now have better handling of multi-line translations.
    @mrackwitz #774

Internal Changes

6.4.0

New Features

  • The built-in templates will now correctly handle Swift Package Manager resources, using Bundle.module if it's available. As before, you can override the used Bundle using the bundle or lookupFunction template parameters.
    Arnaud Dorgans #763
  • Added config generate-xcfilelist subcommand to generate input and output xcfilelists based on your configuration file. These files should then be used in an Xcode build step that executes swiftgen config run. Don't forget to regenerate the file lists after adding/removing resources in your project in a way that might impact them.
    @CraigSiemens #441
  • Colors: the XML parser now accepts a colorFormat option, used to change the color format. The default format is rgba.
    @kevinstier #562 #768
  • IB: Added support for instantiating scenes while providing a creator block, commonly used for dependency injection. This feature is available in generated code starting from iOS 13, tvOS 13 and macOS 10.15.
    @matsune David Jennes #778

Bug Fixes

  • Plist: Update the parsing strategy (using Codable) to fix parsing of Bool values as Integer in some cases.
    @fortmarek Olivier Halligon #779
  • JSON/Plist/YAML: fixed issue with inline templates which incorrectly generated 1/0 as values, instead of true/false as expected.
    David Jennes #779 #783
  • JSON: the parser now correctly recognizes 0 and 1 as Int (instead of Bool).
    David Jennes #786

Internal Changes

  • Update the Swift version in .swift-version so that the right version is used when building manually (using swiftenv).
    @cfiken #764
  • Update Yams from 3.0.0 to 4.0.0.
    @hungrxyz #772
  • Updated Pods and Gems dependencies, and Xcode 12.
    David Jennes #782

6.3.0

Deprecations

  • Fonts: the generated Font typealias (to UIFont/NSFont) is deprecated and will be removed in the next major release.
    David Jennes #728

New Features

  • Strings: support for plurals declared in .stringsdict files.
    Florian Fittschen #184 #634
  • Fonts: the templates now support a new fontTypeName template parameter that you can use to change the name of the struct representing a font to something else.
    David Jennes #728
  • Fonts: the templates now support a new fontAliasName that you can use to change the typealias's name from Font to something else. For example: this is useful when working with SwiftUI which already defines a Font type. Note that as this typealias is deprecated (see deprecations above), this template parameter will also be removed in the next major release.
    David Jennes #647 #728
  • CoreData: Deprecates fetchRequest() and adds makeFetchRequest() to avoid ambiguous function usage.
    David Rothera #726
  • XCAssets: image assets now load faster on macOS if they're in the main bundle. MacOS only provides a caching mechanism for images in the main bundle, for other cases you may need to provide your own caching mechanism as needed.
    David Jennes #648 #733
  • Fonts/IB/JSON/Plist/Strings/XCAssets: all templates that load data at runtime from a bundle now support a bundle template parameter, which you can use to override the bundle from which resources are loaded. Check out the template specific documentation for more information. For an in-depth explanation, also check the customize loading of resources article.
    David Jennes #737
  • Fonts/IB/JSON/Plist: Similar to the strings templates, these templates now support a lookupFunction template parameter, which allows you to provide your own resource lookup mechanism at runtime. Check the template specific documentation for more information. For an in-depth explanation, also check the customize loading of resources article.
    David Jennes #738

Bug Fixes

  • Strings: fix incorrect interpretation of format placeholders when there were missing positional parameters (e.g. "%2$@" without a %1$… defined).
    Olivier Halligon #634

6.2.1

There are no major changes in this release, although JSON & Plist template writers may want to read the small migration guide to prepare for upcoming context changes.

Deprecations

  • JSON & Plist: if you wrote your own templates, know that the documents property of a file has been deprecated in favour of document. The old documents property will be removed in the next major release.
    David Jennes #702 #732

Bug Fixes

  • Prevent generating default.profraw (code coverage) files.
    David Jennes #722
  • JSON/Plist/YAML: Fix issue with homogeneous Arrays in the Inline templates (such as [String]).
    #687 @fjtrujy
  • Avoid breaking the system swift installation when installing SwiftGen via Homebrew on macOS 10.14.4 or higher.
    David Jennes #686 #730

Internal Changes

  • Parsers are now executed in parallel, making SwiftGen faster when multiple parsers are used. Note: only applies when using a configuration file.
    Marcelo Fabri #699
  • Use JSONSerialization instead of Yams for parsing JSONs, making the json parser faster.
    Marcelo Fabri #698
  • JSON/Plist/YAML: Lazily evaluate metadata of documents, making SwiftGen faster if the metadata field is never used in a template.
    Marcelo Fabri #700

6.2.0

⚠️ This minor version contains a lot of deprecations that may apply to your configuration and how you use SwiftGen. With the exception of swift3 templates (which have been removed), everything should still work as before. But be warned that all features marked as deprecated will be removed in SwiftGen 7.0.

Read the SwiftGen 6.2 Migration Guide for a list of changes you'll need to apply.

Breaking Changes

  • As Swift 3 is officially no longer maintained, we're obsoleting the Swift 3 templates and they are no longer included with SwiftGen. You can still use the old swift 3 templates by getting them from older SwiftGen versions, or from GitHub by browsing older tags.
    David Jennes #601 #691

Deprecations

  • XCAssets: the colorAliasName and imageAliasName template parameters are now deprecated and will be removed in the next major release.
    David Jennes #614
  • The use of swiftgen <parser> (e.g. swiftgen strings, swiftgen xcassets, …) command line for running individual parsers is now deprecated in favor of swiftgen run <parser>. See "New Features" below.
    Olivier Halligon #705
  • The subcommand swiftgen templates has been renamed swiftgen template (singular); the plural form of the command has been deprecated and will be removed in next major version.
    Olivier Halligon #697
  • The ability for SwiftGen to search custom named templates in ~/Library/Application Support has been deprecated and will be removed in SwiftGen 7.0. This little known feature made SwiftGen dependent on the machine it was running on. Use templatePath to reference custom templates by path instead.
    Olivier Halligon #717

New Features

  • Invoking individual parsers from the command line is now done via swiftgen run <parser>. We still highly recommend to use a configuration file for flexibility and performance reasons in your projects, and only use swiftgen run <parser> for things like quick iterations when writing your own custom templates.
    Olivier Halligon #705
  • You can now easily create a new config file using swiftgen config init. This will create an example and commented config file and open it to let you edit it to your needs. Note that the generated config file is static content which doesn't take the user's project into account (though that might change in the future).
    Olivier Halligon #694
  • You can now use swiftgen template doc [parser] [templateName] on the command line to quickly open the documentation for templates on GitHub directly from your terminal.
    Olivier Halligon #697
  • Each parser now accepts an options dictionary, with which you can set internal parser settings to change its behaviour. See the parser's specific documentation for available options.
    David Jennes #587 #597
  • Strings: the parser now accepts a separator option, used to split keys into structured components. The default separator remains .. For more information, check the parser's documentation.
    David Jennes #576 #588
  • Core Data: the built-in templates now support an optional extraImports parameter. With this you can provide a list of modules to additionally import, for when you have properties with types from external modules. For more information, check the template's documentation.
    David Jennes #591 #592
  • Core Data: the built-in templates now support RawRepresentable attributes (such as enum, OptionSet, …). They'll check the "User Info" of an attribute for a RawType key, which should be set to the type name you want to use for that attribute. To avoid optional attributes, you can also add the unwrapOptional user info key. For more information, check the template's documentation.
    David Jennes #566 #609 #593 #610
  • Strings: the built-in templates now accept a parameter lookupFunction for customizing the localization function, check the template documentation for more information.
    Steven Magdy 426 468 573 716
  • Strings: templates to generate Objective-C. Please check the template's documentation for more information.
    Eric Slosser SwiftGen/SwiftGen#378
  • XCAssets: the parser now supports AR Resource Groups, together with reference images and objects.
    David Jennes #614
  • Templates: Bundle now use static property on BundleToken for better performance.
    shuoli84 #623
  • All parsers now have built-in Swift 5 templates.
    David Jennes #595 #600
  • Most templates now accept a parameter to force having the file name used as namespace (enum <FileName>) in generated code even if there's only one single input file.
    Viktoras Laukevičius #669 Olivier Halligon #693

Bug Fixes

  • SwiftGen now properly shows a better help message and the command usage when running an incomplete command, instead of complaining about a config file.
    Olivier Halligon #706
  • XCAssets: improved the performance for color assets by caching the resolved colors.
    David Jennes #578 #589
  • Core Data: entityName is now correctly a class var instead of a class func.
    David Jennes #590
  • Strings: we now correctly generate the type Any (instead of String) for %@ placeholders.
    David Jennes 620
  • Colors: Reduce initializer type inference for improved compilation performance.
    Markus Faßbender #663
  • Config Lint: fix config lint not processing relative paths containing ".." correctly.
    Wolfgang Lutz #688
  • Core Data: the generated code was missing , (comma) for fetch requests with multiple arguments.
    David Jennes #692
  • Colors: Fix compile time warning when long expression type checking is enabled.
    Ryan Mason-Davies #704 #710

Internal Changes

  • The main branch of the repository has been renamed from master to stable. If you pointed your Podfile or dependency managment tool to master instead of an official release/tag, you will have to update the branch name in your dependency file.
    Olivier Halligon #714
  • Documentation: Improved doc for creating custom templates, and added a Documentation Table of Contents.
    Olivier Halligon #713
  • Refactoring: Reduce globals & rearrange CLI code.
    Olivier Halligon #586
  • Moved generated test output files into subdirectories per template.
    David Jennes #598
  • Compile generated output using configuration files for easier management.
    David Jennes #365 #599
  • XCAssets: renamed the catalogs we use for sample code & testing to avoid some confusion.
    David Jennes #613
  • Update SwiftLint and enable some extra SwiftLint rules.
    David Jennes #617
  • Some CI fixes related to software versions.
    Patrick Nollet #645
  • Updated to CocoaPods 1.9.0.
    David Jennes #619
  • Updated Pods and Gems dependencies.
    David Jennes #684

6.1.0

Changes in core dependencies of SwiftGen

New Features

Bug Fixes

  • Colors: Fix an issue where the public access modifier was not being added correctly in the literals-swift3 and literals-swift4 templates when the publicAccess parameter was specified. Also remove some uneccessary public access modifiers from the swift3 and swift4 templates.
    Isaac Halvorson #549

Internal Changes

  • Resolve path if the binary is a symbolic link in order to find bundled templates.
    Liquidsoul #559
  • Update to SwiftLint 0.30.1 and enable some extra SwiftLint rules.
    David Jennes #574 #583

6.0.2

Changes in core dependencies of SwiftGen

Bug Fixes

  • Strings: rolled back the changes in #503, to ensure %% is correctly unescaped.
    David Jennes #542
  • Strings: generate the correct types for %c and %p.
    David Jennes #543
  • SPM/Mint: SwiftGen now provides correct version information, instead of "0.0".
    David Jennes #544

6.0.1

Changes in core dependencies of SwiftGen

Bug Fixes

Internal Changes

6.0.0

⚠️ This major version is a big milestone in which a lot of refactoring and cleaning has been done. Many features added over previous releases have been reworked and unified, while also preparing SwiftGen for future additions. This means that you'll need to adapt your configuration files (or command line invocations) and custom templates to work with this new major version.

Read the SwiftGen 6.0 Migration Guide for a list of changes you'll need to apply.

Changes in core dependencies of SwiftGen

Breaking Changes

  • Don't normalize string keys while parsing, let all transformation be done on template side. This makes the developer responsible to keep the language file organized, duplications won't be removed.
    Diego Chohfi #257
  • Remove Swift 2 support.
    David Jennes #420
  • Renamed the storyboards command to ib, to better reflect it's purpose. An alias for storyboards still exists, but it will be removed at some point.
    David Jennes #423
  • XCAssets: the generated templates won't namespace groups by default anymore, use the forceProvidesNamespaces flag to enable this behaviour again.
    jechris #453
  • XCAssets: the templates won't generate any all-values accessors anymore by default. Use the allValues flag to enable this behaviour again. Note: this replaces the old noAllValues flag (with an inverse behaviour).
    David Jennes #480
  • XCAssets: Dropped the deprecated allValues constant, use the type specific constants such as allColors, allDataItems and allImages. The default value of imageAlias has also been changed from Image to AssetImageTypeAlias, to be consistent with the other types.
    David Jennes #482
  • Interface Builder: split up the storyboards template into 2 parts, one for scenes and one for segues.
    David Jennes #419

New Features

  • Add ability to list all custom fonts and register them using FontFamily.registerAllCustomFonts.
    Olivier Halligon #394
  • Add support for Swift Package Manager and Mint.
    Yonas Kolb #411
  • The swiftgen.yml config file now accepts multiple outputs for each parser, allowing you to generate multiple outputs from the same files and content. This also means that the output parameter is now deprecated, in favour of the outputs parameter, and it may be removed in a future version of SwiftGen. Similarly, the paths parameter has been renamed to inputs for consistency. You can always use swiftgen config lint to validate your configuration file.
    David Jennes #424 #510
  • Use swiftlint:disable all in generated files to avoid interference with SwiftLint rules custom to the host project.
    Frederick Pietschmann David Jennes #409 #506
  • XCAssets: Added support for NSDataAssets.
    Oliver Jones #444
  • Organised the generated code in sections for better readability, with all generated constants at the top of the file.
    David Jennes Olivier Halligon #456 #481
  • Added support for JSON, Plist and YAML files using the swiftgen json, swiftgen plist and swiftgen yaml commands. The parsed contexts and the generated files for each parser have been kept quite similar, for easier switching between file formats.
    John T McIntosh Toshihiro Suzuki Peter Livesey David Jennes #379 #359 #288 #188 #493 #504
  • Updated the playgrounds with the new json, plist and yaml parsers, and updated the other pages to reflect the template changes.
    David Jennes #495
  • We're deprecating the old --template CLI option in favor of --templateName, to better match the naming of the other options and the configuration file. The old --template option will remain until the next major version.
    David Jennes #509

Bug Fixes

  • Fix memory leak in generated code for Fonts.
    Olivier Halligon #394
  • Interface Builder: ensure the templates handle GLKViewController, AVPlayerViewController and NSPageController correctly.
    David Jennes #404 #414
  • Interface Builder: ensure the parser can handle files with and without "trait variations".
    David Jennes #367 #429
  • Restrict SceneType and InitialSceneType to UIViewController when not targeting AppKit. When targeting AppKit, remove superfluous Any.
    Darron Schall #463 #464
  • Fonts: disable a warning in generated font files for projects with conditional_returns_on_newlines SwiftLint rule enabled.
    Ryan Davies #436 #465
  • Interface Builder: the parser and templates now handle the "Inherit module from target" setting.
    David Jennes #435 #485
  • Strings: the parser now correctly handles formats such as % d and %#x.
    David Jennes #502
  • Strings: ensure strings without arguments are not processed using String(format:).
    David Jennes #503

Internal Changes

5.3.0

Changes in core dependencies of SwiftGen

New Features

Internal Changes

  • Merged the SwiftGenKit and templates repositories back into this repository for easier development and maintenance.
    David Jennes #356

5.2.1

Bug Fixes

  • Fix SwiftGen no longer working using CLI parameters (instead of config file).
    David Jennes #347
  • Errors now properly exit with a non-zero exit code.
    Olivier Halligon #348
  • swiftgen --help prints the full help back again (and not just the help of the default config run subcommand).
    Olivier Halligon #349

5.2.0

Changes in core dependencies of SwiftGen

New Features

Bug Fixes

5.1.2

Internal Changes

5.1.1

Changes in core dependencies of SwiftGen

Bug Fixes

5.1.0

Changes in core dependencies of SwiftGen

New Features

  • Added Swift 4 templates. Use -t swift4 or whatever variant you want to use (see swiftgen templates list for the available names).
    David Jennes SwiftGen/templates/#67
  • XCAssets: Added support for named colors. When using swiftgen xcassets the bundled templates will now also include colors found in the Asset Catalog in addition to the images.
    David Jennes SwiftGen/templates/#68
  • Fonts: the path to fonts will now default to just the font filename, but you can disable this behaviour by enabling the preservePath parameter.
    David Jennes SwiftGen/templates/#71
  • Colors: new template that uses #colorLiterals.
    Use swiftgen colors -t literals-swift3 / swiftgen colors -t literals-swift4 to use them.
    David Jennes SwiftGen/templates/#72

5.0.0

⚠️ This major version is a big milestone in which a lot of refactoring and cleaning has been done. Many features added over previous releases have been reworked and unified, while also preparing SwiftGen for future additions. This means that you'll need to adapt your command line invocations and custom templates to work with this new major version.

Read the SwiftGen 5.0 Migration Guide for a list of changes you'll need to apply.

Changes in core dependencies of SwiftGen

Breaking Changes

  • Removed deprecated CLI options. Please consult the migration guide should you still use them.
    David Jennes #301
  • Disable default value for named template option and ensure that there is a template option.
    Liquidsoul #283
  • Templates are now grouped by parser on the filesystem. This is only important if you had custom templates in the Application Support directory. To migrate your templates, place them in a subfolder with the name of the parser, and remove the prefix of the template filename.
    David Jennes #304
  • The images command has been renamed to xcassets to better reflect its functionality.
    Olivier Halligon #317

Notable breaking changes from other SwiftGen repositories

New Features

Internal Changes

Notable internal changes from other SwiftGen repositories

  • Switch back from actool to an internal parser to fix numerous issues with the former. This fixes issues a few people encountered when using asset catalogs that contained some of the less common set types.
    David Jennes #228 SwiftGen/SwiftGenKit#43

4.2.1

Changes in core dependencies of SwiftGen

Bug Fixes

  • Fix a bug in which the version of SwiftGen was reported as v0.0 by swiftgen --version.
    Olivier Halligon

Internal Changes

4.2.0

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 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.

4.1.0

New Features

  • Added a script reference to simplify and automate localization of existing non localized project.
    HuguesBR
  • Added a storyboards-osx-swift3 template.
    Felix Lisczyk #225
  • Added a strings-no-comments-swift3 template that does not include the default translation of each key.
    Loïs Di Qual #222
  • Images: new dot-syntax template, use dot-syntax-swift3 or dot-syntax (for Swift 2.3).
    David Jennes #206
  • Reworked the "dot-syntax" and "structured" templates to use the new macro and call tags, which greatly simplifies the templates, and also removes the limitation of 5-level deep structures.
    David Jennes #237
  • Storyboards: automatically detect the correct modules that need to be imported. The --import option has therefore been deprecated, as well as the extraImports template variable. Instead use the the new modules variable, which offers the same functionality.
    David Jennes #243
  • Support multiple input paths for some commands.
    David Jennes #213
    • fonts accepts multiple input directories, all found fonts will be added to the families template variable.
    • images now supports multiple asset catalogs as input. Templates can now use the catalogs variable to access each individual catalog.
    • storyboards accepts multiple paths (to folders or storyboard files). All found storyboards will be available in the storyboards template variable.

Bug Fixes

  • Strings: fix issue with dot-syntax-swift3 where function definitions were not Swift 3 guidelines compliant.
    David Jennes #241 #247
  • Snake cased keys with uppercase letters are correctly camel cased again.
    Cihat Gündüz #226 #233

Internal changes

4.0.1

Bug Fixes

Internal changes

4.0.0

Breaking Changes

  • Change swift 3 storyboard segue template's sender from AnyObject to Any.
    Derek Ostrander #197
  • Fix swift 3 storyboard templates to be compliant with swift 3 api design guidelines.
    Afonso #194
  • Remove the key param label from the tr function for Localized String in the Swift 3 template.
    AndrewSB #190
  • The swiftgen images command now uses the actool utility to parse asset catalogs, ensuring that the parser correctly handles namespaced folders.
     ⚠️ Note that you now have to specify the exact path to your .xcassets assets catalogs  when using swiftgen images (and not just a directory to parse).
    David Jennes #199

New Features

  • Add support for multiline strings in *.strings file.
    Jeong Yonguk #192
  • Add option to add import statements at the top of the generated swift file (for storyboards) using the import flag.
    David Jennes #175
  • Escape reserved swift keywords in the structured and dot-syntax generated strings code.
    Afonso #198

3.0.1

3.0.0

  • Add template that calls NSLocalizedString() separately for each string, which is useful when trying to extract strings in the app to a .strings file.
    Ahmet Karalar
  • Add some file_length and similar SwiftLint exceptions in bundled templates, as files generated by SwiftGen might contain lots of constants and can be long by design.
    Olivier Halligon
  • Error messages ("template not found", etc) are now printed on stderr.
    Olivier Halligon
  • Add more swiftgen templates subcommands.
    Olivier Halligon
    • swiftgen templates list lists all the available templates
    • swiftgen templates which <name> prints the path to the template named <name>
    • swiftgen templates cat <name> prints the content to the template named <name>
    • <name> here can be either a parser name like colors or a composed name colors-rawValue for a specific template.
  • Fix swift 3 renaming change in strings-swift3.stencil.
    Kilian Koeltzsch #150
  • Fix non-custom class, non-base view controller handling in storyboards-swift3.stencil.
    Syo Ikeda #152
  • Add strongly typed initialViewController() overrides for storyboard templates if available.
    Syo Ikeda #153 #163
  • Add support for font files containing multiple descriptors.
    Chris Ellsworth #156
  • Update deprecated usage of generics for Swift 3 / Xcode 8 beta 6.
    Chris Ellsworth #158
  • Fix case when missing positional parameters, which leads to parameters in the enum with unspecified type (undeterminable from the Localizable.strings format analysis) where reported as Any — which is not a CVarArgType. Now using UnsafePointer<()> arguments instead for such odd edge-cases that should never happen anyway.
    Olivier Halligon
  • Now reports an error when it failed to parse a color in a color input file.
    Olivier Halligon #162
  • New Strings template (available via -t dot-syntax), allowing string keys containing dots (like foo.bar.baz) to be organized as a hierarchy and accessible via dot syntax.
    Cihat Gündüz #159
  • Update Swift 3 templates to use lowercase enums.
    Olivier Halligon #166
  • New Strings template (available via -t dot-syntax-swift3), allowing keys with dots in Swift 3 (see above).
    Cihat Gündüz #168

💡 You can now create your custom templates more easier than ever, by cloning an existing template!

e.g. to clone the default strings-default.stencil template:

  • use swiftgen templates cat strings --output strings-custom.stencil
  • modify the cloned strings-custom.stencil template to your liking
  • use it with swiftgen strings … --templatePath strings-custom.stencil … in your projects!

Important Notes

  • Some keys for various templates have changed to provide more flexibility and enable some new features in the templates. As a result, if you created your own custom templates, they might not all be totally compatible with SwiftGen 3.0.0 (hence the new major version). Please read the Custom Templates documentation to find out the new Stencil context keys and update your custom templates accordingly.

If you're using one of the bundled templates, all of them have been updated appropriately.

  • Also if you use Swift 3, and thus use the -t swift3 flag to use the Swift 3 templates, be advised those has been modified to take the latest Swift 3 modifications into account (including naming convensions) so your code might need to be updated according to match the latest Swift 3 recommendations.

2.0.0

Note: The Stencil context keys (the name of the variables used in templates) for storyboard has changed a bit. Especially, class has been renamed into customClass (see #131) to better describe the intent (as this isn't defined if there is no custom class set in the Storyboard), and new keys isBaseViewController and baseType has been added.

This means that if you did implement your own custom templates for storyboards (instead of using the bundled ones), you'll have to remplace {{class}} by {{customClass}} in those storyboard templates, otherwise they'll probably stop working as expected. That's the main reason why the version has been bumped to a major version 2.0.0.

1.1.2

  • Fix issue introduced by 1.1.1 in storyboard templates not returning.
    Ben Chatelain #138

1.1.1

1.1.0

1.0.0

  • Restructured colors & fonts templates to workaround the same LLVM issue as #112 with nested types inside existing UIKit classes in Release/Optimized builds.
    Olivier Halligon
  • Added support for Fonts using the swiftgen fonts command.
    Derek Ostrander #102
  • Added support for TXT (colors.txt) files to have named value.
    Derek Ostrander #118
  • Restructured image templates to work around an LLVM issue with nested types.
    Ken Grigsby #112
  • Added Swift 3 templates for storyboards and strings.
    Andrew Breckenridge #117

0.8.0

  • Introducing alternative way to install SwiftGen: using CocoaPods! See README for more details.
    Olivier Halligon #95
  • Added support for JSON (colors.json) files as input for the swiftgen colors subcommand.
    Derek Ostrander
  • Use String(format:locale:arguments:) and the NSLocale.currentLocale() in the "string" templates so that it works with .stringdict files and pluralization.
    Olivier Halligon #91
  • Add support for Android colors.xml files as input for the swiftgen colors subcommand.
    Olivier Halligon #15
  • Removed the useless import Foundation from the "images" templates.
    Olivier Halligon
  • Added computed property var color: UIColor to the color templates.
    Olivier Halligon

0.7.6

Enhancements

  • Fixed build loop by changing SwiftGen to only write to the output file if the generated code is different from the file contents.
    Mathias Nagler #90

Fixes

  • Fixed typos in code and descriptions: instanciate -> instantiate. Please note that the default template used for storyboards storyboards-default.stencil had to be modified, so make sure to update your codebase accordingly.
    Pan Kolega #83
  • Fixed issue in Rakefile when trying to install via rake in a path containing ~.
    Jesse Armand #88

0.7.5

Enhancements

  • Updated stencils and unit tests to pass SwiftLint.
    Adam Gask #79
  • Updated storyboards-default.stencil to better avoid name confusions.
    Olivier Halligon
    • Now cases names are suffixed with …Scene and static func are prefixed with instantiate… to lower the risks of a name conflict with your ViewController classes.
    • The old template is still available but has been renamed storyboards-uppercase.stencil
  • Added support for *.clr files (files to store NSColorList's presented in Color Picker on "Color Palettes" tab).
    Ilya Puchka #81

0.7.4

Enhancements

0.7.3

Fixes

  • Restructured storyboard templates to work around an LLVM issue with nested types.
    Ryan Booker #57

Scenes and Segues are now referenced via StoryboardScene.<Storyboard> and StoryboardSegue.<Storyboard>.<Segue>

0.7.2

Enhancements

  • Adding comments to generated color enums which allow you to see the color in the QuickHelp documentation.

  • The default translation of strings are now added as documentation comments to the enum cases.
    You can add translations to your own templates by using the string.translation variable.
    @MrAlek #58 #60

Fixes

  • Fix an issue with the colors template due to an Apple Bug when building in Release and with WMO enabled.
    #56

0.7.1

Fixes

  • Fix issue with swiftgen strings that were using the colors templates instead of the strings template by default.
    @ChristopherRogers #54

0.7.0

Enhancements

  • Allow using custom templates by name.
    #42 #50
    • Now the -t flag expect a template name (defaults to default), and will search a matching template in Application Support first, then in the templates bundled with SwiftGen.
    • You can still specify a template by path using -p.
    • For more info, see this dedicated documentation.
  • You can now list all templates available (both bundled templates and custom ones) using the swiftgen templates command.
    #42 #50
  • Add a performSegue(_:sender:) extension on UIViewController to accept a StoryboardSegue as parameter.
    You can now for example call vc.performSegue(UIStoryboard.Segue.Wizard.ShowPassword).
    #37

SwiftGen now comes bundled with some alternate templates, especially colors-rawValue, images-allvalues and storyboards-lowercase, in addition to the default templates.

Fixes

  • Now swiftgen storyboards doesn't generate duplicate enum cases for identical segues (those having equal identifiers and shared custom class).
    @filwag #43
  • Fix compilation issue for storyboards without any scene.
    Viacheslav Karamov #47
  • Propose an alternate template using lowercase names, especially for when storyboard identifiers match view controller class names.
    Viacheslav Karamov #48
  • Introduced an image-allvalues template that exposes the list of all images in a static let allValues array.
    Ahmed Mseddi & Guillaume Lagorce #44
  • Fix issue with Storyboards without any StoryboardID (all scenes being anonymous) not extending StoryboardScene.
    #36

0.6.0

New Features: Templates

  • SwiftGen now uses Stencil template engine to produce the generated code.
  • This means that the generate code will be easier to improve.
  • This also means that you can use your own templates to generate code that better suits your needs and preferences, using swiftgen … --template FILE ….

Fixes

  • The correct type of ViewController (UIViewController, UINavigationController, UITableViewController, …) is now correctly generated even if not a custom subclass.
    #40
  • Fix issue with .strings files encoded in UTF8.
    #21

0.5.2

New Features

  • It's now possible to specify which chars should not be used when generating case identifiers.
    @Igor-Palaguta #34

0.5.1

Fixes

  • Installing via rake install or brew install will now copy the Swift dylibs too, so that swiftgen installation won't depend on the location of your Xcode.app (so it'll work on every machine even if you rename your Xcode).
  • Fixed links in Playground and Licence headers in source code.

0.5.0

New Features

  • Migrating to Commander to parse the CLI arguments.
    23 #30
  • swiftgen is now a single binary, and the subcommand names have changed to be more consistent.
    #30
  • New --output option.
    #30

You must now use the subcommands swiftgen images, swiftgen strings, swiftgen storyboards and swiftgen colors. See swiftgen --help for more usage info.

Fixes

0.4.4

  • Updated Unit tests for latest Swift 2.0 & tested against Xcode 7.1
  • Fix small typos in code
  • Guard against empty enums

0.4.3

0.4.2

  • Added import Foundation on top of swiftgen-l10n generated code.
    @Nick11 #12

0.4.1

  • Updated for Xcode 7 Beta 5
  • swiftgen-storyboard now allows to take a path to a .storyboard file as argument (as an alternative to give a path to a whole directory)
  • The -v and --version flags are now recognized and print the executable version.

0.4.0

  • Reorganized files into an Xcode project with one target per executable.
    #2
  • Added Unit Tests (one per executable + one for common code).
    #2
  • Improved SwiftGen-L10n parsing of format strings and placeholders.
    #4 #5 #6
  • Updated Rakefile so that it now invokes xcodebuild install. You can now easily build & install all swiftgen-xxx executables in /usr/local/bin or anywhere else.
  • Added a version string (date + sha1) to the built executables (displayed when invoked with no argument)

0.3.0

  • Reducted the default code generated by SwiftGenColorEnumBuilder to avoid clobbering the UIColor namespace
  • Changed the "namespacing enum" in UIStoryboard to a struct to avoid confusion with the inner enums
  • The UIStoryboard.Scene enums now use static func instead of static var for the dedicated ViewController constructors ^(†)

^(†) because it feels more explicit that calling a function like UIStoryboard.Scene.Wizard.validatePasswordViewController() will actually instantiate a new ViewController, rather than returning an existing one.

0.2.0

  • Added Segues enums to UIStoryboard to be able to access their identifiers easily.
    @esttorhe #8
  • Added this very CHANGELOG.md

0.1.0

Considered to be the first cleaned-up version, far from finished but really usable with clean code.

  • Cleaner README
  • Namespace the generated enums in an outer enum to avoid clobbering the UIStoryboard namespace

0.0.4

  • Introducing SwiftGenColorEnumBuilder
  • swiftgen-colors CLI
  • Added ability to choose indentation

0.0.3

  • Introducing SwiftGenL10nEnumBuilder
  • swiftgen-l10n CLI
  • Started playing with UIColor enums in the playground

0.0.2

  • Introducing SwiftGenStoryboardEnumBuilder class
  • swiftgen-storyboard CLI

0.0.1

Initial version:

  • Mostly testing stuff in a playground
  • Introducing SwiftGenAssetsEnumBuilder class
  • swiftgen-assets CLI