In the Implement Navigation chapter of the Start Developing iOS Apps (Swift) tutorial by Apple, there is a following code snippet:
if let sourceViewController = sender.sourceViewController as? MealViewController,
meal = sourceViewController.meal {}
This tutorial uses Swift 3.1 and this snippet doesn't seem to work for me. It works only if I prepend meal = sourceViewController.meal with let keyword as well, like this:
if let sourceViewController = sender.sourceViewController as? MealViewController,
let meal = sourceViewController.meal {}
The origin of my question is pure curiosity: has if let a = b, c = d ever been valid syntax in any Swift version?
Aucun commentaire:
Enregistrer un commentaire