<!--
{
  "availability" : [
    "iOS: 17.4.0 -",
    "iPadOS: 17.4.0 -",
    "macCatalyst: 17.4.0 -",
    "visionOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "Assignables",
  "identifier" : "/documentation/Assignables/UserIdentity/scope(_:)-esta",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Assignables"
    ],
    "preciseIdentifier" : "s:11Assignables12UserIdentityPAAE5scopeyqd__qd__yKXEKlF"
  },
  "title" : "scope(_:)"
}
-->

# scope(_:)

Sets the user identity for document-related operations that
occur within the closure passed in.

```
@discardableResult func scope<R>(_ access: () throws -> R) rethrows -> R
```

## Parameters

`access`

A closure containing
document-related operations . Operations in
the closure will be attributed to this user identity.

## Return Value

The result of the closure.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)