1. 1

    Xcode Workflow Preview

    8:20FreeDone
  2. 2

    Start Designing in Xcode

    3:46FreeDone
  3. 3

    Navigation Controllers and Prototyping

    3:04FreeDone
  4. 4

    Designing The Home Screen

    3:14FreeDone
  5. 5

    Creating Custom Classes

    4:52FreeDone
  6. 6

    Customizing The TableView

    4:37FreeDone
  7. 7

    Adding Logic To The Styling

    3:29FreeDone
  8. 8

    Custom Fonts

    6:58FreeDone
  9. 9

    Saving Variables and Triggering Alerts

    6:40FreeDone
  10. 10

    Integrating Pods In Your Xcode Project

    2:24FreeDone
  11. 11

    Recognizing Gestures on UI Elements

    3:26FreeDone
  12. 12

    Retrieving Data From an API

    6:56FreeDone
  13. 13

    Implementing a Custom Loading Animation

    4:34FreeDone
  14. 14

    Saving and Persisting User Data

    3:11FreeDone
  15. 15

    Encoding and Saving Complex Data

    3:35FreeDone
  16. 16

    Make UI Updates More Granular

    2:22FreeDone
  17. 17

    Refactoring Saved Locations

    6:11FreeDone
  18. 18

    Fine-Tuning TableView Interactions

    2:29FreeDone
  19. 19

    Comparing Custom Classes

    3:42FreeDone
  20. 20

    Make a Custom Popup UI

    4:26FreeDone
  21. Adding Actions to TableView Cells

    3:27FreeDone

Adding Actions to TableView Cells

Published by Chris Slowik

Episode Notes

Extra tips from the author

Segue on Tap

To bring up the little modal window we designed in the previous episode, we're going to need a segue. Connect a manual segue from the Saved Locations screen to the Mini Modal screen. The Segue Identifier should be weatherLookupSegue, and the Presentation should be set to "Over Current Context". This will ensure that it still shows the presenting view controller, our Saved Locations screen.

Then, within the SavedLocationsVC, you'll need to add a function:

override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    tableView.deselectRow(at: indexPath, animated: false)
    performSegue(withIdentifier: "weatherLookupSegue", sender: self)
}

When the user selects a tableview row, it will immediately be deselected. There's no visual effect to this so we don't need to animate it, but if the cell was left selected, it would have to be deselected upon returning from the modal.. which would result in an extra tap and bad user experience. After deselecting the cell, we can bring up the modal.

The modal dismissal will be handled via tap gesture recognizer on the modal screen. Connecting that action to the code, we can add a simple one-liner which will dismiss the modal:

dismiss(animated: true, completion: nil)
Episode Topics: