Skip to main content

Functions to enable plugins

Each plugin in meeting.plugins object is of type DytePlugin and exposes the following functions to enable plugins.

Get Plugin View

This method adds the communication layer between the plugin inside the WebView and the core SDK (meeting object) in your application.

let plugin = meeting.plugins.active[0]

plugin.getPluginView() // This will return a WebView

The getPluginView() method returns a WebView that can be added to a UIView.

Activate Plugins

The activate() method activates a plugin for all users in the meeting. When you activate a plugin, it moves into the active plugins map and can be accessed from meeting.plugins.active.

The snippet below retrieves the first plugin from the list and activates it.

var plugin: DytePlugin = meeting.plugins.all[0]

plugin.activate()

This directly activates the plugin without any user interaction.

Activate a plugin on click

You can also show a list of all plugins and activate a plugin on click programmatically.

func togglePlugin(index: Int) {
let plugin = plugins[index]
if plugin.isActive {
plugin.deactivate()
}else {
plugin.activate()
}
}