title: How can I filter, or have multiple options, for a generic function?
body: <p>I have a function that is taking in a value, which I then send to NSUserDefaults to store in its Property List.</p>
  
  <pre><code>func store&lt;T&gt;(value: T, key: String) -&gt; Bool {
    // send key, value to NSUserDefaults
  }
  </code></pre>
  
  <p>How can I set up generic constraints so that the value can only be one of the possible types accepted for the property list?</p>
  
  <p>I was thinking something like:</p>
  
  <pre><code>func store&lt;T&gt;(value: T, key: String) -&gt; Bool where T:NSString OR T:NSData OR T:Etc{
    // send key, value to NSUserDefaults
  }
  </code></pre>
  
  <p>which of course does not work.</p>