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

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

Runs the service browser panel 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 service browser 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 IOBluetoothServiceBrowserController object instead of the window: -(void)sheetDidEnd:(IOBluetoothServiceBrowserController *)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.

## See Also

### Instance Methods

- [addAllowedUUID(_:)](iobluetoothui/iobluetoothservicebrowsercontroller/addalloweduuid(_:).md)
- [addAllowedUUIDArray(_:)](iobluetoothui/iobluetoothservicebrowsercontroller/addalloweduuidarray(_:).md)
- [clearAllowedUUIDs()](iobluetoothui/iobluetoothservicebrowsercontroller/clearalloweduuids().md)
- [getDescriptionText()](iobluetoothui/iobluetoothservicebrowsercontroller/getdescriptiontext().md)
- [getOptions()](iobluetoothui/iobluetoothservicebrowsercontroller/getoptions().md)
- [getPrompt()](iobluetoothui/iobluetoothservicebrowsercontroller/getprompt().md)
- [getRef()](iobluetoothui/iobluetoothservicebrowsercontroller/getref().md)
- [getResults()](iobluetoothui/iobluetoothservicebrowsercontroller/getresults().md)
- [getSearchAttributes()](iobluetoothui/iobluetoothservicebrowsercontroller/getsearchattributes().md)
- [getTitle()](iobluetoothui/iobluetoothservicebrowsercontroller/gettitle().md)
- [runModal()](iobluetoothui/iobluetoothservicebrowsercontroller/runmodal().md)
- [setDescriptionText(_:)](iobluetoothui/iobluetoothservicebrowsercontroller/setdescriptiontext(_:).md)
- [setOptions(_:)](iobluetoothui/iobluetoothservicebrowsercontroller/setoptions(_:).md)
- [setPrompt(_:)](iobluetoothui/iobluetoothservicebrowsercontroller/setprompt(_:).md)
- [setSearchAttributes(_:)](iobluetoothui/iobluetoothservicebrowsercontroller/setsearchattributes(_:).md)
