- Strings: correctly handle translations containing
\t
(tabs) and other escape sequences.
David Jennes #985 #986 #988 #998 - Strings: fix the Objective-C template.
David Jennes #990 #991
- Strings: greatly improve the performance of the new comments parser.
David Jennes #987 #989
- CLI: fixed
run parser
when noparams
oroptions
are provided (broken in 6.6.0).
David Jennes #983 - JSON/Plist/YAML: fixed code generation (broken in 6.6.0).
David Jennes #983
- Strings: due to the bugfix for fallback translations, custom
lookupFunction
s will need to accept 3 arguments (table, key and value), up from 2 arguments (table and key).
David Jennes #964
- 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
- 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
- CoreData: ensure fetched properties use the right class name.
David Jennes #936 #960 - CoreData: now correctly generate code for
OptionSet
attributes by setting the "User Info" keynonOptionalInit
to true.
David Jennes #727 #965 - Fonts: fix file-type check in sandboxed environments.
David Jennes #952 #967 - Fixed Stencil tags that can refer to other templates, such as the
include
tag.
David Jennes #950 #959 - Strings: now correctly provides the default translation as fallback.
David Jennes #381 #937 #964
- Updated GitHub Actions to use macOS 12.
David Jennes #956 - Update dependencies such as SwiftLint (and enable some extra rules).
David Jennes #968 #970 - Implement automatic publication using GitHub Actions.
David Jennes #969 - Switched from Commander to Swift's own ArgumentParser library.
David Jennes #966 - Updated to Stencil 0.15 and StencilSwiftKit 2.10.
David Jennes #977 - Added
Difference
library for easier testing of context differences.
David Jennes #981
- Workaround for Mint that does not yet support the SPM resource bundle.
@tid-kijyun #883 #885
- Tweak release script to handle both universal & slim builds.
David Jennes #884
- XCAssets: the parser now supports Symbol sets, so you can safely use custom symbols.
David Jennes #788 - XCAssets: you can now provide a trait collection when initializing a color or image asset (on iOS/tvOS).
David Jennes #790 - Files: Add new parser for accessing loose files in your project.
Mike Gray David Jennes #665 #734 - Colors: The XML parser now supports Android color aliases (using
@color/...
).
David Jennes #562 #797 - Support M1 and Intel devices (universal binary).
David Jennes #805 #880
- 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 inputsxcfilelist
(for custom templates).
Craig Siemens #815 - Strings: built-in templates now have better handling of multi-line translations.
@mrackwitz #774
- Switch to GitHub Actions.
#794 David Jennes - Switched the whole project over to use Swift Package Manager, restructuring some of the internals in the process.
David Jennes #793 - Updated dependencies and gems, particularyly PathKit to support Xcode 13.
David Jennes Jared Sorge #827 #874 #879
- 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 usedBundle
using thebundle
orlookupFunction
template parameters.
Arnaud Dorgans #763 - Added
config generate-xcfilelist
subcommand to generate input and outputxcfilelist
s based on your configuration file. These files should then be used in an Xcode build step that executesswiftgen 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 isrgba
.
@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
- Plist: Update the parsing strategy (using
Codable
) to fix parsing ofBool
values asInteger
in some cases.
@fortmarek Olivier Halligon #779 - JSON/Plist/YAML: fixed issue with
inline
templates which incorrectly generated1
/0
as values, instead oftrue
/false
as expected.
David Jennes #779 #783 - JSON: the parser now correctly recognizes
0
and1
asInt
(instead ofBool
).
David Jennes #786
- Update the Swift version in
.swift-version
so that the right version is used when building manually (usingswiftenv
).
@cfiken #764 - Update Yams from
3.0.0
to4.0.0
.
@hungrxyz #772 - Updated Pods and Gems dependencies, and Xcode 12.
David Jennes #782
- Fonts: the generated
Font
typealias (toUIFont
/NSFont
) is deprecated and will be removed in the next major release.
David Jennes #728
- 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 thestruct
representing a font to something else.
David Jennes #728 - Fonts: the templates now support a new
fontAliasName
that you can use to change thetypealias
's name fromFont
to something else. For example: this is useful when working with SwiftUI which already defines aFont
type. Note that as thistypealias
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 addsmakeFetchRequest()
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 themain
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 alookupFunction
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
- Strings: fix incorrect interpretation of format placeholders when there were missing positional parameters (e.g.
"%2$@"
without a%1$…
defined).
Olivier Halligon #634
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.
- JSON & Plist: if you wrote your own templates, know that the
documents
property of a file has been deprecated in favour ofdocument
. The olddocuments
property will be removed in the next major release.
David Jennes #702 #732
- Prevent generating
default.profraw
(code coverage) files.
David Jennes #722 - JSON/Plist/YAML: Fix issue with homogeneous
Array
s 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
- 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 ofYams
for parsing JSONs, making thejson
parser faster.
Marcelo Fabri #698 - JSON/Plist/YAML: Lazily evaluate
metadata
of documents, making SwiftGen faster if themetadata
field is never used in a template.
Marcelo Fabri #700
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.
- 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
- XCAssets: the
colorAliasName
andimageAliasName
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 ofswiftgen run <parser>
. See "New Features" below.
Olivier Halligon #705 - The subcommand
swiftgen templates
has been renamedswiftgen 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. UsetemplatePath
to reference custom templates by path instead.
Olivier Halligon #717
- 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 useswiftgen 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 asenum
,OptionSet
, …). They'll check the "User Info" of an attribute for aRawType
key, which should be set to the type name you want to use for that attribute. To avoid optional attributes, you can also add theunwrapOptional
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
- 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 aclass var
instead of aclass func
.
David Jennes #590 - Strings: we now correctly generate the type
Any
(instead ofString
) 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
- The main branch of the repository has been renamed from
master
tostable
. If you pointed yourPodfile
or dependency managment tool tomaster
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
- Adds support for generating code from Core Data models.
Grant Butler David Jennes Igor Palaguta #455 #567 #575 #581 #45 #185 #191 #195 - Config: expand environment variables in YAML files.
Wolfgang Lutz #355 #564 - Each parser now accepts a
filter
option, which accepts a regular expression for filtering input paths. The filter is applied to individual paths as well as when the parser recurses into directories.
David Jennes #383 #570
- Colors: Fix an issue where the
public
access modifier was not being added correctly in theliterals-swift3
andliterals-swift4
templates when thepublicAccess
parameter was specified. Also remove some uneccessarypublic
access modifiers from theswift3
andswift4
templates.
Isaac Halvorson #549
- 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
- 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
- IB: Fix missing
import AppKit
/import UIKit
in some rare cases.
David Jennes #515 #519 - IB: Fix issue with segues-swift4 template when compiled with Swift 4.2 on macOS.
Olivier Halligon #515 #518 - SPM/Mint: Update the Stencil version to 0.13.1.
David Jennes #527 - Ensure the
templates
subcommand properly works with the deprecatedstoryboards
subcommand.
David Jennes #525 #530 - Ensure configuration file errors show as red in Xcode.
Olivier Halligon #516 #533 - Strings: Ensure the parser correctly handles keys ending with a
.
and empty key components.
David Jennes #528 #531
- Integrated Danger to help on contributions by giving automatic feedback.
Olivier Halligon #520 #524
Read the SwiftGen 6.0 Migration Guide for a list of changes you'll need to apply.
- 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 toib
, to better reflect it's purpose. An alias forstoryboards
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 oldnoAllValues
flag (with an inverse behaviour).
David Jennes #480 - XCAssets: Dropped the deprecated
allValues
constant, use the type specific constants such asallColors
,allDataItems
andallImages
. The default value ofimageAlias
has also been changed fromImage
toAssetImageTypeAlias
, 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
- 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 theoutput
parameter is now deprecated, in favour of theoutputs
parameter, and it may be removed in a future version of SwiftGen. Similarly, thepaths
parameter has been renamed toinputs
for consistency. You can always useswiftgen 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
andswiftgen 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
andyaml
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
- Fix memory leak in generated code for Fonts.
Olivier Halligon #394 - Interface Builder: ensure the templates handle
GLKViewController
,AVPlayerViewController
andNSPageController
correctly.
David Jennes #404 #414 - Interface Builder: ensure the parser can handle files with and without "trait variations".
David Jennes #367 #429 - Restrict
SceneType
andInitialSceneType
to UIViewController when not targeting AppKit. When targeting AppKit, remove superfluousAny
.
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
- Migrated to CircleCI 2.0.
David Jennes #403 - Switched to using SwiftLint via CocoaPods instead of our own install scripts.
David Jennes #401 - Enabled some extra SwiftLint rules for better code consistency.
David Jennes #402 #476 - Updated to latest Xcode (10.0.0) and Swift 4.2.
David Jennes #415 #498 - Update to Stencil 0.13.0, and use some of it's new filters in our templates.
David Jennes #416 #475 #498 - Store testing contexts as YAML files instead of PLISTs.
David Jennes #418 #461 - Refactor the parsers as they're getting more complex.
David Jennes #417 #422 - Disabled a SwiftLint rule for function parameter count.
Oleg Gorbatchev #428 - Fix missing link in the README.
Takeshi Fujiki #459
- XCAssets: exposed getter for image name string.
Abbey Jackson SwiftGen/templates#85 - XCAssets: exposed getter for color name string.
Stephan Diederich SwiftGen/templates#87 - Allows to set all properties as
public
by using--param publicAccess
on all templates.
Olivier Halligon SwiftGen/templates#84 Txai Wieser SwiftGen/templates#81
- Merged the
SwiftGenKit
andtemplates
repositories back into this repository for easier development and maintenance.
David Jennes #356
- 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 defaultconfig run
subcommand).
Olivier Halligon #349
- You can now use a
swiftgen.yml
file to configure SwiftGen! 🎉
Read more about it in the dedicated documentation.
Olivier Halligon #337 - Storyboards: Added a new
ignoreTargetModule
parameter if you're using storyboards in multiple targets, to avoid issues with the generated code.
Julien Quéré SwiftGen/templates#36
- Fixes an issue in High Sierra where the output of the processed Catalog Entries was not ordered alphabetically.
Yusuke Kuroiwa Francisco Diaz SwiftGen/SwiftGenKit#57 - Fonts: fix code which checks if a font is already registered.
Vladimir Burdukov SwiftGen/templates#77 - SwiftLint rules: Disabled the
superfluous_disable_command
rule for allswiftlint:disable
exceptions in all templates.
Olivier Halligon SwiftGen/SwiftGen#334 SwiftGen/templates#83 - When installing SwiftGen via CocoaPods, the unneeded
file.zip
is not kept inPods/SwiftGen/
anymore (freeing ~5MB on each install of SwiftGen made via CocoaPods!).
Olivier Halligon #342
- Allows the SwiftGen source code to be built with Xcode 9.
This also has the nice side-effect of making the homebrew installation of SwiftGen also available for macOS 10.13.
Olivier Halligon David Jennes #330 SwiftGen/Eve#10
- XCAssets: fixed some compatibility issues with the swift 3 template on Xcode 8, and with other templates.
David Jennes SwiftGen/templates#76
- Added Swift 4 templates. Use
-t swift4
or whatever variant you want to use (seeswiftgen 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
#colorLiteral
s.
Useswiftgen colors -t literals-swift3
/swiftgen colors -t literals-swift4
to use them.
David Jennes SwiftGen/templates/#72
Read the SwiftGen 5.0 Migration Guide for a list of changes you'll need to apply.
- 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 toxcassets
to better reflect its functionality.
Olivier Halligon #317
- Many deprecated templates have been removed (or merged), and others have been renamed to reflect new behaviours. Please check the templates migration guide for more information.
David Jennes SwiftGen/templates#47 - There have been some breaking changes in the generated code for storyboards. Please check the templates migration guide for more information, where we also provide a compatibility template.
Olivier Halligon SwiftGen/templates#65 - Removed deprecated template context variables, and restructured many others. Please check the SwiftGenKit migration guide for more information.
David Jennes SwiftGen/SwiftGenKit#5 - Some filters have been removed in favour of Stencil's built in versions, and other filters have been updated to accept parameters. Please consult the StencilSwiftKit migration guide for more information.
David Jennes SwiftGen/StencilSwiftKit#5 SwiftGen/StencilSwiftKit#6
- Colors and strings commands now accept multiple input files. With these 2 additions, all swiftgen generator commands are able to handle multiple input files.
David Jennes #313 SwiftGen/SwiftGenKit#40 SwiftGen/SwiftGenKit#41
- Improved installation instructions in the README.
Olivier Halligon #303
- 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
- Fix a bug in which the version of SwiftGen was reported as
v0.0
byswiftgen --version
.
Olivier Halligon
- Update StencilGenKit to 1.0.2 and update Circle CI to Xcode 8.3.
Diogo Tridapalli #295 - Switch from Travis CI to Circle CI, clean up the Rakefile in the process.
David Jennes Olivier Halligon #269 - Fix remaining enum names not Swift 3 compliant.
Liquidsoul #297 - Added the
CONTRIBUTING.md
file to help new contributors.
Olivier Halligon Cihat Gündüz #149 #298
- 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}}
.
- This command-line option can be repeated at will and used to pass structured custom parameters (e.g.
- 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}}
.
- 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.
- Use an explicit bundle parameter to support frameworks for all templates.
@NachoSoto @djbe #255 SwiftGen/templates#17
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.
- Storyboards templates won't
import
your app module anymore, removing that annoying warning.
@djbe SwiftGen/templates#19
- 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.
- 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
ordot-syntax
(for Swift 2.3).
David Jennes #206 - Reworked the "dot-syntax" and "structured" templates to use the new
macro
andcall
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 theextraImports
template variable. Instead use the the newmodules
variable, which offers the same functionality.
David Jennes #243 - Support multiple input paths for some commands.
David Jennes #213fonts
accepts multiple input directories, all found fonts will be added to thefamilies
template variable.images
now supports multiple asset catalogs as input. Templates can now use thecatalogs
variable to access each individual catalog.storyboards
accepts multiple paths (to folders orstoryboard
files). All found storyboards will be available in thestoryboards
template variable.
- 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
- Better error handling in the
colors
command.
David Jennes #227 - Stencil: added two new tags
macro
andcall
, see the documentation. for in depth explanations on how to use them.
David Jennes #237 - SwiftLint: Remove
switch_case_on_newline
warning for generated color file.
Mickael Titeca #239 - Stencil: better string filter testing and fixed a small issue with
lowerFirstWord
.
David Jennes #245
- Escape newlines again in .strings file keys.
ChristopherRogers #208 - Fix broken
import
option added in 4.0.0.
David Jennes #214 - Show an error when the provided path to the
images
command is not an asset catalog.
David Jennes #217 - Strings dot-syntax template: use
enum
s for namespacing instead ofstruct
s.
David Jennes #218
- Swift 3 migration.
ahtierney #201 - Restructure the SwiftGen project to build as an
.app
during developement, for easier debugging in Xcode.
ahtierney #204 - Consolidate the use of PathKit internally.
David Jennes #212 - Updated Stencil to 0.7.2.
Kyle Fuller #216
- Change swift 3 storyboard segue template's sender from
AnyObject
toAny
.
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 thetr
function for Localized String in the Swift 3 template.
AndrewSB #190 - The
swiftgen images
command now uses theactool
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 usingswiftgen images
(and not just a directory to parse).
David Jennes #199
- 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
- Add support for Xcode 8 and Swift 2.3.
(Should still compile in Xcode 7.3 but theRakefile
to build, install and release requires Xcode 8).
Valentin Knabel Ignacio Romero Zurbuchen HanxuanZhou Syo Ikeda
- 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 Halligonswiftgen templates list
lists all the available templatesswiftgen 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 likecolors
or a composed namecolors-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 asAny
— which is not aCVarArgType
. Now usingUnsafePointer<()>
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!
- 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.
- Fix issue with txt files bailing on comments.
Derek Ostrander #140 - Added support for tvOS and watchOS in images, fonts and color templates.
Tom Baranes #145 - Added enum-based structured identifiers via
-t structured
option.
Cihat Gündüz #148 - Added support for OSX in storyboards.
Tom Baranes #131
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.
- Fix issue introduced by 1.1.1 in storyboard templates not returning.
Ben Chatelain #138
- Removed the last force-unwrap from storyboard templates.
Olivier Halligon
- Added step to ensure all templates are Swiftlint'ed
and don't violate any code style rule.
Olivier Halligon AJ9 #80 - Added support for OSX in images, fonts and color templates.
Tom Baranes #125 #126 #127 - Added missing FontConvertible protocol conformance to default fonts template.
Ben Chatelain #129
- 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
- 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 theswiftgen colors
subcommand.
Derek Ostrander - Use
String(format:locale:arguments:)
and theNSLocale.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 theswiftgen 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
- 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
- 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 viarake
in a path containing~
.
Jesse Armand #88
- 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
andstatic func
are prefixed withinstantiate…
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
- Now
- Added support for
*.clr
files (files to storeNSColorList
's presented in Color Picker on "Color Palettes" tab).
Ilya Puchka #81
- Added View Controller Placeholders support.
Viacheslav Karamov #61
- Restructured storyboard templates to work around an LLVM issue with nested types.
Ryan Booker #57
Scenes and Segues are now referenced via
StoryboardScene.<Storyboard>
andStoryboardSegue.<Storyboard>.<Segue>
-
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 thestring.translation
variable.
@MrAlek #58 #60
- Fix an issue with the colors template due to an Apple Bug when building in Release and with WMO enabled.
#56
- Fix issue with
swiftgen strings
that were using the colors templates instead of the strings template by default.
@ChristopherRogers #54
- Allow using custom templates by name.
#42 #50- Now the
-t
flag expect a template name (defaults todefault
), and will search a matching template inApplication 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.
- Now the
- 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 onUIViewController
to accept aStoryboardSegue
as parameter.
You can now for example callvc.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.
- 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 astatic let allValues
array.
Ahmed Mseddi & Guillaume Lagorce #44 - Fix issue with Storyboards without any StoryboardID (all scenes being anonymous) not extending
StoryboardScene
.
#36
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 …
.
- 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
- It's now possible to specify which chars should not be used when generating
case
identifiers.
@Igor-Palaguta #34
- Installing via
rake install
orbrew install
will now copy the Swift dylibs too, so thatswiftgen
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.
- 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
andswiftgen colors
. Seeswiftgen --help
for more usage info.
- Fix color parsing with absent alpha.
@Igor-Palaguta #28
- Updated Unit tests for latest Swift 2.0 & tested against Xcode 7.1
- Fix small typos in code
- Guard against empty
enums
- 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.
- 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 invokesxcodebuild install
. You can now easily build & install allswiftgen-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)
- Reducted the default code generated by
SwiftGenColorEnumBuilder
to avoid clobbering theUIColor
namespace - Changed the "namespacing
enum
" inUIStoryboard
to astruct
to avoid confusion with the inner enums - The
UIStoryboard.Scene
enums now usestatic func
instead ofstatic var
for the dedicatedViewController
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.
- Added
Segues
enums toUIStoryboard
to be able to access their identifiers easily.
@esttorhe #8 - Added this very
CHANGELOG.md
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 outerenum
to avoid clobbering theUIStoryboard
namespace
- Introducing
SwiftGenColorEnumBuilder
swiftgen-colors
CLI- Added ability to choose indentation
- Introducing
SwiftGenL10nEnumBuilder
swiftgen-l10n
CLI- Started playing with
UIColor
enums in the playground
- Introducing
SwiftGenStoryboardEnumBuilder
class swiftgen-storyboard
CLI
Initial version:
- Mostly testing stuff in a playground
- Introducing
SwiftGenAssetsEnumBuilder
class swiftgen-assets
CLI