---
title: "performChangesAndWait(_:)"
framework: photos
role: symbol
role_heading: Instance Method
path: "photos/phphotolibrary/performchangesandwait(_:)"
---

# performChangesAndWait(_:)

Synchronously runs a block that requests changes to be performed in the photo library.

## Declaration

```swift
func performChangesAndWait(_ changeBlock: @escaping () -> Void) throws
```

## Parameters

- `changeBlock`: A block that requests changes to be performed. This block takes no parameters and has no return value.

## Mentioned in

Requesting Changes to the Photo Library Uploading asset resources in the background

## Discussion

Discussion Do not call this method from the main thread. Your change block, and the work that Photos performs on your behalf to apply the changes it requests, take some time to execute. (Photos may need to prompt the user to perform changes, so this method can block execution indefinitely.) Use this method if you are already performing work on a background queue that results in a change to be applied to the Photos library. To request changes from the main queue, use the performChanges(_:completionHandler:) method instead. note: For each call to this method, iOS shows an alert asking the user for permission to edit the contents of the photo library. If your app needs to submit several changes at once, combine them into a single change block. For example, to edit the content of multiple existing photos, create multiple PHAssetChangeRequest objects and set the contentEditingOutput property on each to an independent PHContentEditingOutput object. note: In Swift, this method returns Void and is marked with the throws keyword to indicate that it throws an error in cases of failure. You call this method in a try expression and handle any errors in the catch clauses of a do statement, as described in Error Handling in The Swift Programming Language and About Imported Cocoa Error Parameters.

## See Also

### Updating the Library

- [Requesting Changes to the Photo Library](photokit/requesting-changes-to-the-photo-library.md)
- [performChanges(_:completionHandler:)](photos/phphotolibrary/performchanges(_:completionhandler:).md)
- [PHChangeRequest](photos/phchangerequest.md)
- [PHAssetChangeRequest](photos/phassetchangerequest.md)
- [PHAssetCollectionChangeRequest](photos/phassetcollectionchangerequest.md)
- [PHCollectionListChangeRequest](photos/phcollectionlistchangerequest.md)
- [PHObjectPlaceholder](photos/phobjectplaceholder.md)
