Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class HotelAvailableRoomsTVCell: UITableViewCell {
- @IBOutlet weak var collectionView: UICollectionView!
- //MARK: Life cycle
- override func awakeFromNib() {
- super.awakeFromNib()
- let nib = UINib.init(nibName: "AvailableRoomCVCell", bundle: nil)
- collectionView.register(nib, forCellWithReuseIdentifier: "AvailableRoomCVCell")
- collectionView.delegate = self
- collectionView.dataSource = self
- // Initialization code
- }
- func initCellWithData(roomJSON:JSON,indexPath:IndexPath,isSingle:Bool) {
- DispatchQueue.main.async {
- self.collectionView.reloadData()
- }
- }
- }
- In viewController:
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = tableView.dequeueReusableCell(withIdentifier: "HotelAvailableRoomsTVCell", for: indexPath) as! HotelAvailableRoomsTVCell
- cell.delegate = self
- cell.initCellWithData(roomJSON: (json)!, indexPath: indexPath as IndexPath, isSingle: true)
- return cell;
- }
Add Comment
Please, Sign In to add comment