Contents

exchange(_:with:)

Replaces the value of a mutable value with the supplied new value, returning the original.

Declaration

func exchange<T>(_ item: inout T, with newValue: consuming T) -> T where T : ~Copyable

Parameters

  • item:

    A mutable binding.

  • newValue:

    The new value of item.

Return Value

The original value of item.

See Also

Memory Access