ConditionalCompilationBlock

public struct ConditionalCompilationBlock : Declaration, Hashable, Codable
extension ConditionalCompilationBlock: ExpressibleBySyntax

A conditional compilation block declaration.

  • A dot-delimited (.) path describing the enclosing scope of the conditional compilation block declaration, or nil if the conditional compilation block isn’t nested (that is, declared at the top-level scope of a module).

    For example, the following conditional compilation block declaration has the context "A.B":

    enum A {
       enum B {
           #if true
               enum C {}
           #endif
       }
    }
    

    Declaration

    Swift

    public let context: String?
  • The conditional compilation block branches.

    For example, the following compilation block declaration has two branches:

    #if true
    enum A {}
    #else
    enum B {}
    #endif
    

    The first branch has the keyword #if and condition "true". The second branch has the keyword #else and no condition.

    Declaration

    Swift

    public let branches: [Branch]
  • A conditional compilation block branch.

    See more

    Declaration

    Swift

    public enum Branch : Hashable
    extension ConditionalCompilationBlock.Branch: ExpressibleBySyntax
    extension ConditionalCompilationBlock.Branch: Codable

ExpressibleBySyntax

  • Creates an instance initialized with the given syntax node.

    Declaration

    Swift

    public init(_ node: IfConfigDeclSyntax)