fatal error: unexpectedly found nil while unwrapping an Optional value

0

I know the problem is simple .. but I can not solve my variable Beats only appears in the second view, but a function ends up calling it in the first view, I just need to check if it's popping up, but I'm not able to do the control if

@IBOutlet weak var Batimentos: UILabel!


if let actualBpm = bpm{
            print(actualBpm)

            Batimentos.text! = "\(actualBpm)"

        }else {
            print("ELSE bpm")
        }
    
asked by anonymous 16.09.2017 / 06:02

1 answer

0

Try this way.

@IBOutlet weak var Batimentos: UILabel!


if let actualBpm = bpm{
    print(actualBpm)

    Batimentos.text! = "\(actualBpm!)"

}else {
    print("ELSE bpm")
}
    
04.10.2017 / 21:39