notes

sourceViewController -> source2020. 7. 6.

Implement Navigation을 진행하다가 아래 워닝을 만났다.

Screen Shot 2020-07-07 at 6 32 27

    //MARK: Actions
    @IBAction func unwindToMealList(sender: UIStoryboardSegue) {
-        if let sourceViewContoller = sender.sourceViewController as? MealViewController, let meal = sourceViewContoller.meal {
+        if let sourceViewContoller = sender.source as? MealViewController, let meal = sourceViewContoller.meal {
            // Add new meal.
            let newIndexPath = IndexPath(row: meals.count, section: 0)
            meals.append(meal)
            tableView.insertRows(at: [newIndexPath], with: .automatic)
        }
    }
    //MARK: Actions
    @IBAction func unwindToMealList(sender: UIStoryboardSegue) {
-        if let sourceViewContoller = sender.sourceViewController as? MealViewController, let meal = sourceViewContoller.meal {
+        if let sourceViewContoller = sender.source as? MealViewController, let meal = sourceViewContoller.meal {
            // Add new meal.
            let newIndexPath = IndexPath(row: meals.count, section: 0)
            meals.append(meal)
            tableView.insertRows(at: [newIndexPath], with: .automatic)
        }
    }

Tags