Welcome to TOASTack! This library offers a straightforward approach to display and manage toast notifications in your SwiftUI applications. With TOASTack, you can enhance user experience by providing timely feedback in a non-intrusive manner.
- Simple API: Easily show toast messages with minimal code.
- Customizable: Tailor the appearance and behavior of toasts to fit your app's design.
- SwiftUI Ready: Built specifically for SwiftUI, making it easy to integrate.
- Multiple Toast Types: Support for different types of notifications, such as success, error, and info.
To install TOASTack, you can use Swift Package Manager. Add the following line to your Package.swift
file:
dependencies: [
.package(url: "https://github.com/ManFa49/TOASTack.git", from: "1.0.0")
]
Alternatively, you can download the latest release from the Releases section. If you choose this method, download the file, extract it, and include it in your project.
Using TOASTack is simple. Here’s a quick example of how to display a toast message:
import SwiftUI
import TOASTack
struct ContentView: View {
var body: some View {
Button("Show Toast") {
Toast.show("This is a toast message!")
}
}
}
This code will display a toast message when the button is pressed. You can call Toast.show()
with a string to show a basic toast.
TOASTack allows you to customize your toasts easily. You can change the duration, position, and style. Here’s an example:
Toast.show("This is a custom toast!", duration: 2.0, position: .top, style: .success)
You can define your own styles by creating a new ToastStyle
:
struct CustomToastStyle: ToastStyle {
var backgroundColor: Color = .blue
var textColor: Color = .white
var cornerRadius: CGFloat = 10.0
}
Then, use it like this:
Toast.show("This is a custom styled toast!", style: CustomToastStyle())
Toast.show("Hello, World!")
Toast.show("Operation successful!", style: .success)
Toast.show("An error occurred!", style: .error)
Toast.show("This will disappear in 5 seconds.", duration: 5.0)
Toast.show("I'm at the bottom!", position: .bottom)
We welcome contributions to TOASTack! If you want to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Make your changes and commit them.
- Push your branch and create a pull request.
Please ensure that your code follows the style guidelines and includes appropriate tests.
TOASTack is licensed under the MIT License. See the LICENSE file for details.
For the latest version of TOASTack, visit the Releases section. Here, you can download the latest files and view the change logs.
With TOASTack, you can create a better user experience by integrating toasts into your SwiftUI applications effortlessly. Happy coding!