title: Mapping a Topbar Menu Item in SwiftUI app to opening a specific bundled PDF?
body: <p>SwiftUI, macOS:</p>
  
  <p>I'm trying to get a menu item to open "default PDF viewer of your choice", with a specific bundled PDF.</p>
  
  <p>Here's what I have thus far:</p>
  
  <pre><code>import SwiftUI
  import WebKit
  import PDFKit
  
  
  func Guide1(_ sender: Any) {
      if let pdfURL = Bundle.main.url(forResource: "Guide1", withExtension: "pdf"){
          if NSWorkspace.shared.open(pdfURL) {
      }
  }
  }
  
  func Guide2(_sender: Any) {
      if let pdfURL = Bundle.main.url(forResource: "Guide2", withExtension: "pdf"){
          if NSWorkspace.shared.open(pdfURL) {
      }
  }
  }
  </code></pre>
  
  <p>Now, what I'm missing is how to call these functions. </p>
  
  <p>From previous tutorials, I've found that one way of getting the menu items to "do something" is to ctrl-click and drag the Menu Item entry to First Responder, and then select functions from the list. However, these Guide1 + Guide2 functions are not displayed.</p>
  
  <p>Other tutorials suggest using <code>@IBAction</code> - but the minute I type that into a SwiftUI app, an error tells me to  get the <code>@IBaction</code> replaced with "nothing". So I cannot use those either.</p>
  
  <p>So, are these even valid strings for opening a PDF - and if so, how do I connect a dropdown menu item so that these PDFs are opened?</p>