Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In iOS 13, what events do I get when the user swipes my app up in the app switcher?

Tags:

ios

kill

ios13

I'm finding it extraordinarily difficult to categorize and account for what events I get (or don't get) when the user swipes my app up in the app switcher on iOS 13. This seems to be because of changes caused by the multiple scene support. What are the events that I get in that situation?

like image 441
matt Avatar asked Oct 26 '19 17:10

matt


People also ask

Should you swipe up to close apps on iPhone?

Apple has warned that swiping the apps on your iPhone closed could actually be damaging to its battery. The tech giant commented on recent reports that closing all your apps in this way can impact the function of your iPhone, confirming that this is actually true.

Is there another way to close apps other than swiping up iPhone 13?

Follow these steps if your iPhone has a physical Home button with Touch ID: Double-click the Home button to access the App Switcher. Swipe side to side to find the apps you want to close. To close multiple apps, use multiple fingers to tap and hold several app previews.

How do you swipe up apps on iPhone 13?

Multitask. Swipe up from the bottom of the screen and pause. If you're in an app, swipe right along the bottom edge of the screen to switch to another app.

What's the swipe up thing on iPhone?

To open Control Center, swipe up from the bottom edge of any screen. To close Control Center, tap the top of the screen or press the Home button.


1 Answers

Let's assume that your app supports window scenes. So what the user is swiping up in the app switcher is really a scene, not your app as a whole. Then the possibilities appear to be as follows.

On an iPhone

If the scene was frontmost:

  • sceneDidEnterBackground
  • applicationWillTerminate(_:)

But if the scene was not frontmost, you'll get nothing; you already received sceneDidEnterBackground, and you won't get applicationWillTerminate(_:) now because the app isn't running.

On an iPad, if the app does not support multiple windows

If the scene was frontmost:

  • sceneDidDisconnect(_:)
  • application(_:didDiscardSceneSessions:)
  • applicationWillTerminate(_:)

But if the scene was not frontmost, you'll get nothing; you already received sceneDidEnterBackground, and you won't get applicationWillTerminate(_:) now because the app isn't running.

On an iPad, if the app does support multiple windows

If the scene was frontmost:

  • sceneDidEnterBackground
  • applicationWillTerminate(_:) (perhaps)

But if the scene was not frontmost, you'll get nothing; you already received sceneDidEnterBackground, and you won't get applicationWillTerminate(_:) now because either the app isn't running or the app isn't terminating (if there's another window). If the app is still running, you might get sceneDidDisconnect(_:) and possibly application(_:didDiscardSceneSessions:) later.


Conclusions

What's the odd-man-out here? It's the case where we're running on an iPad and we support scenes but not multiple windows. We don't get sceneDidEnterBackground! I regard that as incoherent. Since we don't support multiple windows, this is basically an iPhone app and it should behave like an iPhone app. I shouldn't have to double up my code just because my app runs on both iPhone and iPad.

like image 79
matt Avatar answered Oct 12 '22 14:10

matt