title: Displaying Relative Time Difference in (int)(unit) Format e.g. 1w, 4d, 2h
body: <p>I'm trying to display the relative difference between a certain date and now in a shorthand manner.</p>
  <p><strong>Format</strong></p>
  <p>Given yesterday, would return <strong>1d</strong></p>
  <p>Given 4 days ago, would return <strong>4d</strong></p>
  <p>Given 2 hours ago, would return <strong>2h</strong></p>
  <p>Given 3 weeks ago, would return <strong>3w</strong></p>
  <p>I've tried using DateFormatter's in-built relative date formatting but this produces a longer result e.g. yesterday, or 1 week ago. My code is something like as follows:</p>
  <pre><code>let timeFormatter = DateFormatter()
  timeFormatter.doesRelativeDateFormatting = true
  timeFormatter.timeStyle = .short
  timeFormatter.dateStyle = .short
  </code></pre>
  <pre><code>timeFormatter.string(from: someDate)
  </code></pre>
  <p>This produces the output explained above.</p>
  <p>I can't see any parameters in DateFormatter that would shorten this. Is there any way to do this within DateFormatter or will I need to build my own function to achieve this?</p>