How to receive notifications when a view controller is presented

We are developing an SDK for external use. One of the requirements is that we create a story that describes in detail how the user goes through the application, i.e. Which view managers are displayed. Since this is provided as an SDK, we really need the tracking to be as unobtrusive as possible, and possibly require as little interaction with the developers as possible.

The biggest problem I'm currently facing is how to track when view managers (and possibly viewing controller stacks or hierarchies) are displayed modally. I tried using KVO to monitor the presentedViewControllerparent property UIViewController, but it does not seem to be updated for modally represented view controllers.

I can determine the current view controller by creating a tree starting in the window, but I need to execute the code whenever the visible view controller changes.

Any thoughts? Some message NSNotificationCenterthat I am missing?

+4
source share

Source: https://habr.com/ru/post/1625171/


All Articles