title: Swift Generic Protocol Function Parameters
body: <p>This seems like it should work to me. All I am trying to do is make the <code>Rule</code> protocol able to <code>performRule</code> on whatever struct adopts that Rule protocol and then return a boolean. However, with the way my code is currently I cannot access any properties on the <code>performRule(:value)</code> <strong>value</strong> parameter. I feel like I am missing an important concept or something is buggy. You should be able to copy the code below into a playground to see the issue for yourself.</p>
  
  <pre><code>import Foundation
  
  protocol NumberCalculation {
      var number : NSNumber { get set }
  }
  
  protocol Rule {
      var invalidMessage : String { get set }
      func performRule&lt;T&gt;(value: T) -&gt; Bool
  }
  
  struct GreaterThanRule : Rule, NumberCalculation  {
      var invalidMessage: String
      var number : NSNumber
  
      init(valueMustBeGreaterThan value: NSNumber, withInvalidMessage message : String = "") {
          number = value
          invalidMessage = message
      }
  
      func performRule&lt;NSNumber&gt;(value: NSNumber) -&gt; Bool {
          number.decimalValue // works 
          value.decimalValue // doesn't work
          return true
      }
  }
  </code></pre>