title: How do I make my exponentiation operator work with all numeric types in Swift?
body: <p>I have created a ^^ operator in Swift. How do I make it work with Integers and Doubles like all other operators?</p>
  
  <pre><code>infix operator ^^ { }
  func ^^ (number:Int, power: Int) -&gt; Int {
      var result = power &gt; 0 ? number : 0
      if power &gt; 1 { for x in 1..&lt;power { result *= number } }
      return result
  }
  </code></pre>