performChanges(_:completionHandler:)
Asynchronously runs a block that requests changes to the photo library.
Declaration
func performChanges(_ changeBlock: @escaping () -> Void, completionHandler: (@Sendable (Bool, (any Error)?) -> Void)? = nil)func performChanges(_ changeBlock: @escaping () -> Void) async throwsParameters
- changeBlock:
A block that requests changes to perform.
This block takes no parameters and has no return value.
- completionHandler:
A block that Photos calls after the change block completes and Photos performs the requested changes.
The block takes the following parameters:
- success
trueif Photos successfully applied the changes requested in the block; otherwise,false.- error
If an error occurs, an
NSErrorobject describing the error; otherwise,nil.
Mentioned in
Discussion
Photos executes both the change block and the completion handler block on an arbitrary serial queue. To update your app’s UI as a result of a change, dispatch that work to the main queue.