0 Replies
      Latest reply on Apr 2, 2020 4:16 PM by quintetsolutions
      quintetsolutions Level 1 Level 1 (0 points)

        We have implemented a code to add a link to the whole attributed text inside a UITextView.


        The strings we are loading are:

        English String: "Click Here To View"

        Arabic String:  {some Arabic text}



        func setupTextView() {

        let mutableAttributedString = NSMutableAttributedString(string: "")

        let attributedString = NSAttributedString(string: {string value}, attributes: [NSAttributedString.Key.foregroundColor:Colors.gray_3_748499])

        mutableAttributedString.append(attributedString) mutableAttributedString.addAttribute(NSAttributedString.Key.link, value: "https://www.google.com", range: NSMakeRange(0, self.attributedString.length))

        self.textView.attributedText = mutableAttributedString



        We can see that the delegate


        textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction)

        is not called when the text added in the text view in Arabic language.

        For all other languages (left to right) the delegate gets fired.



        Looking forward for valuable suggestions.