Skip to content
This repository has been archived by the owner on Aug 1, 2019. It is now read-only.

Crash when attempt to send collectionView. #193

Open
vandana26V opened this issue Mar 2, 2018 · 2 comments
Open

Crash when attempt to send collectionView. #193

vandana26V opened this issue Mar 2, 2018 · 2 comments

Comments

@vandana26V
Copy link

Below is the snippet of my code:

screen shot 2018-03-02 at 3 23 26 pm

let customView = ConvView.init().instanceFromNib() as! ConversationalUITableViewCell
let uiN: UINib = UINib(nibName: self.cellReuseIdentifier, bundle: nil)
customView.tableView?.register(uiN, forCellReuseIdentifier: self.cellReuseIdentifier)

  let convHeaderPrevView = ConversationWithPreviewUIView.init().instanceFromNib() as! ConversationWithPreviewTableViewCell
  
  convHeaderPrevView.label1?.text = "SomeText"
  convHeaderPrevView.label2?.text = "XYZ"
  convHeaderPrevView.label3?.text = "12345"
  
  self.headerView = convHeaderPrevView

  self.documentTableView = customView.tableView
  self.documentTableView.dataSource = self
  self.documentTableView.delegate = self
  
  self.documentTableView.rowHeight = UITableViewAutomaticDimension
  self.documentTableView.estimatedRowHeight =  50
  self.documentTableView.sectionHeaderHeight = UITableViewAutomaticDimension
  self.documentTableView.estimatedSectionHeaderHeight = 10
  self.documentTableView.sectionFooterHeight = 0

  self.documentTableView.reloadData()

  viewsArr.append(conversationView)
  viewsArr.append(conversationView)
  
  messengerView.addMessage(sendCollectionViewWithViews(viewsArr, numberOfRows: 1, isIncomingMessage: true), scrollsToMessage: true)
@akuzminskyi
Copy link

akuzminskyi commented Mar 5, 2018

Looks like if CollectionViewContentNode will be initialized with public init(withCustomViews customViews: [UIView], andNumberOfRows rows:CGFloat, bubbleConfiguration: BubbleConfigurationProtocol? = nil) method, collectionNodesDataSource is nil and in open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets we use force unwrapping for this variable, and that's why we have the crash.

@vandana26V
Copy link
Author

vandana26V commented Mar 6, 2018

So what is the solution for this?
Should I include collectionview datasource and delegate in my controller?

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

No branches or pull requests

2 participants