I'm new to SwiftUI and I'm having problems with presenting Alerts back-to-back.
The description of the .alert(item:content:)
modifier has this written in it's definition:
/// Presents an alert.
///
/// - Parameters:
/// - item: A `Binding` to an optional source of truth for the `Alert`.
/// When representing a non-nil item, the system uses `content` to
/// create an alert representation of the item.
///
/// If the identity changes, the system will dismiss a
/// currently-presented alert and replace it by a new alert.
///
/// - content: A closure returning the `Alert` to present.
public func alert<Item>(item: Binding<Item?>, content: (Item) -> Alert) -> some View where Item : Identifiable
I'm particularly interested in the If the identity changes, the system will dismiss a currently-presented alert and replace it by a new alert
part. Since I want Alerts to be presented back-to-back, if I'm somehow able to change the 'identity', I'll be able to achieve the functionality that I want - which is having the system dismiss the currently-presented alert and replacing the old Alert with a new Alert (back-to-back).
If someone can explain to me what 'identity' is and how I can change the 'identity' of something I'll be extremely grateful.
(Or if you know a better way to present alerts back-to-back that'll also be very very helpful.)
Thanks in advance!