-
-
Save jasdev/e765d7410c432af94170b02630fa5039 to your computer and use it in GitHub Desktop.
Identifiable conformance backed by a Self.self expression.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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