Заменить
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "graphCell", for: indexPath) as! graphCell
с
let cell = collectionView.cellForItem(at:indexPath) as! graphCell
также это
let optSelected=cell.chooseBTN.title(for: .normal)
print(option)
if optSelected=="Sales"{
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "SalesVC") as! SalesVC
vc.buttonClicked = "Sales"; navigationController?.pushViewController(vc, animated: true)
}
else if optSelected=="Collection"{
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let vc = storyboard.instantiateViewController(withIdentifier: "SalesVC") as! SalesVC
vc.buttonClicked = "Collection"; navigationController?.pushViewController(vc, animated: true)
}
можно заменить на
let vc = storyboard.instantiateViewController(withIdentifier: "SalesVC") as! SalesVC
vc.buttonClicked = cell.chooseBTN.title(for: .normal)
navigationController?.pushViewController(vc, animated: true)