if let ip = indexPath {
var data: NSManagedObject = myList[ip.row] as NSManagedObject
cell.textLabel?.text = data.valueForKeyPath("item") as String
}
error : "Bound value in a conditional binding must be of Optional type"
I'm using xcode 6.1.1, help please.
I am following this tutorial, [http://www.youtube.com/watch?v=4ymz6i07DRM]
You are saying:
if let ip = indexPath {
Swift is saying: "Just say let ip = indexPath
, or simply use indexPath
directly. There is no need for the if
(or the curly braces); you don't need a condition here."
The reason is probably that at the time the tutorial you're using was designed, indexPath
was an Optional and needed to be unwrapped. But now it is not an Optional. Apple changes the APIs from time to time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With