<!--
{
  "availability" : [
    "macOS: 10.5.0 - 10.11.0"
  ],
  "documentType" : "symbol",
  "framework" : "Collaboration",
  "identifier" : "/documentation/Collaboration/CBIdentityPicker/runModal(for:modalDelegate:didEnd:contextInfo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Collaboration"
    ],
    "preciseIdentifier" : "c:objc(cs)CBIdentityPicker(im)runModalForWindow:modalDelegate:didEndSelector:contextInfo:"
  },
  "title" : "runModal(for:modalDelegate:didEnd:contextInfo:)"
}
-->

# runModal(for:modalDelegate:didEnd:contextInfo:)

Runs the receiver modally as a sheet attached to a specified window.

```
func runModal(for window: NSWindow, modalDelegate delegate: Any?, didEnd didEndSelector: Selector?, contextInfo: UnsafeMutableRawPointer?)
```

## Parameters

`window`

The parent window for the sheet.

`delegate`

The delegate for the modal session.

`didEndSelector`

A message sent to the delegate after the user responds but before the sheet is dismissed.

`contextInfo`

Contextual data passed to the delegate in the `didEndSelector` message.

## Discussion

The `didEndSelector` parameter is a selector that takes three arguments. The corresponding method should have a declaration modeled on the following example:

```objc
- (void)identityPickerDidEnd:(CBIdentityPicker *)identityPicker returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;
```

where the `identityPicker` argument is the identity picker object, the `returnCode` argument  is the button the user clicked, and `contextInfo` is the same `contextInfo` argument that was passed in the original message.

## See Also

  [Identity Services Programming Guide](https://developer.apple.com/library/archive/documentation/Networking/Conceptual/IdentityServices_ProgGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40004490)



---

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)