Post

BroadcastUploadExtensionHelper: Finish Screen Sharing Gracefully

A Swift package that exposes a simple API to terminate a ReplayKit broadcast upload extension without triggering the default error alert.

When you’re building a ReplayKit broadcast upload extension you normally call finishBroadcastWithError(_:) to end the screen share. Because you can’t pass nil, ReplayKit pops up an error alert that you don’t want.

I created BroadcastUploadExtensionHelper to save you time. It’s a tiny Swift package with a lightweight Objective-C helper so your RPBroadcastSampleHandler can exit gracefully—no bridging header required. Grab it here: https://github.com/mehmetbaykar/BroadcastUploadExtensionHelper

Add the package to your Package.swift file at version 1.0.0:

1
.package(url: "https://github.com/mehmetbaykar/BroadcastUploadExtensionHelper", from: "1.0.0")

Then simply import the package in your extension target:

1
import BroadcastUploadExtensionHelper

From your RPBroadcastSampleHandler subclass you can end the broadcast like this:

1
2
sampleHandler.finishGracefully()           // End normally without an alert
sampleHandler.finishWithError(message: "Oops")  // End with a custom error alert

This package does the boilerplate Objective‑C work for you so you can finish a broadcast without unexpected alerts or add your own custom message when something goes wrong.

Let me know what you think.

☕ Support My Work

If you found this post helpful and want to support more content like this, you can buy me a coffee!

Your support helps me continue creating useful articles and tips for fellow developers. Thank you! 🙏

This post is licensed under CC BY 4.0 by the author.