-
Notifications
You must be signed in to change notification settings - Fork 31
Function_Parameter
A function parameter.
public struct Parameter: Hashable, CodableThis type can also be used to represent initializer parameters and associated values for enumeration cases.
Hashable, Codable, ExpressibleBySyntax, CustomStringConvertible
Creates an instance initialized with the given syntax node.
public init(_ node: FunctionParameterSyntax)The declaration attributes.
let attributes: [Attribute]The first, external name of the parameter.
let firstName: String?For example,
given the following function declaration,
the first parameter has a firstName equal to nil,
and the second parameter has a firstName equal to "by":
func increment(_ number: Int, by amount: Int = 1)The second, internal name of the parameter.
let secondName: String?For example,
given the following function declaration,
the first parameter has a secondName equal to "number",
and the second parameter has a secondName equal to "amount":
func increment(_ number: Int, by amount: Int = 1)The type identified by the parameter.
let type: String?For example,
given the following function declaration,
the first parameter has a type equal to "Person",
and the second parameter has a type equal to "String":
func greet(_ person: Person, with phrases: String...)Whether the parameter accepts a variadic argument.
let variadic: BoolFor example, given the following function declaration, the second parameter is variadic:
func greet(_ person: Person, with phrases: String...)The default argument of the parameter.
let defaultArgument: String?For example,
given the following function declaration,
the second parameter has a default argument equal to "1".
func increment(_ number: Int, by amount: Int = 1)var description: StringGenerated at 2020-08-02T12:14:07+0000 using swift-doc 1.0.0-beta.3.
Types
- AssociatedType
- Attribute
- Attribute.Argument
- Class
- ConditionalCompilationBlock
- ConditionalCompilationBlock.Branch
- DeclarationCollector
- Deinitializer
- Enumeration
- Enumeration.Case
- Extension
- Function
- Function.Parameter
- Function.Signature
- GenericParameter
- GenericRequirement
- GenericRequirement.Relation
- Import
- Initializer
- Modifier
- Operator
- Operator.Kind
- PrecedenceGroup
- PrecedenceGroup.Associativity
- PrecedenceGroup.Relation
- Protocol
- Structure
- Subscript
- Typealias
- Variable
- Variable.Accessor
- Variable.Accessor.Kind