In table view cell i have an image and a button now i want to blur the image on the click of button
I have the following code :-
func blurEffect(){
let blur = UIBlurEffect(style: UIBlurEffectStyle.light)
let blurView = UIVisualEffectView(effect: blur)
var imageView = UIImageView()
blurView.frame = imageView.bounds
view.addSubview(blurView)
}
// I am Calling blur effect on at tick button action as below
@objc func tickButton(btn : UIButton){
blurEffect()
}
//In tableView
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = MealTableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! MealCell
cell.imgMeal.image = UIImage(named: mealImage[indexPath.row])
cell.btnTick.addTarget(self, action: #selector(MealPlanViewController.tickButton(btn:)), for: .touchUpInside)
return cell
}