<commit_before>//
//  DestinationReviewUserRowDelegate.swift
//  CascadingTableDelegate
//
//  Created by <NAME> on 11/2/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import CascadingTableDelegate

struct DestinationReviewUserRowViewModel {
	let userName: String
	let userReview: String
	let rating: Int
}

class DestinationReviewUserRowDelegate: CascadingBareTableDelegate {
	
	/// Cell identifier that will be used by this instance. Kindly register this on section-level delegate that will use this class' instance.
	static let cellIdentifier = DestinationReviewUserCell.nibIdentifier()
	
	fileprivate var viewModel: DestinationReviewUserRowViewModel?
	
	convenience init(viewModel: DestinationReviewUserRowViewModel) {
		self.init(index: 0, childDelegates: [])
		self.viewModel = viewModel
	}
	
}

extension DestinationReviewUserRowDelegate {		
	
	override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
		
		let identifier = DestinationReviewUserRowDelegate.cellIdentifier
		return tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath)
	}
	
	func tableView(_ tableView: UITableView, heightForRowAtIndexPath indexPath: IndexPath) -> CGFloat {
		
		let userReview = viewModel?.userReview ?? ""
		return DestinationReviewUserCell.preferredHeight(userReview: userReview)
	}
	
	func tableView(_ tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: IndexPath) -> CGFloat {
		
		return DestinationReviewUserCell.preferredHeight(userReview: "")
	}
	
	func tableView(_ tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: IndexPath) {
		
		guard let cell = cell as? DestinationReviewUserCell,
			let viewModel = viewModel else {
			return
		}
		
		cell.configure(
			userName: viewModel.userName,
			userReview: viewModel.userReview,
			rating: viewModel.rating
		)
		
		let lastRow = (index + 1) == parentDelegate?.childDelegates.count
		
		cell.hideBottomBorder = lastRow
	}
}<commit_msg>Update DestinationReviewUserRowDelegate's UITableViewDataSource and Delegate methods with @objc declaration<commit_after>//
//  DestinationReviewUserRowDelegate.swift
//  CascadingTableDelegate
//
//  Created by <NAME> on 11/2/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import Foundation
import CascadingTableDelegate

struct DestinationReviewUserRowViewModel {
	let userName: String
	let userReview: String
	let rating: Int
}

class DestinationReviewUserRowDelegate: CascadingBareTableDelegate {
	
	/// Cell identifier that will be used by this instance. Kindly register this on section-level delegate that will use this class' instance.
	static let cellIdentifier = DestinationReviewUserCell.nibIdentifier()
	
	fileprivate var viewModel: DestinationReviewUserRowViewModel?
	
	convenience init(viewModel: DestinationReviewUserRowViewModel) {
		self.init(index: 0, childDelegates: [])
		self.viewModel = viewModel
	}
	
}

extension DestinationReviewUserRowDelegate {		
	
	@objc override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
		
		let identifier = DestinationReviewUserRowDelegate.cellIdentifier
		return tableView.dequeueReusableCell(withIdentifier: identifier, for: indexPath)
	}
	
	@objc func tableView(_ tableView: UITableView, heightForRowAtIndexPath indexPath: IndexPath) -> CGFloat {
		
		let userReview = viewModel?.userReview ?? ""
		return DestinationReviewUserCell.preferredHeight(userReview: userReview)
	}
	
	@objc func tableView(_ tableView: UITableView, estimatedHeightForRowAtIndexPath indexPath: IndexPath) -> CGFloat {
		
		return DestinationReviewUserCell.preferredHeight(userReview: "")
	}
	
	@objc func tableView(_ tableView: UITableView, willDisplayCell cell: UITableViewCell, forRowAtIndexPath indexPath: IndexPath) {
		
		guard let cell = cell as? DestinationReviewUserCell,
			let viewModel = viewModel else {
			return
		}
		
		cell.configure(
			userName: viewModel.userName,
			userReview: viewModel.userReview,
			rating: viewModel.rating
		)
		
		let lastRow = (index + 1) == parentDelegate?.childDelegates.count
		
		cell.hideBottomBorder = lastRow
	}
}
{'fraction_non_alphanumeric': 0.07530981887511916, 'fraction_numerical': 0.005243088655862726, 'mean_word_length': 5.0914368650217705, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3145076', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1152, 'n_words': 308}