Adding an unwind action method to the Done button

In Chapter 10, Building Your App Structure in Storyboard, you added an unwind action method for the Cancel button in ExploreViewController, which dismisses the Locations screen when it is tapped. Now, you'll add an unwind action method for the Done button, which dismisses the Locations screen and sets the selectedCity property in ExploreViewController to the location selected by the user. Perform the following steps:

  1. Add the following just below the unwindLocationCancel(segue:) method:
@IBAction func unwindLocationDone(segue:UIStoryboardSegue){    if let viewController = segue.source as? LocationViewController {        selectedCity = viewController.selectedCity        if let location = selectedCity { headerView.lblLocation.text ...

Get iOS 13 Programming for Beginners - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.