Determine which View is currently open and get variable from this view

I am writing a program using Xcode 8.3.3 with Swift 3.1 for iOS 10. This program is a messenger, so it can send and receive messages from other users. This application has several screens (contacts, stats, chats, etc.) and one background thread which receives incoming messages. I need to determine should I show to user a new incoming message or not. I mean if Single Chat Screen with somebody is open I do not need to show user a message, but on any other screen I need to show pop up view. So I need to determine, which View is currently open and receive variable from this view (in my case it is var chat: Chat!, it contains chat ID) to determine which chat received a message. Every messenger has similar functionality: WhatsApp, Viber. Does anybody knows how to do this?
I will be thankful for any help or advice.

I do not understand: why this question is going down? Whats wrong with it?

I think for your case each of your views must have his own chatID and when you receiving some message you have to compare the chatID of your message and your view