Last active
October 10, 2020 16:58
-
-
Save Slowhand0309/192f5316d4e8c081f52b7341076c45d5 to your computer and use it in GitHub Desktop.
UICollectionView in UITableView
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ItemTableViewCell: UITableViewCell { | |
@IBOutlet weak var collectionView: UICollectionView! { | |
didSet { | |
let nib = UINib(nibName: "ItemCollectionViewCell", bundle: nil) | |
collectionView.register(nib, forCellWithReuseIdentifier: "ItemCollectionViewCell") | |
} | |
} | |
override func awakeFromNib() { | |
super.awakeFromNib() | |
// Initialization code | |
} | |
override func setSelected(_ selected: Bool, animated: Bool) { | |
super.setSelected(selected, animated: animated) | |
// Configure the view for the selected state | |
} | |
func set<T: UICollectionViewDelegate & UICollectionViewDataSource>(collectionDataSourceDelegate: T) { | |
collectionView.delegate = collectionDataSourceDelegate | |
collectionView.dataSource = collectionDataSourceDelegate | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment