func addObserver(_ observer: Any, selector aSelector: Selector, name aName: NSNotification.Name?, object anObject: Any?)
This function needs the observer to be some object but while setting static methods as the selector.
This answer explains how to set selector and observer when the selector is an instance method.
We need set YourClass.self
as the observer. In this way -
NotificationCenter.default.addObserver(YourClass.self, selector: #selector(YourClass.yourStaticMethod), name: NSNotification.Name.BlahBlah, object: nil)