Interpolating Text with SFSymbol in Swiftui

65 views Asked by At

I would like to interpolate a text with a pallete colored SFSymbol in swiftui. Is there a way I can do this?

Currently I receive an error: 'appendInterpolation' is unavailable: Unsupported type for interpolation, see LocalizedStringKey.StringInterpolation for supported types.

Thus, I am not sure is possible yet. I know that is possible with no properties like: Text("Hello \(Image(systemName: "person.3.sequence.fill"))")

What I am trying to achieve:

import SwiftUI

struct ContentView: View {

var body: some View {
    var aux = Image(systemName: "person.3.sequence.fill")
                  .symbolRenderingMode(.palette)
                  .foregroundStyle(.red, .green, .blue)
    return Text("Hello \(aux)")
}

}

0

There are 0 answers