Structure
Variable
public struct Variable: Declaration, Hashable, Codable
A declaration for a property or a top-level variable or constant.
Relationships
Nested Types
Variable.Accessor
A computed variable or computed property accessor.
Conforms To
Declaration
A Swift declaration.
ExpressibleBySyntax
A type that can be initialized with a Swift syntax node.
Codable
CustomStringConvertible
Hashable
Initializers
init?(_:)
public init?(_ node: PatternBindingSyntax)
Creates an instance initialized with the given syntax node.
Properties
keyword
let keyword: String
The declaration keyword ("let"
or "var"
).
name
let name: String
The name of the property or top-level variable or constant.
typeAnnotation
let typeAnnotation: String?
The type annotation for the declaration, if any.
initializedValue
let initializedValue: String?
The initialized value for the declaration, if any.
accessors
let accessors: [Accessor]
The variable or property accessors.
description
var description: String
Methods
variables(from:)
public static func variables(from node: VariableDeclSyntax) -> [Variable]
Creates and returns variables from a variable declaration,
which may contain one or more pattern bindings,
such as let x: Int = 1, y: Int = 2
.