Post

Replies

Boosts

Views

Activity

Custom Modifier Using Text's underline(_:color:)
I have a custom modifier which is only used on a Text view. I want to include an underline call in it, but get an error. My understanding is that this is because underline is unique to Text views whereas the ViewModifier protocol isn't.Is there a way to specify this?struct activeEquationString: ViewModifier { let termInd: Int @Binding var currentInd: Int func body(content: Content) -> some View { content .underline(currentInd == termInd) // <-- Value of type 'activeEquationString.Content' (aka '_ViewModifier_Content<activeEquationString>') has no member 'underline' .foregroundColor(currentInd == termInd ? Color.black : Color.gray) } }
7
0
3.7k
May ’20