A lightweight and customizable toast notification library built with SwiftUI.
- ✅ SwiftUI native (ViewModifier based)
- ✅ Multiple toast styles (Success, Error, Warning, Info)
- ✅ Auto dismiss with duration
- ✅ Smooth animations
- ✅ Haptic feedback (iOS)
- ✅ Accessibility support (VoiceOver)
- ✅ iPhone & iPad support
- ✅ Zero dependencies
- Open your project in Xcode
- Go to File → Add Packages
- Enter:
https://github.com/ankush445/FancyToastKit.git
- Add the package to your target
After adding the package, import it in your file:
import FancyToastKit
⚠️ Make sure the module name matches your package target name (FancyToastKit)
@State private var toast: FancyToast?var body: some View {
ContentView()
.toastView(toast: $toast)
}toast = FancyToast(
type: .success,
title: "Success",
message: "Profile updated successfully!",
duration: 2.5
).success
.error
.warning
.info- Uses a
ViewModifierfor easy integration - Displays toast from the top
- Automatically dismisses after duration
- Cancels previous toast if a new one appears
- Includes smooth animation + transition
struct DemoView: View {
@State private var toast: FancyToast?
var body: some View {
VStack {
Button("Show Toast") {
toast = FancyToast(
type: .error,
title: "Error",
message: "Something went wrong"
)
}
}
.toastView(toast: $toast)
}
}F ancyToastKit/
│
├── Package.swift
├── README.md
│
└── Sources/
└── FancyToastKit/
├── FancyToastKit.swift
├── FancyToastView.swift
├── FancyToastModifier.swift
- Automatically announces toast message using VoiceOver
You can customize:
- Toast duration
- Colors (via
FancyToastStyle) - Layout inside
FancyToastView - Animation inside
FancyToastModifier
Pull requests are welcome! Feel free to open issues or suggest improvements.
MIT License
Ankush Mittal
If you like this project, give it a ⭐️ on GitHub!