---
title: "beginSheetModal(for:modalDelegate:didEnd:contextInfo:)"
framework: IOBluetooth UI
role: symbol
role_heading: Instance Method
platforms: [macOS 10.2+]
path: "iobluetoothui/iobluetoothobjectpushuicontroller/beginsheetmodal(for:modaldelegate:didend:contextinfo:)"
---

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

Runs the transfer UI as a sheet on the target window.

## Declaration

```swift
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

Return Value Returns kIOReturnSuccess if the sheet modal session was started.

## Discussion

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.

## See Also

### Instance Methods

- [getDevice()](iobluetoothui/iobluetoothobjectpushuicontroller/getdevice().md)
- [getTitle()](iobluetoothui/iobluetoothobjectpushuicontroller/gettitle().md)
- [isTransferInProgress()](iobluetoothui/iobluetoothobjectpushuicontroller/istransferinprogress().md)
- [runModal()](iobluetoothui/iobluetoothobjectpushuicontroller/runmodal().md)
- [runPanel()](iobluetoothui/iobluetoothobjectpushuicontroller/runpanel().md)
- [setIconImage(_:)](iobluetoothui/iobluetoothobjectpushuicontroller/seticonimage(_:).md)
- [setTitle(_:)](iobluetoothui/iobluetoothobjectpushuicontroller/settitle(_:).md)
- [stop()](iobluetoothui/iobluetoothobjectpushuicontroller/stop().md)
