From 7ff10d999ea1723f5bfabf178dbab32fadf40806 Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Thu, 4 Mar 2021 23:22:21 -0800 Subject: [PATCH] Prevent double dismiss --- View Controllers/NewStatusViewController.swift | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/View Controllers/NewStatusViewController.swift b/View Controllers/NewStatusViewController.swift index 2661540..2f41b28 100644 --- a/View Controllers/NewStatusViewController.swift +++ b/View Controllers/NewStatusViewController.swift @@ -109,21 +109,24 @@ extension NewStatusViewController { extension NewStatusViewController: PHPickerViewControllerDelegate { func picker(_ picker: PHPickerViewController, didFinishPicking results: [PHPickerResult]) { - mediaSelections.send(results) - dismiss(animated: true) + dismiss(animated: true) { + self.mediaSelections.send(results) + } } } extension NewStatusViewController: UIImagePickerControllerDelegate { func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey: Any]) { - imagePickerResults.send(info) - dismiss(animated: true) + dismiss(animated: true) { + self.imagePickerResults.send(info) + } } func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { - imagePickerResults.send(nil) - dismiss(animated: true) + dismiss(animated: true) { + self.imagePickerResults.send(nil) + } } }