Post

Replies

Boosts

Views

Activity

Why does my updateUIView change state at the same time
struct UIkitTextView: UIViewRepresentable {       @Binding var isBold: Bool   @Binding var isItalics: Bool       func makeUIView(context: Context) -> UITextView {     let view = UITextView()     view.text = "Defutl"     view.font = UIFont.systemFont(ofSize: 24)           return view   }       func updateUIView(_ uiView: UITextView, context: Context) {     uiView.toggleBoldface(isBold ? self : nil)     uiView.toggleItalics(isItalics ? self : nil)   }       typealias UIViewType = UITextView } When isBool = true, modify the font Bold. But when isBool changes, isItalics will also change, WHY? ? ?
1
0
437
Jan ’21