title: SwiftUI detect when the user takes a screenshot or screen recording
body: <p>On <code>UIViewController</code> we can easy add observer to controller. Like:</p>
  <pre class="lang-swift prettyprint-override"><code>class ViewController: UIViewController {
      override func viewDidLoad() {
          super.viewDidLoad()
          NotificationCenter.default.addObserver(self, selector: #selector(didTakeScreenshot(notification:)), name: UIApplication.userDidTakeScreenshotNotification, object: nil)
      }
      
      @objc func didTakeScreenshot(notification: Notification) {
          print(&quot;Screen Shot Taken&quot;)
      }
  }
  </code></pre>
  <p>Or capturing record with:</p>
  <pre><code>func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -&gt; Bool {
      // Override point for customization after application launch.
      let isCaptured = UIScreen.main.isCaptured
      return true
  }
  </code></pre>
  <p>But how to do it with SwiftUI?</p>