DropletHUDCard

A HUD card as data: Droppy draws it in the layout of its own battery and No Internet cards, with their type, padding and height (1.23.0).

struct DropletHUDCard

Without actions the card is the battery card: the symbol, or a progress ring around it, leading where the battery sits, and the title over a message beside it. From the Droppy that embeds DroppyKit 1.24.0 that is Droppy's one island alert card on every Mac: 310 points wide on the camera island and every other island, its text running under the camera pill and the message up to four lines, and on a notched Mac the same card hung under the notch (it was the title over two lines, the symbol at the trailing edge). With actions it is the No Internet card: the symbol and the text on top, up to two pill buttons under them. The host sizes the card from which of the two it is; there is no height to state.

Available from DroppyKit 1.23.0.

From the Droppy that draws its alerts as the island pill (the build after the one that embeds DroppyKit 1.25.0 first; a host before it keeps the 1.24.0 card and ignores art and trailingText) a card without actions is Droppy's island notification pill, the one every alert of Droppy's own is: the art leading in its round slot, the title as a short bold tagline and the message as ONE grey line under it, an optional value at the trailing end (trailingText), the camera pill hidden in the shell with the title beside it on the camera island, and on a notched Mac the same pill under the notch, as wide as the island's: the art beside the notch, the title and the message one line each just below it. Droppy draws the shell, the layout, the type, the outline and the glass from its own single source; a droplet supplies the content only, so every later change to Droppy's island reaches its cards too.

Initializers

init(title:message:art:systemImage:tint:progress:trailingText:actions:)

init(title: String, message: String? = nil, art: DropletHUDArt?, systemImage: String? = nil, tint: Color? = nil, progress: Double? = nil, trailingText: String?, actions: [DropletHUDAction] = [])

Creates a card with its own leading art and a trailing value (1.25.0). Pass nil for the one of art and trailingText you do not use; both have no default so a call stays unambiguous next to the 1.23.0 initializer.

DropletHUDCard(
    title: "+€ 7,74",
    message: "Stripe",
    art: DropletHUDArt { ProviderTile(.stripe) },
    trailingText: "€ 284 today"
)

Available from DroppyKit 1.25.0: optional API, guard it with #_hasSymbol(DropletHUDArt.self) to keep an older kit.minAPI.

init(title:message:systemImage:tint:progress:actions:)

init(title: String, message: String? = nil, systemImage: String? = nil, tint: Color? = nil, progress: Double? = nil, actions: [DropletHUDAction] = [])

Creates a card.

Properties

actions

let actions: [DropletHUDAction]

Up to two buttons. Droppy draws the first two and ignores the rest.

art

let art: DropletHUDArt?

The leading art when an SF Symbol is not enough: a photo, an avatar, an app's own icon (1.25.0). It takes the slot systemImage and progress would take; set one or the other. nil for none.

Available from DroppyKit 1.25.0 (optional API; see DropletHUDArt).

message

let message: String?

The line under the title, or nil. One grey line on the island pill (1.25.0 hosts; up to four lines on the 1.24.0 island card).

progress

let progress: Double?

A fraction from 0 to 1 to draw as a ring around the symbol, or nil. Values outside the range are clamped.

systemImage

let systemImage: String?

An SF Symbol for the card, or nil for none.

tint

let tint: Color?

The symbol's and the progress ring's colour. nil is the system accent colour. The buttons keep Apple's pop-up colours whatever the tint.

title

let title: String

The card's title, sentence case, one line: a short tagline.

trailingText

let trailingText: String?

A short value at the trailing end of the title's line, one line: "now", "92%", "€ 284 today" (1.25.0). nil for none.

Available from DroppyKit 1.25.0 (optional API; see DropletHUDArt).