Skip to content

RtkControlBarButton

Base button class for control bar items. Supports normal and selected states, notification badges, and theming through appearance configuration.

Initializer parameters

ParameterTypeRequiredDefaultDescription
imageRtkImage-The icon image for the button
titleString""The title text displayed below the icon
appearanceRtkControlBarButtonAppearance-Appearance configuration for colors and styling

Properties

PropertyTypeRequiredDefaultDescription
selectedStateTintColorUIColor-Tint color applied when the button is in the selected state
normalStateTintColorUIColor-Tint color applied when the button is in the normal state
notificationBadgeRtkNotificationBadgeView--Badge view for displaying notification counts

Methods

MethodReturn TypeDescription
setSelected(image:title:)VoidSets the button to the selected state with a custom image and title
setDefault(image:title:)VoidSets the button to the default state with a custom image and title

Usage Examples

Basic Usage

Swift
import RealtimeKitUI
let button = RtkControlBarButton(
image: RtkImage(image: UIImage(systemName: "mic")),
title: "Mute"
)
view.addSubview(button)

With state changes

Swift
import RealtimeKitUI
let button = RtkControlBarButton(
image: RtkImage(image: UIImage(systemName: "mic")),
title: "Mute"
)
// Switch to selected state
button.setSelected(
image: RtkImage(image: UIImage(systemName: "mic.slash")),
title: "Unmute"
)
// Switch back to default state
button.setDefault(
image: RtkImage(image: UIImage(systemName: "mic")),
title: "Mute"
)
view.addSubview(button)