Jayson Tamayo Jayson Tamayo - 1 year ago 168
Swift Question

How to know if ViewController is visible again

How do I know if the ViewController is visible again?

I tried putting the

command inside
. Run the app. Press the home button. Return to the app but
dont get executed.

i am trying to execute a code right after the app becomes visible again.

How do I do that?

Answer Source

Use your print statement in the AppDelegate for application: WillEnterForeground OR application: didBecomeActive both of those are called at different times when the user returns to the application. Use one or the other depending on at what point you'd like to call or reference your code

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download