title: How to Load Local PDF in UIWebView in Swift
body: <p>So I am currently trying to display a local PDF I have in UIWebview and this is the code I'm using:</p>
  
  <pre><code>@IBOutlet weak var webView:UIWebView!
  override func viewDidLoad() {
      super.viewDidLoad()    
  
  var pdfLoc = NSURL(fileURLWithPath:NSBundle.mainBundle().pathForResource("Sample", ofType:"pdf")!) 
  var request = NSURLRequest(URL: pdfLoc);
  self.webView.loadRequest(request);
  }
  </code></pre>
  
  <p>The code will successfully build, but when I run the app, it will crash with the error:
  Thread 1: EXC_BAD_INSTRUCTION(code=EXC-I386_INVOP,subcode=0x0)</p>
  
  <p>I have found a few tutorials on how to do this, but they are all very outdated or in Objective-C.</p>