Broadcast
Broadcast automatically fetches broadcast messages for the current (or a given) url.
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
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.
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:
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.
Warp.Broadcast(
text: "Broadcast",
broadcastEdge: .top,
isPresented: $broadcastIsPresented
).uiViewParameters
Required props
| name | type | default | notes |
|---|---|---|---|
text | String | Text that will be shown in the broadcast | |
broadcastEdge | Warp.BroadcastEdge | Edge from where the broadcast is presented. | |
isPresented | Binding Bool | Binding to a boolean value that allows the broadcast to control dismissal |
Optional Props
| name | type | default | notes |
|---|---|---|---|
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