From c10934f32b88ff3dd3025fd634faf7d48d4be3ce Mon Sep 17 00:00:00 2001 From: Justin Mazzocchi <2831158+jzzocc@users.noreply.github.com> Date: Mon, 8 Mar 2021 20:40:22 -0800 Subject: [PATCH] Change visibility logic --- Extensions/UIVIewController+Extensions.swift | 2 +- View Controllers/TableViewController.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Extensions/UIVIewController+Extensions.swift b/Extensions/UIVIewController+Extensions.swift index 803d4c1..1ce96c0 100644 --- a/Extensions/UIVIewController+Extensions.swift +++ b/Extensions/UIVIewController+Extensions.swift @@ -5,7 +5,7 @@ import UIKit import ViewModels extension UIViewController { - var isVisible: Bool { isViewLoaded && view.window != nil && presentedViewController == nil } + var isVisible: Bool { isViewLoaded && view.window != nil } func present(alertItem: AlertItem) { let alertController = UIAlertController( diff --git a/View Controllers/TableViewController.swift b/View Controllers/TableViewController.swift index 7e9a06a..26b9080 100644 --- a/View Controllers/TableViewController.swift +++ b/View Controllers/TableViewController.swift @@ -423,7 +423,7 @@ private extension TableViewController { viewModel.alertItems .compactMap { $0 } .sink { [weak self] in - guard let self = self, self.isVisible else { return } + guard let self = self, self.isVisible, self.presentedViewController == nil else { return } self.present(alertItem: $0) }