Skip to content

Broadcast

Broadcast automatically fetches broadcast messages for the current (or a given) url.

iOSdeprecated

Uses toast apis under the hood.

N.B. Broadcast should only be included once per page to avoid duplicate broadcast messages being displayed. The preferred method for including broadcast is to use the broadcast-podlet provided by the communication team.

Example

See the toast component for examples, as broadcast utilizes it to display messages.

Usage

Design Guidelines

See Figma: Warp - Components / Broadcast

Framework(s)

Syntax

swift
Warp.Broadcast(
    text: String,
    broadcastEdge: Warp.BroadcastEdge,
    isDismissable: Bool = true,
    isPresented: Binding<Bool>
)

You can create the Broadcast yourself or add it as a modifier to your view.

swift
Warp.Broadcast(
    text: "Broadcast",
    broadcastEdge: .top,
    isPresented: $broadcastIsPresented
)

.warpBroadcast(
    text: "Here's a broadcast located at the bottom edge",
    edge: .bottom,
    isDismissable: false,
    isPresented: $broadcastIsPresented
)

There are a variety of positions supported for the broadcast component:

swift
enum Warp.BroadcastEdge {
    case top
    case bottom
}

Legacy support

By default all Warp components return a SwiftUI View but there is always a UIKit UIView available to use also.

swift
Warp.Broadcast(
    text: "Broadcast",
    broadcastEdge: .top,
    isPresented: $broadcastIsPresented
).uiView

Parameters

Required props

nametypedefaultnotes

text

String

Text that will be shown in the broadcast

broadcastEdge

Warp.BroadcastEdge

Edge from where the broadcast is presented.
Use one of the predefined BroadcastEdge values: .top, or .bottom

isPresented

Binding Bool

Binding to a boolean value that allows the broadcast to control dismissal

Optional Props

nametypedefaultnotes

isDismissable

Bool

true

Determines if dismissable by the user or not. Will add a close button.

Questions?

Feel free to ask any questions on usage in the Warp DS Slack channel: #warp-design-system