I have 2 values that track current values of types of benefits my users can purchase within the app. I want to update them in the purchaseViewController and use them in the previous view controller once the purchaseViewController is dismissed. I have tried to do this with both a protocol/delegate and a callback. However, I get essentially the same error with both saying "Instance member 'delegate/callback' cannot be used on type 'purchasesViewController'". This is my first time trying to pass data back and I've mainly just been following tutorials and may have missed a step along the way but I think its weird both methods get the same type of error.
Code on the parent view controller:
func sendBack(staticIncreases: Int, percentIncreases: Int) { //Protocol function
    self.avalibleIncreases = staticIncreases
    self.currentPercentIncreases = percentIncreases
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
    if segue.identifier ==  "improveFromOpen"{
        let next = segue.destination as! purchasesViewController
        next.currentPercentIncreases = currentPercentIncreases
        next.username = username
        next.avalibleIncreases = avalibleIncreases
        purchasesViewController.delegate = self //Error "Instance member 'delegate' cannot be used on type 'purchasesViewController'"
        purchasesViewController.callback = { result in //Error "Instance member 'delegate' cannot be used on type 'purchasesViewController'"
            self.avalibleIncreases = result[0]
            self.currentPercentIncreases = result[1]
        }
    }
Code on the purchaseViewController:
protocol updateBoosts {
    func sendBack(staticIncreases: Int, percentIncreases: Int)
}
class purchasesViewController: UIViewController {
    var delegate: updateBoosts? = nil
    var callback : (([Int])->())?
    var username: String!
    var currentPercentIncreases: Int!
    var avalibleIncreases: Int!
func sendBackVals(){
    if self.delegate != nil {
        self.delegate?.sendBack(staticIncreases: avalibleIncreases, percentIncreases: currentPercentIncreases)
    }
    let out = [avalibleIncreases!, currentPercentIncreases] as [Int]
    callback?(out)
}
override func viewWillDisappear(_ animated: Bool) {
    sendBackVals()
}
Any idea where my error is?
 
    