Closed svenoaks closed 1 year ago
I just added view extension and seems to work with single ".toast" modifier `
@ViewBuilder func toast(isPresenting: Binding<Bool>,
duration: Double = 2,
tapToDismiss: Bool = true,
offsetY: CGFloat = 0,
displayMode: AlertToast.DisplayMode,
alertType: AlertToast.AlertType,
title: String? = nil,
subtitle: String? = nil,
alertStyle: AlertToast.AlertStyle? = nil,
onTap: (() -> ())? = nil, completion: (() -> ())? = nil) -> some View {
modifier(AlertToastModifier(isPresenting: isPresenting,
duration: duration,
tapToDismiss: tapToDismiss,
offsetY: offsetY,
alert: { AlertToast(displayMode: displayMode,
type: alertType,
title: title,
subTitle: subtitle,
style: alertStyle) },
onTap: onTap,
completion: completion))
}
`
Is your feature request related to a problem? Please describe. There is only a
toast(isPresenting: Binding<Bool>...)
function. It is cumbersome to add multiple messages and/or multiple message types.Describe the solution you'd like There should be a
toast<Item>(item: Binding<Item?>...)
function that allows defining the message in the item. This would be similar to several SwiftUI apis like alert(item:..). When the item changes the alert is displayed.Describe alternatives you've considered If we want to add multiple messages and/or have multiple message type, we must have multiple calls of toast(), or some other redundancy to allow this.