elai950 / AlertToast

Create Apple-like alerts & toasts using SwiftUI
https://elai950.github.io/AlertToast/
MIT License
2.08k stars 187 forks source link

toast<Item>(item: Binding<Item?>, content: (Item) -> AlertToast) modifier #49

Closed ekurutepe closed 1 year ago

ekurutepe commented 2 years ago

iOS 15.5 removed the alert<Item>(item: Binding<Item?>, content: (Item) -> Alert) modifier which was super useful to construct an Alert based on the item wrapped by the Binding.

the replacement alert(isPresented: Bool) variants are not as powerful.

It would be really cool to add the item based modifier to AlertToast to enable a straight forward replacement. I can attempt to build it if there is interest and nobody else is working on it.

elai950 commented 1 year ago

Hey @ekurutepe , Thank you for your suggestion. Apple have a very specific definition for the word Alert in Apple's systems which is more like those permissions alert views that pop up. Therefore, renaming the toast modifier name to alert can be quite confusing for some developers.

You're more than welcome to fork the library and refactor the toast view modifier name to alert but for this library, I think it would be best to have a clear separation between Apple's and mine definitions.

ekurutepe commented 1 year ago

I guess I did not express my idea clearly enough. I wasn't suggesting to use the same naming but a replacement API to fill the same role so that an item binding can be passed in to populate the contents of the presented toast.

But does not matter for us anymore. We ended up killing the project where we were using AlertToast. Maybe somebody will have the same need and pick this up in the future.

Cheers and keep up the great work.