On the helpful question Force reload watchOS 2 Complications user @alexeyvmp mentions in a comment that you should add an observer for the CLKComplicationServerActiveComplicationsDidChangeNotification
event.
What is a good place to create this observer, and what would it look like? Do I create it from my ComplicationDataSource, or in my InterfaceController? How do I make sure it's not recreated over and over?
I have tried to read up on how to create observers in Swift
but I'm having a hard time figuring out where to put it. I currently have
let notificationCenter = NSNotificationCenter.defaultCenter()
let mainQueue = NSOperationQueue.mainQueue()
_ = notificationCenter.addObserverForName(CLKComplicationServerActiveComplicationsDidChangeNotification, object: nil, queue: mainQueue) { _ in
print("active complications changed. refresh!")
}
Any help is appreciated.