Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import UIKit
- class MarketTableViewCell: UITableViewCell {
- @IBOutlet weak var mkCollectionView: UICollectionView!
- }
- extension MarketTableViewCell {
- func setCollectionViewDataSourceDelegate<D: UICollectionViewDataSource & UICollectionViewDelegate>(_ dataSourceDelegate: D, forRow row: Int) {
- mkCollectionView.delegate = dataSourceDelegate
- mkCollectionView.dataSource = dataSourceDelegate
- mkCollectionView.tag = row
- mkCollectionView.setContentOffset(mkCollectionView.contentOffset, animated:false)
- mkCollectionView.reloadData()
- }
- var collectionViewOffset: CGFloat {
- set { mkCollectionView.contentOffset.x = newValue }
- get { return mkCollectionView.contentOffset.x }
- }
- }
Add Comment
Please, Sign In to add comment