STRUCT
ResourceSynthesizer
Contents
- Properties
templateType
parser
parserOptions
extensions
- Methods
strings(parserOptions:)
strings(plugin:parserOptions:)
assets(parserOptions:)
assets(plugin:parserOptions:)
fonts(parserOptions:)
fonts(plugin:parserOptions:)
plists(parserOptions:)
plists(plugin:parserOptions:)
coreData(plugin:parserOptions:)
coreData(parserOptions:)
interfaceBuilder(plugin:parserOptions:)
interfaceBuilder(parserOptions:)
json(plugin:parserOptions:)
json(parserOptions:)
yaml(plugin:parserOptions:)
yaml(parserOptions:)
files(plugin:parserOptions:extensions:)
files(parserOptions:extensions:)
custom(plugin:parser:parserOptions:extensions:resourceName:)
custom(name:parser:parserOptions:extensions:)
public struct ResourceSynthesizer: Codable, Equatable, Sendable
A resource synthesizer for given file extensions.
For example to synthesize resource accessors for strings, you can use:
.strings()
for tuist's default.strings(parserOptions: ["separator": "/"])
to use strings template with SwiftGen Parser Options.strings(plugin: "MyPlugin")
to use strings template from a plugin.strings(templatePath: "Templates/Strings.stencil")
to use strings template at a given path
Properties
templateType
public var templateType: TemplateType
Templates can be of multiple types
parser
public var parser: Parser
parserOptions
public var parserOptions: [String: Parser.Option]
extensions
public var extensions: Set<String>
Methods
strings(parserOptions:)
public static func strings(parserOptions: [String: Parser.Option] = [:]) -> Self
Default strings synthesizer defined in Tuist/{ProjectName}
or tuist itself
strings(plugin:parserOptions:)
public static func strings(
plugin: String,
parserOptions: [String: Parser.Option] = [:]
) -> Self
Strings synthesizer defined in a plugin
assets(parserOptions:)
public static func assets(parserOptions: [String: Parser.Option] = [:]) -> Self
Default assets synthesizer defined in Tuist/{ProjectName}
or tuist itself
assets(plugin:parserOptions:)
public static func assets(
plugin: String,
parserOptions: [String: Parser.Option] = [:]
) -> Self
Assets synthesizer defined in a plugin
fonts(parserOptions:)
public static func fonts(parserOptions: [String: Parser.Option] = [:]) -> Self
Default fonts synthesizer defined in Tuist/{ProjectName}
or tuist itself
fonts(plugin:parserOptions:)
public static func fonts(
plugin: String,
parserOptions: [String: Parser.Option] = [:]
) -> Self
Fonts synthesizer defined in a plugin
plists(parserOptions:)
public static func plists(parserOptions: [String: Parser.Option] = [:]) -> Self
Default plists synthesizer defined in Tuist/{ProjectName}
or tuist itself
plists(plugin:parserOptions:)
public static func plists(
plugin: String,
parserOptions: [String: Parser.Option] = [:]
) -> Self
Plists synthesizer defined in a plugin
coreData(plugin:parserOptions:)
public static func coreData(
plugin: String,
parserOptions: [String: Parser.Option] = [:]
) -> Self
CoreData synthesizer defined in a plugin
coreData(parserOptions:)
public static func coreData(parserOptions: [String: Parser.Option] = [:]) -> Self
Default CoreData synthesizer defined in Tuist/{ProjectName}
interfaceBuilder(plugin:parserOptions:)
public static func interfaceBuilder(
plugin: String,
parserOptions: [String: Parser.Option] = [:]
) -> Self
InterfaceBuilder synthesizer defined in a plugin
interfaceBuilder(parserOptions:)
public static func interfaceBuilder(parserOptions: [String: Parser.Option] = [:]) -> Self
InterfaceBuilder synthesizer with a template defined in Tuist/{ProjectName}
json(plugin:parserOptions:)
public static func json(plugin: String, parserOptions: [String: Parser.Option] = [:]) -> Self
JSON synthesizer defined in a plugin
json(parserOptions:)
public static func json(parserOptions: [String: Parser.Option] = [:]) -> Self
JSON synthesizer with a template defined in Tuist/{ProjectName}
yaml(plugin:parserOptions:)
public static func yaml(plugin: String, parserOptions: [String: Parser.Option] = [:]) -> Self
YAML synthesizer defined in a plugin
yaml(parserOptions:)
public static func yaml(parserOptions: [String: Parser.Option] = [:]) -> Self
CoreData synthesizer with a template defined in Tuist/{ProjectName}
files(plugin:parserOptions:extensions:)
public static func files(
plugin: String,
parserOptions: [String: Parser.Option] = [:],
extensions: Set<String>
) -> Self
Files synthesizer defined in a plugin
files(parserOptions:extensions:)
public static func files(
parserOptions: [String: Parser.Option] = [:],
extensions: Set<String>
) -> Self
Files synthesizer with a template defined in Tuist/{ProjectName}
custom(plugin:parser:parserOptions:extensions:resourceName:)
public static func custom(
plugin: String,
parser: Parser,
parserOptions: [String: Parser.Option] = [:],
extensions: Set<String>,
resourceName: String
) -> Self
Custom synthesizer from a plugin
- Parameters:
- plugin: Name of a plugin where resource synthesizer template is located
- parser:
Parser
to use for parsing the file to obtain its data - extensions: Set of extensions that should be parsed
- resourceName: Name of the template file and the resulting
.swift
file
Parameters
Name | Description |
---|---|
plugin | Name of a plugin where resource synthesizer template is located |
parser | Parser to use for parsing the file to obtain its data |
extensions | Set of extensions that should be parsed |
resourceName | Name of the template file and the resulting .swift file |
custom(name:parser:parserOptions:extensions:)
public static func custom(
name: String,
parser: Parser,
parserOptions: [String: Parser.Option] = [:],
extensions: Set<String>
) -> Self
Custom local synthesizer defined Tuist/ResourceSynthesizers/{name}.stencil
- Parameters:
- name: Name of synthesizer
- parser:
Parser
to use for parsing the file to obtain its data - extensions: Set of extensions that should be parsed
Parameters
Name | Description |
---|---|
name | Name of synthesizer |
parser | Parser to use for parsing the file to obtain its data |
extensions | Set of extensions that should be parsed |