None
- Removed deprecated CLI options. Should you still use them, SwiftGen will return an error and show the new recommended CLI option to use instead. David Jennes #301
None
None
• 🔗 SwiftGenKit 1.1.0 • 🔗 StencilSwiftKit 1.0.2 • 🔗 Stencil 0.9.0 • 🔗 templates 1.1.0
- 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 #291 - 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
• 🔗 SwiftGenKit 1.0.1 • 🔗 StencilSwiftKit 1.0.0 • 🔗 Stencil 0.8.0 • 🔗 templates 1.0.0
ℹ️ Don't forget to look at the CHANGELOGs of the other repositories too (links above) in addition to this one, to see all the changes across all of SwiftGen.
- Storyboards templates won't
import
your app module anymore, removing that annoying warning.
@djbe SwiftGen/templates/#19
- 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 in the Wiki for a list of deprcations and their replacements.
- 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.
- 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
- 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.
- 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 subcommand 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