Skip to content

Latest commit

 

History

History
864 lines (667 loc) · 42.3 KB

CHANGELOG.md

File metadata and controls

864 lines (667 loc) · 42.3 KB

SwiftGen CHANGELOG


Master

Bug Fixes

Breaking Changes

None

New Features

  • Add ability to list all custom fonts and register them using FontFamily.registerAllCustomFonts.
    Olivier Halligon #394

Internal Changes

None

5.3.0

Changes in other SwiftGen modules

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 other SwiftGen modules

New Features

Bug Fixes

5.1.2

Internal Changes

5.1.1

Changes in other SwiftGen modules

Bug Fixes

5.1.0

Changes in other SwiftGen modules

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 other SwiftGen modules

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 subcommand 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 subcommand, 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 other SwiftGen modules

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 other SwiftGen modules

Bug Fixes

Notable bug fixes from other SwiftGen repositories

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 in the Wiki for a list of deprcations and their replacements.

Internal changes

  • SwiftGen has migrated to its own GitHub organization 🎉.
  • SwiftGen has been split in multiple repositories and separate modules.
    @AliSoftware @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

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

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.

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

colors QuickHelp

  • 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