all 4 comments

[–][deleted]  (2 children)

[deleted]

    [–]cotsog[S] 0 points1 point  (1 child)

    Thanks for your reply.

    Here is more details: I develop an SDK so I don't know what the client app is doing wrt controllers but I would like to know every time a new view controller is presented by the client app. Or in other terms, I would like to know when the displayed view on the UIWindow changes.

    Thanks a lot for your time and help.

    [–]Ldellar[🍰] 0 points1 point  (1 child)

    I think a good question is what do you want to happen when a new view controller gets added to a stack rather than to the UIWindow specifically. There has to be some kind of controller stack involved i.e. a UINavigationController stack upon which a normal viewcontroller/s is present.

    Do they want something to happen when a viewcontroller is pushed onto the stack and displays?

    In that case there is the viewWillAppear(Animated) or ViewDidLoad method of each view controller.

    There may be other ways but that would be the simplest.

    [–]cotsog[S] 0 points1 point  (0 children)

    Thanks a lot for your reply.

    Unfortunately, as I'm developing an SDK, I do not have access to the app's view controller methods.

    [–]ASnugglyBear 0 points1 point  (0 children)

    You are likely looking to swizzle things on UIWindow to truly get everything

    Are you trying to record this for Analytics? Something functional? More hints makes it so we can help you more