<!--
{
  "availability" : [
    "iOS: 11.4.0 -",
    "iPadOS: 11.4.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ClassKit",
  "identifier" : "/documentation/ClassKit/CLSContext/descendant(matchingIdentifierPath:completion:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "ClassKit"
    ],
    "preciseIdentifier" : "c:objc(cs)CLSContext(im)descendantMatchingIdentifierPath:completion:"
  },
  "title" : "descendant(matchingIdentifierPath:completion:)"
}
-->

# descendant(matchingIdentifierPath:completion:)

Finds the context with the given identifier path relative to this context.

```
func descendant(matchingIdentifierPath identifierPath: [String], completion: @escaping @Sendable (CLSContext?, (any Error)?) -> Void)
```

## Parameters

`identifierPath`

The identifier path of the context to find, relative to the current context.

`completion`

A closure the method calls with the found context, or `nil` if none could be found, and an error indicating the reason for failure, if any.

## Discussion

> Important:
> You can call this method from synchronous code using a completion handler, as shown on this page, or you can call it as an asynchronous method that has the following declaration:
> 
> ```swift
> func descendant(matchingIdentifierPath identifierPath: [String]) async throws -> CLSContext
> ```
> 
> For information about concurrency and asynchronous code in Swift, see <doc://com.apple.documentation/documentation/Swift/calling-objective-c-apis-asynchronously>.

> Important:
> ClassKit calls your completion handler on an arbitrary thread. If you need to do work on a particular thread from inside the handler, dispatch that work to the appropriate queue.

---

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)