The Swift code generator for your assets, storyboards, Localizable.strings, … — Get rid of all String-based APIs!
None
--quiet
and --verbose
flags to swiftgen run
.rake cli:install
command and with it the Homebrew formula.None
\t
(tabs) and other escape sequences.run parser
when no params
or options
are provided (broken in 6.6.0).lookupFunction
s will need to accept 3 arguments (table, key and value), up from 2 arguments (table and key).--experimental-modern-spacing
flag.--quiet/-q
flag, to suppress all logs (except errors).final
when model isn't abstract..artifactbundle
release uploads to support SE-0325 Swift Plugins..strings
files comments. The built-in templates will now use them for comments instead of the translation of a key.--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.OptionSet
attributes by setting the "User Info" key nonOptionalInit
to true.include
tag.Difference
library for easier testing of context differences.@color/...
).objc-h
template now emits valid documentation comments.xcfilelist
: Adds the template file path to the inputs xcfilelist
(for custom templates).Bundle.module
if it's available. As before, you can override the used Bundle
using the bundle
or lookupFunction
template parameters.config generate-xcfilelist
subcommand to generate input and output xcfilelist
s 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.colorFormat
option, used to change the color format. The default format is rgba
.creator
block, commonly used for dependency injection. This feature is available in generated code starting from iOS 13, tvOS 13 and macOS 10.15.Codable
) to fix parsing of Bool
values as Integer
in some cases.inline
templates which incorrectly generated 1
/0
as values, instead of true
/false
as expected.0
and 1
as Int
(instead of Bool
).Font
typealias (to UIFont
/NSFont
) is deprecated and will be removed in the next major release..stringsdict
files.fontTypeName
template parameter that you can use to change the name of the struct
representing a font to something else.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.fetchRequest()
and adds makeFetchRequest()
to avoid ambiguous function usage.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.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.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."%2$@"
without a %1$…
defined).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.
documents
property of a file has been deprecated in favour of document
. The old documents
property will be removed in the next major release.default.profraw
(code coverage) files.Array
s in the Inline templates (such as [String
]).JSONSerialization
instead of Yams
for parsing JSONs, making the json
parser faster.metadata
of documents, making SwiftGen faster if the metadata
field is never used in a template.⚠️ 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.
colorAliasName
and imageAliasName
template parameters are now deprecated and will be removed in the next major release.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.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.~/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.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.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).swiftgen template doc [parser] [templateName]
on the command line to quickly open the documentation for templates on GitHub directly from your terminal.options
dictionary, with which you can set internal parser settings to change its behaviour. See the parser's specific documentation for available options.separator
option, used to split keys into structured components. The default separator remains .
. For more information, check the parser's documentation.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.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.lookupFunction
for customizing the localization function, check the template documentation for more information.enum <FileName>
) in generated code even if there's only one single input file.entityName
is now correctly a class var
instead of a class func
.Any
(instead of String
) for %@
placeholders.,
(comma) for fetch requests with multiple arguments.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.