---
title: "load(withPreferredExtension:handler:)"
framework: replaykit
role: symbol
role_heading: Type Method
path: "replaykit/rpbroadcastactivityviewcontroller/load(withpreferredextension:handler:)"
---

# load(withPreferredExtension:handler:)

Loads a broadcast activity view controller with a preferred extension.

## Declaration

```swift
class func load(withPreferredExtension preferredExtension: String?, handler: @escaping (RPBroadcastActivityViewController?, (any Error)?) -> Void)
```

## Parameters

- `preferredExtension`: The extension bundle identifier for the preferred broadcast extension service.
- `handler`: A block that is called after the view controller is loaded.

## Discussion

Discussion Present the view controller using present(_:animated:completion:). Dismiss the view controller when the delegate’s broadcastActivityViewController(_:didFinishWith:error:) method is called. note: On the iPad, the default presentation style for view controllers is a popover. For an instance of RPBroadcastActivityViewController to present properly on iPad, insure the popover presentation controller’s sourceRect and sourceView are configured.

## See Also

### Presenting the Broadcast Activity UI

- [load(handler:)](replaykit/rpbroadcastactivityviewcontroller/load(handler:).md)
