DeclSyntaxProtocol
Protocol to which all DeclSyntax
nodes conform.
protocol DeclSyntaxProtocol : SyntaxProtocol
Browse conforming typesExtension point to add common methods to all DeclSyntax
nodes.
Protocol to which all DeclSyntax
nodes conform.
protocol DeclSyntaxProtocol : SyntaxProtocol
Extension point to add common methods to all DeclSyntax
nodes.
import SwiftSyntax
A library for working with Swift code.
struct DeclSyntax
protocol SyntaxProtocol : CustomDebugStringConvertible, CustomReflectable, CustomStringConvertible, Sendable, TextOutputStreamable
Provide common functionality for specialized syntax nodes. Extend this protocol to provide common functionality for all syntax nodes.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol CustomReflectable
A type that explicitly supplies its own mirror.
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Sendable
protocol TextOutputStreamable
A source of text-streaming operations.
struct MissingDeclSyntax
In case the source code is missing a declaration, this node stands in place of the missing declaration.
struct AccessorDeclSyntax
struct ActorDeclSyntax
struct AssociatedTypeDeclSyntax
An associatedtype
declaration
struct ClassDeclSyntax
A class
declaration
struct DeinitializerDeclSyntax
A deint
declaration
struct EditorPlaceholderDeclSyntax
An editor placeholder, e.g. <#declaration#>
that is used in a position that expects a declaration.
struct EnumCaseDeclSyntax
A case
declaration of a Swift enum
. It can have 1 or more EnumCaseElement
s inside, each declaring a different case of the enum.
struct EnumDeclSyntax
A Swift enum
declaration.
struct ExtensionDeclSyntax
struct FunctionDeclSyntax
struct IfConfigDeclSyntax
struct ImportDeclSyntax
An import
declaration
struct InitializerDeclSyntax
An init
declaration
struct MacroDeclSyntax
struct MacroExpansionDeclSyntax
The expansion of a freestanding macro in a position that expects a declaration.
struct OperatorDeclSyntax
A Swift operator
declaration.
struct PoundSourceLocationSyntax
struct PrecedenceGroupDeclSyntax
A Swift precedencegroup
declaration.
struct ProtocolDeclSyntax
A protocol
declaration
struct StructDeclSyntax
A struct
declaration
struct SubscriptDeclSyntax
struct TypeAliasDeclSyntax
struct VariableDeclSyntax
Declaration of one or more variables
func `as`<S>(_ syntaxType: S.Type) -> S? where S : DeclSyntaxProtocol
Attempts to cast the current syntax node to a given specialized syntax type.
func cast<S>(_ syntaxType: S.Type) -> S where S : DeclSyntaxProtocol
Force-casts the current syntax node to a given specialized syntax type.
func `is`<S>(_ syntaxType: S.Type) -> Bool where S : DeclSyntaxProtocol
Checks if the current syntax node can be cast to a given specialized syntax type.
func `as`(_ syntaxType: DeclSyntax.Type) -> DeclSyntax?
Attempts to upcast the current syntax node to its base node type (DeclSyntax
).
func `as`<S>(_ syntaxType: S.Type) -> S? where S : SyntaxProtocol
Attempts to cast the current syntax node to a given node type from the a base node protocol hierarchy other than DeclSyntaxProtocol
.
func cast(_ syntaxType: DeclSyntax.Type) -> DeclSyntax
Force-upcast the current syntax node to its base node type (DeclSyntax
).
func cast<S>(_ syntaxType: S.Type) -> S where S : SyntaxProtocol
Force-casts the current syntax node to a given node type from a base node protocol hierarchy other than DeclSyntaxProtocol
.
func `is`(_ syntaxType: DeclSyntax.Type) -> Bool
Checks if the current syntax node can be upcast to its base node type (DeclSyntax
).
func `is`<S>(_ syntaxType: S.Type) -> Bool where S : SyntaxProtocol
Checks if the current syntax node can be cast to a given node type from a base node protocol hierarchy other than DeclSyntaxProtocol
.
protocol DeclGroupSyntax : DeclSyntaxProtocol
protocol _LeafDeclSyntaxNodeProtocol : DeclSyntaxProtocol
Protocol that syntax nodes conform to if they don’t have any semantic subtypes. These are syntax nodes that are not considered base nodes for other syntax types.
import SwiftSyntaxBuilder
SwiftSyntaxBuilder is a tool for generating Swift code in a convenient way using result builders.
protocol DeclSyntaxParseable : DeclSyntaxProtocol
Adds an initializer that allows the creation of declaration from string interpolations.