Attachments in Chat
Overview
A custom chat view controller used to show chat screen with image & file upload.
Topics:
Add selectors to file and image button, on tap of file and image buttons we can open respective pickers like follows:
 @objc func addFileButtonTapped() {
  var filePicker: UIDocumentPickerViewController
  if #available(iOS 14.0, *) {
      filePicker = UIDocumentPickerViewController(forOpeningContentTypes: [.pdf, .text, .plainText, .audio, .video, .movie, .image, .livePhoto], asCopy: false)
  } else {
      filePicker = UIDocumentPickerViewController(documentTypes: [], in: .import)
  }
  messageTextView.resignFirstResponder()
  filePicker.delegate = self
  present(filePicker, animated: true, completion: nil)
}
@objc func addImageButtonTapped() {
  messageTextView.resignFirstResponder()
  imagePicker.delegate = self
  imagePicker.sourceType = .photoLibrary
  present(imagePicker, animated: true, completion: nil)
}
Implement delegates of pickerViews and once you have path to image/file this can be sent using
meeting.chat.sendFileMessage(filePath: selectedFileURL.path)