Skip to content

Laggy scrolling with AttributedTextView inside tableViewCell #16

@daurenm

Description

@daurenm

Hi there,

Seems like AttributedTextView.attributer.setter takes too much time while blocking main thread.

screen shot 2018-03-31 at 12 49 29 pm

Is there anything we can do to make it faster? Seems like right now, it requires main thread, so I can't simply put in a background thread :(

        let userName = "daurenmuratov"
        let comment = "\(userName):"
            .font(UIFont.systemFont(ofSize: 14, weight: .bold))
            .match(userName)
            .color(.black)
            .makeInteract({ (userLogin) in
                print("Login pressed: \(userLogin)")
            })
            + (" \(text)")
                .font(UIFont.systemFont(ofSize: 14))
                .color(.gray)
                .matchHashtags.color(.red)
                .makeInteract({ (hashtag) in
                    print("Hashtag pressed: \(hashtag)")
                })
                .matchMentions
                .makeInteract({ (mention) in
                    print("Mention pressed: \(mention)")
                })
                .matchLinks
                .makeInteract({ (link) in
                    print("Link pressed \(link)")
                })
                .setLinkColor(.blue)
            textView.attributer = comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions