Closed sharvanksapient closed 1 year ago
I used Atributika and it is not supported SwiftUI and text is not showing.
func makeUIView(context: UIViewRepresentableContext) -> UIView { let view = UIView(frame: .zero) view.backgroundColor = .yellow let label = AttributedLabel() label.numberOfLines = 0 label.backgroundColor = .red label.lineBreakMode = .byWordWrapping label.font = type.font label.attributedText = text .attributedText(for: type, alignment: alignment, textColor: textColor, linkColor: linkColor) label.clipsToBounds = true label.sizeToFit() view.addSubview(label) label.translatesAutoresizingMaskIntoConstraints = false label.heightAnchor.constraint(equalTo: view.heightAnchor).isActive = true label.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true return view }
func updateUIView(_ label: UIView, context: UIViewRepresentableContext<AtributikaView>) { }
Please check the SwiftUI example in the recent release
I used Atributika and it is not supported SwiftUI and text is not showing.
func makeUIView(context: UIViewRepresentableContext) -> UIView {
let view = UIView(frame: .zero)
view.backgroundColor = .yellow
let label = AttributedLabel()
label.numberOfLines = 0
label.backgroundColor = .red
label.lineBreakMode = .byWordWrapping
label.font = type.font
label.attributedText = text
.attributedText(for: type, alignment: alignment, textColor: textColor, linkColor: linkColor)
label.clipsToBounds = true
label.sizeToFit()
view.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false label.heightAnchor.constraint(equalTo: view.heightAnchor).isActive = true label.widthAnchor.constraint(equalTo: view.widthAnchor).isActive = true return view }