---
title: "perform(_:)"
framework: coredata
role: symbol
role_heading: Instance Method
path: "coredata/nsmanagedobjectcontext/perform(_:)"
---

# perform(_:)

Asynchronously performs the specified closure on the context’s queue.

## Declaration

```swift
func perform(_ block: @escaping @Sendable () -> Void)
```

## Parameters

- `block`: The closure to perform.

## Mentioned in

Using Core Data in the background

## Discussion

Discussion This method encapsulates an autorelease pool and a call to processPendingChanges().

## See Also

### Performing block operations

- [perform(schedule:_:)](coredata/nsmanagedobjectcontext/perform(schedule:_:).md)
- [performAndWait(_:)](coredata/nsmanagedobjectcontext/performandwait(_:)-ypye.md)
- [performAndWait(_:)](coredata/nsmanagedobjectcontext/performandwait(_:)-6aaf1.md)
- [NSManagedObjectContext.ScheduledTaskType](coredata/nsmanagedobjectcontext/scheduledtasktype.md)
