My code is crashing when i am unwrapping Double(display.text!)! i put an if condition but it didn't work
@IBAction private func buttonpress(sender: UIButton)
{
let digit = sender.currentTitle!
if userisinthemiddle
{
let currenttext = display.text!
display.text = currenttext + digit
}
else
{
display.text = digit
}
userisinthemiddle = true
}
till here it is working properly but when i try to make it as a property it is not working
var DisplayValue : Double
{
get
{
return Double(display.text!)! // thread 1
}
set
{
display.text = String(newValue)
}
}