Contents

withTransaction(_:_:_:)

Executes a closure with the specified transaction key path and value and returns the result.

Declaration

func withTransaction<R, V>(_ keyPath: WritableKeyPath<Transaction, V>, _ value: V, _ body: () throws -> R) rethrows -> R

Parameters

  • keyPath:

    A key path that indicates the property of the Transaction structure to update.

  • value:

    The new value to set for the item specified by keyPath.

  • body:

    A closure to execute.

Return Value

The result of executing the closure with the specified transaction value.

See Also

Moving an animation to another view