Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Identifiable conformance backed by a Self.self expression.
import Foundation
import SwiftUI
struct AlertData: Identifiable {
let id = String(describing: Self.self)
var message: String
struct ScratchView: View {
var body: some View {
Circle() // For sake of example.
.alert(item: .constant(AlertData(message: "Hi!"))) { alertData in
Alert(title: Text(alertData.message))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment