everyone. I am trying to show NSAttributedString in SwiftUI. Since SwiftUI doesn't have any controls capable of it,
I am trying to use UIKit controls, wrapped in UIViewRepresentable. I've tried to use UILabel, but it doesn't handle hyperlinks.
I've tried to use UITextView (isScrollEnabled = false) but in this case text isn't broken into lines (see screenshot). When isScrollEnabled is set to true,
UITextView is displayed correctly, but I don't want any scroll.
I would be very glad to hear any suggestions.
Update: I get text from the server and I need to apply different format to different (but often intersecting!) parts of text. For example: Characters [0, 10] should be bold, characters [5, 10] should be a link, etc. I'd hate to do the parsing manually and check that no part of text is repeated. NSAttributedString has a method string.addAttribute(.font, value: font, range: NSRange(location: 0, length: 10))
Update 2: We support iOS 14+