-1

I have populated my table view cells with images from firebase. How do I detect which image I have tapped on and also bring the email composer with that image attached, as an attachment?

timrau
  • 22,578
  • 4
  • 51
  • 64
Ken
  • 31
  • 1
  • 4

1 Answers1

1

I assume you are holding a reference to your datasource. In this case your firebase response.

UITableView has delegate and datasource methods to react on actions.

By implementing

optional func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath)

You can be notified on the tap action with the indexPath. By using indexPath.row you can have the index for your desired image. Simply use this index to extract the image from your response/data source.

After this point you need to send an email programmatically. In order not to duplicate answers, you can follow this SO post.

Sending Email With Swift

erenkabakci
  • 442
  • 4
  • 15
  • Would the email attachment be like this; let attachment = dictionary[indexpath.row]? – Ken Jul 16 '17 at 17:58