Not showing Attributes top, bottom

Open
#1,822 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
swift
Domain
mobile

Research direction

Start with the shown cellTopLabelHeight(for:at:in:) and cellTopLabelAttributedText(for:at:) implementations, then read the MessageKit message-cell label configuration and layout flow. Reproduce the reported display-name layout on the iPhone 14 Pro Max setup and compare it with the referenced screenshots. Done means the sender display name appears in the intended top-label position and styling.

Written by the indexing model from the issue text.

Description

question
       ChatNetworkService.uploadMessage(page: 0) { [weak self] (result) in
            guard let self = self else { return }
            switch result {
            case .success(let data):
                data.list?.forEach({ chat in
                    if chat.mine == false {
                        self.selfSender = Sender(photoURL: "",
                                                 senderId: "0",
                                                 displayName: chat.clientName ?? "")
                    } else {
                        self.selfSender = Sender(photoURL: "",
                                                 senderId: chat.clientID ?? "",
                                                 displayName: chat.clientName ?? "")
                    }
                    let att = NSAttributedString(string: chat.message ?? "")
                    print(self.selfSender)
                    self.messages.append(Message(sender: self.selfSender,
                                                 messageId: chat.id?.description ?? "",
                                                 sentDate: Date(),
                                                 kind: .attributedText(att)))
                })
                DispatchQueue.main.async {
                    self.messagesCollectionView.reloadData()
                }
                print("success")
            case .failure(let error):
                switch error {
                case .standard(_, let model):
                    print("Standard")
                case .technical(let title, let description):
                    print("HELLO WORLD TECHNICAL \(title) \(description) ")
                case .unexpected(let description, _, _):
                    print("HELLO WORLD UNEXPECTED \(description) ")
                default:
                    break
                }
            }
        }

I have this code for appending data to message I have a layout like this:
Simulator Screen Shot - iPhone 14 Pro Max - 2023-12-06 at 00 29 14

func cellTopLabelHeight(for message: MessageType, at indexPath: IndexPath, in messagesCollectionView: MessagesCollectionView) -> CGFloat {
20
}

func cellTopLabelAttributedText(for message: MessageType, at indexPath: IndexPath) -> NSAttributedString? {
    return NSAttributedString(string: message.sender.displayName)
}

if I am writing this code its showing display name but not like on cell example, screenshot above:
Simulator Screen Shot - iPhone 14 Pro Max - 2023-12-06 at 00 28 13

last version of MessageKit
Xcode version: 14.2

Dominant language
Swift
Stars
6.3k
Forks
1.2k
Avg merge
12h 4m
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from MessageKit/MessageKit

All issues in MessageKit/MessageKit

Similar issues

More Swift issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.