title: NotificationCenter observer clearing after presenting modal
body: <p>My app is playing a video and I want to trigger an action when the video ends. The screen (A) is embedded in a navigation controller, and if I trigger a push (to B) and then come back (to A), the action (in A) still takes place based on the observer. There is also an option in my screen that triggers a modal (to C) which then gets dismissed to go back (to A). When I come back from the modal (C), however, the observer (in A) is gone.</p>
  
  <p>Here's my code for screen A's view controller:</p>
  
  <pre><code>ScreenAViewController: UIViewController {
      override func viewDidLoad() {
  
          super.viewDidLoad()
          // Do more stuff
  
          NotificationCenter.default.addObserver(forName: .AVPlayerItemDidPlayToEndTime, object: self.avPlayer.currentItem, queue: .main) { _ in
              // Do stuff
          }
      }
  }
  </code></pre>
  
  <p>Here's the code that trigger the modal to screen C:</p>
  
  <pre><code>@IBAction func triggerModal(_ sender: UIButton) {
      avPlayer.pause()
      let storyboard = UIStoryboard(name: "Main", bundle: nil)
      let screenCViewController = storyboard.instantiateViewController(withIdentifier: "ScreenC") as! ScreenCViewController
      present(screenCViewController, animated: true)
  }
  </code></pre>
  
  <p>And finally here's the line that dismisses screen C:</p>
  
  <pre><code>dismiss(animated: true, completion: nil)
  </code></pre>