Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not showing Attributes top, bottom #1822

Open
anvar0522 opened this issue Dec 5, 2023 · 0 comments
Open

Not showing Attributes top, bottom #1822

anvar0522 opened this issue Dec 5, 2023 · 0 comments
Labels

Comments

@anvar0522
Copy link

anvar0522 commented Dec 5, 2023

       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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant