Back to Library
Snackbar Component

Snackbar Component

by Luiz Mello

@luizmellodev
notificationtoastanimation

Description

A fully-featured snackbar/toast notification component with multiple types (success, error, warning, info), customizable positions (top/bottom), actions, and animations. Includes a global SnackbarManager for app-wide notifications.

SwiftUI Code

8 files • Scroll to see all →
public enum SnackbarType {
    case success
    case error
    case warning
    case info
    case custom(backgroundColor: Color, iconColor: Color)
    
    var backgroundColor: Color {
        switch self {
        case .success: return .green
        case .error: return .red
        case .warning: return .orange
        case .info: return .blue
        case .custom(let backgroundColor, _): return backgroundColor
        }
    }
    
    var iconColor: Color {
        switch self {
        case .success, .error, .warning, .info: return .white

// ... (click "Show full code" to see more)
Viewing: SnackbarType.swift1 of 8