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.
function withTransaction<K extends keyof SwiftUI.TransactionWritable, Result>(
keyPath: K,
value: SwiftUI.TransactionWritable[K],
body: () => Result
): Result@export(implementation) func withTransaction<R, V>(
_ keyPath: WritableKeyPath<Transaction, V>,
_ value: V,
_ body: () throws -> R
) rethrows -> RParameters
keyPath*Kvalue*SwiftUI.TransactionWritable[K]body*() => Result
See also
More in SwiftUI functions.
- createNavigationPathStarts a SwiftUI NavigationPath. Each call returns a new value, as compose() does.
- createPathStarts a SwiftUI Path. Each call returns a new value, as compose() does.
- createScrollPositionStarts a SwiftUI ScrollPosition. Each call returns a new value, as compose() does.
- createTabViewCustomizationStarts a SwiftUI TabViewCustomization. Each call returns a new value, as compose() does.
- createTransactionStarts a SwiftUI Transaction. Each call returns a new value, as compose() does.
- withAnimationReturns the result of recomputing the view's body with the provided animation.