Install Toasts in your SwiftUI App
mainTo use toast notifications, you must first install the toast system in your application's root view using the .installToast(position:) modifier. This sets up the necessary environment to present toasts throughout your view hierarchy. You can specify the preferred position, such as .bottom.
import SwiftUI
import Toasts
@main
struct MyApp: App {
var body: some Scene {
WindowGroup {
ContentView()
.installToast(position: .bottom)
}
}
}