title: Retrieving images into HTML with Swift
body: <p>I'm really struggling with getting swift saved images into HTML.
  I'm taking a photo, saving it into default documents folder and then i want to take them out and put into HTML string which later turns into PDF. Last thing what i need is to get saved images into HTML.. Does anybody know how to do this?</p>
  <p>Here's my image save function:</p>
  <pre><code>private func saveImage(imageData: Data, named: String, completion: @escaping (URL) -&gt; Void) {
          guard let directory = try? FileManager.default.url(for: .documentDirectory, in: .userDomainMask, appropriateFor: nil, create: false) as NSURL else {
              return
          }
          do {
              try imageData.write(to: directory.appendingPathComponent(named)!)
              completion(directory.appendingPathComponent(named)! as URL)
          } catch {
              print(error.localizedDescription)
              return
          }
      }
  </code></pre>
  <p>After that I'm putting into HTML this:</p>
  <p><code>&quot;&lt;td class='unit'&gt;&quot; + &quot;/(url.absoluteString).png&quot; + &quot;&lt;/td&gt;&lt;/tr&gt;&quot;</code></p>
  <p>It actually is the full path to the image, but I guess it doesn't work like that and unfortunately ending up like this:</p>
  <p><a href="https://i.stack.imgur.com/zNyjV.png" rel="nofollow noreferrer">Image with the resulting PDF after html rendering/</a></p>