title: Is there a way I could iterate over elements in Swift while using method names?
body: <pre><code>let x = [1, 2, 2, 3, 3, 3, 1].reversed()
  for element in x.method_name() {
      print(element)
  }
  </code></pre>
  
  <p>This returns</p>
  
  <blockquote>
    <p>Value of type 'ReversedCollection&lt;[Int]>' has no member 'method_name'.</p>
  </blockquote>
  
  <p>Why? How do I reference the method I have created and have it do the functions I need it to do?</p>
  
  <p>However, if I use the below, the problem seems to disappear. I would just like to pass in an array and do let the function do all, i.e.: </p>
  
  <pre><code>let x = Array([1, 2, 2, 3, 3, 3, 1].reversed())
  </code></pre>