SwiftToast

1.0.1

Lightweight and customizable SwiftUI library for displaying non-intrusive toast messages in your iOS/macOS applications.
matthew-2000/SwiftToast

What's New

SwiftToast v1.0.1 - Bug Fixes & Improvements

2025-03-20T10:35:06Z

SwiftToast v1.0.1 πŸ”§

πŸ“’ Minor update – Swift 5.8 compatibility

This release ensures compatibility with Swift 5.8, making SwiftToast more accessible for projects that have not yet migrated to Swift 6. No functionality changesβ€”just an update to improve flexibility and ease of integration!

πŸ†• What's new in v1.0.1?

βœ… Swift 5.8 support – Updated the package tools version to ensure broader compatibility
βœ… CI improvements – GitHub Actions now test with both Swift 5.8 and Swift 6

πŸ“¦ Installation

To update SwiftToast, modify your Swift Package Manager dependency:

.package(url: "https://github.com/your-username/SwiftToast.git", from: "1.0.1")

πŸ›  Enjoy the update and keep the feedback coming! πŸš€
⭐ If you like this project, don't forget to star the repository! 🌟

SwiftToast

Swift 5.8 License GitHub release PRs Welcome

πŸš€ About SwiftToast

SwiftToast is a lightweight and customizable SwiftUI library for displaying non-intrusive toast messages in your iOS/macOS applications. Designed for simplicity and flexibility, it allows you to show short notifications with custom styling and animations.

✨ Features

  • πŸ“Œ Easy to use: Simple API for quick integration
  • 🎨 Customizable: Change colors, fonts, durations, and positions
  • 🎭 Smooth animations: Fade, slide, bounce, and more
  • 🎯 Positioning: Show toast at the top or bottom of the screen
  • πŸ”„ Supports Swift Package Manager (SPM)

πŸ“¦ Installation

Using Swift Package Manager (SPM)

  1. Open your Xcode project.
  2. Go to File > Add Packages...
  3. Enter the following URL:
    https://github.com/matthew-2000/SwiftToast.git
    
  4. Choose Latest Version and click Add Package.

πŸ›  Usage

1️⃣ Basic Usage

To display a simple toast message:

import SwiftUI
import SwiftToast

struct ContentView: View {
    @State private var showToast = false
    
    var body: some View {
        VStack {
            Button("Show Toast") {
                showToast = true
            }
        }
        .toast(isPresented: $showToast, message: "Hello, SwiftToast!")
    }
}

2️⃣ Customization

You can customize the toast appearance, duration, and position:

.toast(
    isPresented: $showToast,
    message: "Customized Toast!",
    duration: 3,
    backgroundColor: .blue,
    textColor: .white,
    font: .headline,
    position: .top,
    animationStyle: .bounce
)

🎨 Customization Options:

Parameter Type Default Value Description
message String Required The toast text
duration TimeInterval 2 seconds How long the toast is visible
backgroundColor Color .black.opacity(0.8) Background color
textColor Color .white Text color
font Font .body Font style
position VerticalAlignment .bottom .top or .bottom
animationStyle ToastAnimationStyle .slide .fade, .slide, .bounce, .scale, .custom(...)

🎭 Animations

SwiftToast includes built-in animations, or you can add your own:

.toast(
    isPresented: $showToast,
    message: "Spring animation!",
    animationStyle: .spring(response: 0.5, dampingFraction: 0.6)
)

Available animations:

  • .fade β†’ Simple fade in/out
  • .slide β†’ Smooth slide transition
  • .bounce β†’ Spring-like bounce effect
  • .scale β†’ Scale-in effect
  • .custom(Animation) β†’ Use your own animation

βœ… Testing

To run unit tests:

swift test

Or, in Xcode: Cmd + U to run all tests.


🌟 Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature-name)
  3. Commit your changes (git commit -m "Add new feature")
  4. Push to the branch (git push origin feature-name)
  5. Open a pull request πŸš€

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


πŸ’‘ Credits

Developed by Matteo Ercolino β€’ GitHub


πŸ“’ Support

If you find this project useful, ⭐️ star the repository and share it with others!


πŸš€ Happy coding with SwiftToast! πŸŽ‰

Description

  • Swift Tools 5.8.0
View More Packages from this Author

Dependencies

  • None
Last updated: Fri May 16 2025 11:45:18 GMT-0900 (Hawaii-Aleutian Daylight Time)