class MyCell: UICollectionViewCell { //@IBOutlet var img: UIImageView! //@IBOutlet var labelBez: UILabel! static let backgroundColor:UIColor = UIColor(red: 0.8, green: 0.8, blue: 0.6, alpha: 1) static let backgroundColorSelected:UIColor = UIColor(red: 0.2, green: 0.2, blue: 1, alpha: 1) static let textColor:UIColor = UIColor(red: 0.7, green: 0.4, blue: 0.4, alpha: 1) func markSelected(state:Bool){ if (state) { self.backgroundColor = MyCell.backgroundColor } else { self.backgroundColor = MyCell.backgroundColorSelected } } }