Alerts

Alerts provide boxed out notifications in a range of styles depending on the role you attach to them.

A simple alert is created like this:

Alert {
    Text("Something went really wrong.")
}
.role(.danger)

Something went really wrong.

Each role applies different styling to the alert, as you can see in this example:

for role in Role.allCases {
    // The default role isn't interesting for alerts
    if role != .default {
        Alert {
            Text("This alert has the \(role.rawValue) role.")
        }
        .role(role)
    }
}

This alert has the primary role.

This alert has the secondary role.

This alert has the success role.

This alert has the danger role.

This alert has the warning role.

This alert has the info role.

This alert has the light role.

This alert has the dark role.

Created with Ignite