Post

Replies

Boosts

Views

Activity

Comment on Custom Modifier Using Text's underline(_:color:)
This does not seem to work with @State inside the TextModifier implementation. e.g. something like: struct HulkSmash: TextModifier {   @State var isHulk: Bool = false   func body(text: Text) -> some View {     text.bold()       .font(isHulk ? .system(.largeTitle, design: .rounded) : .body)       .foregroundColor(isHulk ? .init(.systemGreen) : .init(.systemFill))       .onTapGesture {         print("tap triggered")         isHulk.toggle()       }   } } Do you have any idea why that would be the case?
Oct ’21