title: Swift Generators: What is the counterpart to next()?
body: <p>I am currently learning Swift. While playing around with Generators I came across the following problem: <strong>Given a generator <code>iter</code>. How do I go back one item?</strong></p>
  
  <p>For example:</p>
  
  <pre><code>var str = "Hello World"
  var iter = str.characters.generate()
  
  iter.next() // =&gt; H
  ...
  iter.next() // =&gt; l
  iter.next() // =&gt; o
  
  
  // how can I get this functionality to go back? 
  iter.previous() =&gt; l
  iter.next() =&gt; o
  </code></pre>
  
  <p><em>If not using generators: How can I get this behaviour to go forward and backward (in a String)?</em></p>
  
  <p>Thanks in advance!</p>