Toast

toast

Toast notifications are small messages, based on user actions. It can be used to provide feedback about an operation or to display a system message.

Usage

toast

XelaToast(
    title: "New version available",
    description: "A new Version of software is available for download",
    closeButton: XelaButton(action: {print("Close Toast")}, size: .Small, type: .Secondary, foregroundColor: Color(.white), borderLineWidth: 0, systemIcon: "xmark"),
    firstActionText: "Update",
    firstAction: {print("Action 1")},
    secondActionText: "Not now",
    secondAction: {print("Action 2")},
    autoresize: false,
    background: Color(xelaColor: .Gray3),
    firstActionColor: Color(xelaColor: .Green5),
    secondActionColor: Color(.white),
    titleColor: Color(.white),
    descriptionColor: Color(.white),
    iconColor: Color(.white)
)
.shadow(color: Color(.black).opacity(0.04), radius: 48, x:0 , y: 4)
.shadow(color: Color(.black).opacity(0.04), radius: 12, x:0 , y: 8)
.padding()

Properties

Name Type Default Value Required Description
title String - YES Toast title string
description String NO Toast description string
icon String? nil NO Toast icon name from Assets
avatar XelaUserAvatar? nil NO Avatar for toast
rightButton XelaButton? nil NO Right button for toast
firstActionText String NO First action text
firstAction (() -> Void)? nil NO Func for first action
secondActionText String NO Second action text
secondAction (() -> Void)? nil NO Func for second action
autoresize Bool false NO Autoresize width for toast
background Color Color(.white) NO Toast background color
firstActionColor Color Color(xelaColor: .Blue3) NO First action color
secondActionColor Color Color(xelaColor: .Blue3) NO Second action color
titleColor Color Color(xelaColor: .Gray2) NO Title text color
descriptionColor Color Color(xelaColor: .Gray6) NO Description text color
iconColor Color Color(xelaColor: .Blue3) NO Icon color