Reputation: 2682
I am trying to addObserver
to all my views, when I start my application.
When there is a post coming I want to display a Modal View on top of the current ViewController
.
Is there a way to install it directly on every View or do I need to do the
viewWillAppear : add
viewDidDisappear : remove
workaround each time ?
Upvotes: 0
Views: 67
Reputation: 170
Create parent class like this and subclass all other classes
import UIKit
class TemplateClassVC: UIViewController {
override func viewWillAppear() {
}
override func viewDidDisappear() {
}
}
and find top viewcontroller like this Get top most UIViewController
Upvotes: 1
Reputation: 7741
Upvotes: 1