var nameArrays = [
1: ["twitter", "twitter", "", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter"],
2: ["twitter", "twitter", "", "twitter", "", "", "", "", "", "", "", "twitter", "", "", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter", "twitter"]
]
extension ViewController: UICollectionViewDelegate,UICollectionViewDataSource,UICollectionViewDelegateFlowLayout {
func numberOfSections(in collectionView: UICollectionView) -> Int {
return nameArrays.keys.count
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return nameArrays.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell: IconCell = collectionView.dequeueReusableCell(withReuseIdentifier: cellName, for: indexPath) as! IconCell
let holdGesture = UILongPressGestureRecognizer()
holdGesture.addTarget(self, action: #selector(longPress))
holdGesture.minimumPressDuration = 0.5
cell.addGestureRecognizer(holdGesture)
cell.backgroundColor = .clear
// cell.appIcon.image = UIImage.init(named: nameArrays.values[indexPath.section][indexPath.row])
cell.appName.text = nameArrays.values[0][0]
return cell
}