title: SwiftUI: How to properly present AVPlayerViewController modally?
body: <h2>Proper UIKit Approach:</h2>
  
  <p>According to Apple's <a href="https://developer.apple.com/videos/play/wwdc2019/503/" rel="noreferrer">WWDC 2019 talk on the subject</a>, <code>AVPlayerViewController</code> should be presented modally to take advantage of all the latest full-screen features of the API. This is the recommended sample code to be called from your presenting UIKit view controller: </p>
  
  <pre><code>// Create the player
  let player = AVPlayer(url: videoURL)
  
  // Create the player view controller and associate the player
  let playerViewController = AVPlayerViewController()
  playerViewController.player = player
  
  // Present the player view controller modally
  present(playerViewController, animated: true)
  </code></pre>
  
  <p>This works as expected and launches the video in beautiful full-screen.</p>
  
  <h2>Achieve the Same Effect with SwiftUI?:</h2>
  
  <p>In order to use the <code>AVPlayerViewController</code> from SwiftUI, I created the <code>UIViewControllerRepresentable</code> implementation: </p>
  
  <pre><code>struct AVPlayerView: UIViewControllerRepresentable {
  
      @Binding var videoURL: URL
  
      private var player: AVPlayer {
          return AVPlayer(url: videoURL)
      }
  
      func updateUIViewController(_ playerController: AVPlayerViewController, context: Context) {
          playerController.player = player
          playerController.player?.play()
      }
  
      func makeUIViewController(context: Context) -&gt; AVPlayerViewController {
          return AVPlayerViewController()
      }
  }
  </code></pre>
  
  <blockquote>
    <p>I cannot seem to figure out how to present this directly from SwiftUI
    in the same way as the <code>AVPlayerViewController</code> is presented directly
    from UIKit. My goal is simply to get all of the default, full-screen benefits. </p>
  </blockquote>
  
  <p>So far, the following has not worked:</p>
  
  <ul>
  <li>If I use a <code>.sheet</code> modifier and present it from within the sheet, then the player is embedded in a sheet and not presented full-screen. </li>
  <li>I have also tried to create a custom, empty view controller in UIKit that simply presents my <code>AVPlayerViewController</code> modally from the <code>viewDidAppear</code> method. This gets the player to take on the full screen, but it also shows an empty view controller prior to display the video, which I do not want the user to see. </li>
  </ul>
  
  <p>Any thoughts would be much appreciated!</p>