+=(_:_:)
Extends the left-hand size arguments with the right-hand side arguments.
static func += (lhs: inout StatementArguments, rhs: StatementArguments)
Positional arguments are concatenated:
var arguments: StatementArguments = [1]
arguments += [2, 3]
// Prints [1, 2, 3]
print(arguments)
Named arguments are inserted:
var arguments: StatementArguments = ["foo": 1]
arguments += ["bar": 2]
// Prints ["foo": 1, "bar": 2]
print(arguments)
If the arguments on the right-hand side has named parameters that are already defined on the left, a fatal error is raised:
var arguments: StatementArguments = ["foo": 1]
// fatal error: already defined statement argument: foo
arguments += ["foo": 2]
This fatal error can be avoided with the &+ operator, or the append(contentsOf:)
method.
You can mix named and positional arguments (see the documentation of the StatementArguments
type for more information about mixed arguments):
var arguments: StatementArguments = ["foo": 1]
arguments.append(contentsOf: [2, 3])
// Prints ["foo": 1, 2, 3]
print(arguments)