linkedin / Hakawai

A powerful, extensible UITextView.
Apache License 2.0
782 stars 115 forks source link

How to get CustomModel in place of HKWMentionsAttribute #237

Open ParagDevac opened 2 years ago

ParagDevac commented 2 years ago

Currently i have implemented it , but when i get mention from plugin.mention() i am getting as [HKWMentionsAttribute]. Actually , here i need more data from my [MentionsEntity]. So, is it possible to get data as [MentionsEntity] in place of HKWMentionsAttribute ?

var myDict = [String:[String]]() //Here i am getting [HKWMentionsAttribute] but i need as [MentionsEntity] if let mPlug = plugin , let ment = mPlug.mentions() as? [MentionsEntity] , ment.count > 0 {

        ment.enumerated().forEach { (index , mentionedEntity) in
            if mentionedEntity.entityMentionedType() == "user" {
                myDict["user_ids"]?.append(mentionedEntity.entityId())

            } else if mentionedEntity.entityMentionedType() == "garba_class" {
                myDict["class_ids"]?.append(mentionedEntity.entityId())
            }
        }

    }

please help me . Thank you .