Contents

rjiosdev/toastifyswift

Elegant SwiftUI library for customizable **Toast Notifications** and **Custom Alerts**

πŸ“Έ Demo

[ToastifySwift Demo]


✨ Features

  • βœ… Show toasts with message, icon, color, and auto-dismiss timer
  • βœ… Custom alerts with two buttons (e.g., Yes/No, Continue/Cancel)
  • βœ… Fully customizable appearance (colors, duration, background)
  • βœ… Designed for reusability β€” use in any SwiftUI project
  • βœ… Cross-platform ready (iOS, macOS, watchOS, tvOS)

πŸ“¦ Installation (Swift Package Manager)

Add this URL to Xcode: https://github.com/RJIOSDEV/ToastifySwift

Or in Package.swift:

.package(url: "https://github.com/RJIOSDEV/ToastifySwift", from: "1.0.0")

##

Or COCOAPODS
pod 'ToastifySwift', '~> 1.0.3'


---

πŸ§‘β€πŸ’» Usage

Show a Toast

@StateObject var toastManager = ToastManager()

.toastify(using: toastManager)

toastManager.show(toast: ToastModel(
    message: "Saved successfully!",
    icon: "checkmark.circle.fill",
    backgroundColor: .green,
    duration: 2.5
))

.customAlert(
    isPresented: $showStandardAlert,
    title: "Standard Alert",
    message: "This is a standard alert.",
    primary: AlertActionButton(title: "OK", background: .blue) {
        // Your action
    },
    secondary: AlertActionButton(title: "Cancel", background: .gray) {
        // Your action
    },
    style: .normal // Only .normal remains
)


---

πŸ“š Documentation

ToastManager

A shared ObservableObject that triggers toast messages globally.

@StateObject var toastManager = ToastManager()

Package Metadata

Repository: rjiosdev/toastifyswift

Default branch: main

README: README.md