While show toast in oneVIewcontroller after dismiss it's gone iOS swift

 Problem:

I'm having one viewcontroller that had one action.After the action it will show one toast.

After display toast i want to dismiss the viewcontroller.But now i shown the toast, but inside the viewcontroller that toast shown.After dismiss in fraction of second it's gone.

So user may not be able to view the toast.How to solve that?

Solution:

The above problem will be solved after some fraction of seconds you can show the toast with the current viewcontroller in visible.

                    DispatchQueue.main.asyncAfter(deadline: .now() + 0.6) {

                        if let topController = UIApplication.topViewController() {

                    showToast(message: message ?? "", seconds: 0.5)   

}        

         }

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift