'Autocomplete height reacts but stays blank

enter image description here

Hello, when completing it with the prefix "#" the table appears but is blank.

here are the concerned chunk of code :

class types:

class Chat:MessagesViewController, MessagesDataSource, MessagesLayoutDelegate, MessagesDisplayDelegate,InputBarAccessoryViewDelegate,AutocompleteManagerDataSource, AutocompleteManagerDelegate

autocomplete variable:

open lazy var autocompleteManager: AutocompleteManager = { [unowned self] in
      let manager = AutocompleteManager(for: self.messageInputBar.inputTextView)
      manager.delegate = self
      manager.dataSource = self
      return manager
  }()

viewdidload for autocomplete:

    autocompleteManager.register(prefix: "#", with: mentionTextAttributes)
    autocompleteManager.maxSpaceCountDuringCompletion = 1

Here are the different methods for autocomplete, all of them are called and we can see what is printed except for one which i guess is the issue:

CALLED:

    func autocompleteManager(_ manager: AutocompleteManager, shouldBecomeVisible: Bool) {
        setAutocompleteManager(active: shouldBecomeVisible)
    }
func setAutocompleteManager(active: Bool) {
            let topStackView = messageInputBar.topStackView
            if active && !topStackView.arrangedSubviews.contains(autocompleteManager.tableView) {
                topStackView.insertArrangedSubview(autocompleteManager.tableView, at: topStackView.arrangedSubviews.count)
                topStackView.layoutIfNeeded()
            } else if !active && topStackView.arrangedSubviews.contains(autocompleteManager.tableView) {
                topStackView.removeArrangedSubview(autocompleteManager.tableView)
                topStackView.layoutIfNeeded()
            }
        messageInputBar.invalidateIntrinsicContentSize()
        }
    
  ```
func autocompleteManager(_ manager: AutocompleteManager, shouldRegister prefix: String, at range: NSRange) -> Bool {
return true
}

NOT CALLED AND ISSUE:

 func autocompleteManager(_ manager: AutocompleteManager, tableView: UITableView, cellForRowAt indexPath: IndexPath, for session: AutocompleteSession) -> UITableViewCell {
    guard let cell = tableView.dequeueReusableCell(withIdentifier: AutocompleteCell.reuseIdentifier, for: indexPath) as? AutocompleteCell else {
    fatalError("None ")
    }
    let users = Users
    let name = session.completion?.text ?? ""
    let user = users.filter { return $0.displayName == name }.first
    cell.imageView?.image = UIImage(named: "art.scnassets/imp.png")
    cell.textLabel?.attributedText = manager.attributedText(matching: session, fontSize: 15)
    return cell
    }

Can anyone please advise Thank you



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source