I have a section of text where I am using .replacingOccurrences to display the users' answer within the question sentence:
Text((question.text)
.replacingOccurrences(of: "_____", with:
question.answers[question.userAnswer]
))
.font(Font.custom("ClearSans-Bold", size: 18))
.foregroundColor(.black )
.padding(.bottom, 20)
.multilineTextAlignment(.center)
I want the users' answer question.answers[question.userAnswer]
to be a different colour (red/green) to the main body of the text (similar to attached image) however I'm new to SwiftUI so not sure how to add this in.