title: Swift screenshot observer executing number of times viewController is viewed per session (not once as it should)
body: <br>
  I am using this function to detect a screenshot in Swift:<br>
  <pre><code>    let mainQueue = OperationQueue.main
      NotificationCenter.default.addObserver(forName: UIApplication.userDidTakeScreenshotNotification,
              object: nil,
              queue: mainQueue) { notification in
                  print(&quot;[!]detected screenshot&quot;)
          }
  </code></pre>
  <p>It is located in the viewDidLoad() and each time I access the viewController it adds another screenshot observer. So if I were to access the view controller twice in the same session, it would execute two times when I take a screenshot. If I were to visit the view controller this function is running four times, it the screenshot observer would execute four times. How do I keep this from being redeclared between view controller sessions? Thank you for the help.</p>