DEV Community

Kiwi
Kiwi

Posted on

swift developers help 😢 plz

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

}

Sentry growth stunted Image

If you are wasting time trying to track down the cause of a crash, it’s time for a better solution. Get your crash rates to zero (or close to zero as possible) with less time and effort.

Try Sentry for more visibility into crashes, better workflow tools, and customizable alerts and reporting.

Switch Tools πŸ”

Top comments (0)

Billboard image

πŸ“Š A side-by-side product comparison between Sentry and Crashlytics

A free guide pointing out the differences between Sentry and Crashlytics, that’s it. See which is best for your mobile crash reporting needs.

See Comparison

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay