Help needed ;-;

lilkiwi

Kiwi

Posted on July 29, 2021

Help needed ;-;

import UIKit

class ItemTableViewCell: UITableViewCell {

@IBOutlet weak var stepperText: UILabel!

@IBOutlet weak var priceLabel: UILabel!

var item : Item! // this is a view controller class that have the item data .. price as a double (var price: Double! )


override func awakeFromNib() {

    super.awakeFromNib()

}


IBAction func stepper(_ sender: UIStepper) {

    var item : Item! // I called it again bc it didn’t connect in the stepper func ;-;

    stepperText.text = String(Int(sender.value))

    priceLabel.text = String(Int(sender.value))

    let n = item.price // HERE is the error (Thread 1: Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value)

    let nn = Double(Double(stepperText.text! ?? “0”) ?? 0)

    priceLabel.text = “\(n! * nn )”

    // i made this code to take the item price and when I use the stepper it multiple the step number with the price ;0; help plz
}
Enter fullscreen mode Exit fullscreen mode

}

💖 💪 🙅 🚩
lilkiwi
Kiwi

Posted on July 29, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

Help needed ;-;
swift Help needed ;-;

July 29, 2021