Info Banner

A way to highlight important information for travellers.

 

Backpack-SwiftUI/BannerAlert

Cocoapods class reference view on Github

Day Night

Usage

Banner alert comes in a number of types to indicate information, success, warning or error. Additionally, It supports two styles.

BPKBannerAlert

How to initialize

If you don't specify a Style it will use the .default style.

Supported AlertTypes: info, success, warning, error

Supported Styles: default, onContrast

BPKBannerAlert(
    type: .warning(accessibilityLabel: "Warning"),
    style: .onContrast,
    message: "Hello World!",
    accessibilityIdentifier: "BannerAlertAccessibilityIdentifier"
)

Using a custom icon

The custom icon will replace the type's default icon, but the type' color will be applied to it.

BPKBannerAlert(
    type: .error(accessibilityLabel: "Error"),
    style: style,
    message: "Mutliline banner with custom icon \nThis is a new line",
    icon: (BPKIcon.accountAdd, accessibilityLabel: "Account Add Icon")
)