D. Finna D. Finna - 1 year ago 87
iOS Question

Error when adding cell delegate to class - swift

Why do I get an error, when I add this code?:

, myProfileWorkoutTableViewCellDelegate

To my class?:

class myProfileTableViewController: UITableViewController, UICollectionViewDataSource, UICollectionViewDelegate, myProfileWorkoutTableViewCellDelegate {

This is the beginning of my

import UIKit
import Firebase
import FirebaseDatabase

protocol myProfileWorkoutTableViewCellDelegate {
func watchTrainingPressed(cell: myProfileWorkoutTableViewCell)

class myProfileWorkoutTableViewCell: UITableViewCell {

and this is my button inside the cell:

@IBAction func watchTrainingPressed(sender: AnyObject) {
if let _ = delegate {

Answer Source

You need to implement the function

func watchTrainingPressed(cell: myProfileWorkoutTableViewCell)

inside your myProfileTableViewController class.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download