<!--
{
  "availability" : [
    "macOS: 10.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "IOBluetoothUI",
  "identifier" : "/documentation/IOBluetoothUI/IOBluetoothDeviceSelectorController/beginSheetModal(for:modalDelegate:didEnd:contextInfo:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "IOBluetooth UI"
    ],
    "preciseIdentifier" : "c:objc(cs)IOBluetoothDeviceSelectorController(im)beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:"
  },
  "title" : "beginSheetModal(for:modalDelegate:didEnd:contextInfo:)"
}
-->

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

Runs the device selector panel as a sheet on the target window.

```
func beginSheetModal(for sheetWindow: NSWindow!, modalDelegate: Any!, didEnd didEndSelector: Selector!, contextInfo: UnsafeMutableRawPointer!) -> IOReturn
```

## Parameters

`sheetWindow`

NSWindow to attach the device selector panel to as a sheet.

`modalDelegate`

Delegate object that gets sent the didEndSelector when the sheet modal session is finished.

`didEndSelector`

Selector sent to the modalDelegate when the sheet modal session is finished.

`contextInfo`

User-definied value passed to the modalDelegate in the didEndSelector.

## Return Value

Returns kIOReturnSuccess if the sheet modal session was started.

## Discussion

This function works the same way as -[NSApplication beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:]. The didEndSelector has a similar prototype as in NSApplication except that the first argument is the IOBluetoothDeviceSelectorController object instead of the window: -(void)sheetDidEnd:(IOBluetoothDeviceSelectorController *)controller returnCode:(int)returnCode contextInfo:(void *)contextInfo. The returnCode parameter will either be kIOBluetoothUISuccess or kIOBluetoothUIUserCancelledErr as described in -runModal.

NOTE: This method is only available in macOS 10.2.4 (Bluetooth v1.1) or later.

---

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)