I've been looking around stackoverflow a lot and reading a lot of different questions related to delegation but I haven't been able to work my problem out yet. I am trying to have my stepperAction (which is inside of a tableview cell) change a label in my BuyStats class every time its clicked. But so far, clicking the stepper has no effect. I think I need something in BuyStats.viewDidLoad() to set the delegate somehow but I'm not getting it. This may be easy for someone. Thanks for any help.
protocol SetRemainingValue : class {
func setValue(amount: Double)
}
}
//
class BuyStatsCell: UITableViewCell{
weak var setRemaining : SetRemainingValue?
@IBAction func stepperAction(_ sender: UIStepper) {
setRemaining?.setValue(amount: sender.value)
}
//
class BuyStats: UIViewController, SetRemainingValue {
@IBOutlet weak var spendAmount: UILabel!
override func viewDidLoad(){
}
func setValue(amount: Double) {
spendAmount.text = amount
}
}