SwiftUI: Multiple alerts in a single view

preview_player
Показать описание
In this video you will learn how to add more than one alert in the SwiftUI view.

The deployment target in this sample project is set to iOS 16.1. I will make an update if anything will change in the future versions of SwiftUI 👍

00:00 Intro
00:16 Sample project
01:36 Let's add another alert
03:40 Two alerts on the same view
05:04 Connect the alert to a different view
06:12 ZStack trick
06:55 Outro

#iOS #SwiftUI

Music: Streambeats
Рекомендации по теме
Комментарии
Автор

Great video, thanks!
I noticed the same several months ago and as a workaround, you can use a custom state to present alert(s) which describes all required options that you're going to use OR it might not be the best idea to use the Alert struct from SwiftUI AND then bind only once per view to the state

bohdans
Автор

What's the deployment target for this project? I was under the impression that this was changed in iOS 16 🤔 Great video, Mike!

FloWritesCode
Автор

Very interesting video.
To my mind, that is a bug in SwiftUI. There may be some logical reason but it would come out of the way alert is implemented and the underlying structure of SwiftUI. But SwiftUI should be as helpful as possible, and not have unexpected limitations.

markaurelius