ios - JSQMessageBubble Doesn't resize properly while using realm datasource -


hi migrating 1 of existing app use realm. app uses jsqmessagesviewcontroller chat ui. made necessary changes in app supports realm.

but, stuck 1 problem whenever use realm object datasource jsqmessagesviewcontroller, chat bubbles start behave in weird way. bubbles doesn't resize according message's text. see below screenshot.message bubble doesn't resize

i found in 1 of issue thread of jsqmessageviewcontroller, instances others had faced similar issue - cells don't fill whole width. according them if implement messagehash() function in realm model should fix issue.

i have implemented messagehash() function required method of jsqmessagedata protocol, still facing issue.

here's realm model:

class textmessageitem: object, jsqmessagedata, mappable {      // mark: persisted properties     dynamic var messageid = uuid().uuidstring     dynamic var messagetext: string?     dynamic var messagefrom = ""     dynamic var messagedatetime = date()     dynamic var fromname: string?     dynamic var avatarurl: string?     dynamic var messageto = ""     dynamic var isincoming = false      // mark: init     convenience required init?(map: map) {         self.init()     }      convenience init(messagetext: string?, messagefrom: string, messagedatetime: date? = date(), fromname: string?, avatarurl: string?, messageto: string) {         self.init()         self.messagetext = messagetext         self.messagefrom = messagefrom         self.messagedatetime = messagedatetime!         self.fromname = fromname         self.avatarurl = avatarurl         self.messageto = messageto     }      // mark: jsqmessagedata methods     func text() -> string {         return messagetext!     }      func senderid() -> string {         return messagefrom     }      func date() -> date {         return messagedatetime     }      func senderdisplayname() -> string {         return fromname!     }      func ismediamessage() -> bool {         return false     }      func messagehash() -> uint {         print(self.hash)         return uint(self.hash)     } } 

it'd great if can pointers on how fix issue. thank you.


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -