withTransaction

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

FunctioniOS 13.0+

Overloads

2 ways to call withTransaction(). Each is one SwiftUI overload, picked by the arguments you pass.

React
function withTransaction<K extends keyof SwiftUI.TransactionWritable, Result>(
  keyPath: K,
  value: SwiftUI.TransactionWritable[K],
  body: () => Result
): Result
Swift
@export(implementation) func withTransaction<R, V>(
    _ keyPath: WritableKeyPath<Transaction, V>,
    _ value: V,
    _ body: () throws -> R
) rethrows -> R

Parameters

See also

More in SwiftUI functions.