title: Xcode PDFKit: How To Close PDF File
body: <p>I have built an App an I'm about to finish my project.</p>
  
  <p>And I need to put a imprint as a pdf-file in my App (legal reasons), which I thought would be no problem.
  But I can't figure out what I need to do to get a Close Button to just close the PDF File..</p>
  
  <p>My code: </p>
  
  <pre><code>@IBAction func test(_ sender: Any) {
  
      let pdfView = PDFView()
  
      pdfView.translatesAutoresizingMaskIntoConstraints = false
      view.addSubview(pdfView)
  
      pdfView.leadingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.leadingAnchor).isActive = true
      pdfView.trailingAnchor.constraint(equalTo: view.safeAreaLayoutGuide.trailingAnchor).isActive = true
      pdfView.topAnchor.constraint(equalTo: view.topAnchor, constant:25).isActive = true
      pdfView.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor).isActive = true
  
      guard let path = Bundle.main.url(forResource: "ImpressumDatenschutz", withExtension: "pdf") else { return }
  
      if let document = PDFDocument(url: path) {
          pdfView.document = document
      }
  }
  </code></pre>