Friends, please tell me why it occurs and how to fix the following error. There is code running on swift 1.2 in Xcode 6. When I try to run it in swift 2 in Xcode 7, an error occurs. Here is the code itself - we take the entered values, call the compare function with the given ones, which returns true or false
var passwd=textfield.text var login=loginfield.text let ver = compare(login, b:passwd) if ver == true { label.text="True" } else { label.text="False" } } In swift 2, an error occurs on the line:
let ver = compare(login, b:passwd) "Value of optional type 'String?' not unwrapped; did you mean to use '!' or '?' Why and where to dig?