How do you pass a string that contains an Image in SwiftUI?
This works:
struct ContentView: View {
var body: some View {
Text("\(Image(systemName: "apple.logo")) Sign in with Apple")
.padding()
}
}
This does not work:
struct ContentView: View {
var text = "\(Image(systemName: "apple.logo")) Sign in with Apple"
var body: some View {
Text(text)
.padding()
}
}
If I try to pass the string as a stored variable SwiftUI doesn't show the image.