SwiftGenerator class
Class that manages all Swift code generation.
- Inheritance
-
- Object
- Generator<
SwiftOptions> - StructuredGenerator<
SwiftOptions> - SwiftGenerator
Constructors
- SwiftGenerator()
-
Instantiates a Swift Generator.
const
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
generate(
SwiftOptions generatorOptions, Root root, StringSink sink, {required String dartPackageName}) → void -
Generates files for specified language with specified
generatorOptions
inherited -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
-
writeApis(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes all apis to
indent
.override -
writeClassDecode(
SwiftOptions generatorOptions, Root root, Indent indent, Class classDefinition, {required String dartPackageName}) → void -
Writes a single class decode method to
indent
.override -
writeClassEncode(
SwiftOptions generatorOptions, Root root, Indent indent, Class classDefinition, {required String dartPackageName}) → void -
Writes a single class encode method to
indent
.override -
writeCloseNamespace(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes code to
indent
that closes file namespace if needed.inherited -
writeDataClass(
SwiftOptions generatorOptions, Root root, Indent indent, Class classDefinition, {required String dartPackageName}) → void -
Writes a single data class to
indent
.override -
writeDataClasses(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes all data classes to
indent
.inherited -
writeEnum(
SwiftOptions generatorOptions, Root root, Indent indent, Enum anEnum, {required String dartPackageName}) → void -
Writes a single Enum to
indent
. This is needed in most generators.override -
writeEnums(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes all enums to
indent
.inherited -
writeFileImports(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes specified imports to
indent
.override -
writeFilePrologue(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Adds specified headers to
indent
.override -
writeFlutterApi(
SwiftOptions generatorOptions, Root root, Indent indent, AstFlutterApi api, {required String dartPackageName}) → void -
Writes the code for a flutter Api,
api
. Example: class Foo { private let binaryMessenger: FlutterBinaryMessenger init(binaryMessenger: FlutterBinaryMessenger) {...} func add(x: Int32, y: Int32, completion: @escaping (Int32?) -> Void) {...} }override -
writeGeneralUtilities(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes any necessary helper utilities to
indent
if needed.override -
writeHostApi(
SwiftOptions generatorOptions, Root root, Indent indent, AstHostApi api, {required String dartPackageName}) → void -
Write the swift code that represents a host Api,
api
. Example: protocol Foo { Int32 add(x: Int32, y: Int32) }override -
writeInstanceManager(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes the implementation of an
InstanceManager
toindent
.inherited -
writeInstanceManagerApi(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes the implementation of the API for the
InstanceManager
toindent
.inherited -
writeOpenNamespace(
SwiftOptions generatorOptions, Root root, Indent indent, {required String dartPackageName}) → void -
Writes code to
indent
that opens file namespace if needed.inherited -
writeProxyApi(
SwiftOptions generatorOptions, Root root, Indent indent, AstProxyApi api, {required String dartPackageName}) → void -
Writes a single Proxy Api to
indent
.inherited -
writeProxyApiBaseCodec(
SwiftOptions generatorOptions, Root root, Indent indent) → void -
Writes the base codec to be used by all ProxyApis.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited