title: swift set intersect, union, subtract
body: <p>Does anyone know how to implement set operations with user defined classes, with its property as operated conditions. For instance: </p>
  
  <pre><code>class myClass {
    var figure: Int!
  } 
  
  let classObj1 = myClass() 
  classObj1.figure = 1
  
  let classObj2 = myClass()
  classObj2.figure = 2
  
  let classObj3 = myClass()
  classObj3.figure = 1
  
  let set1: Set = [classObj1]
  let set2: Set = [classObj2, classObj3]
  </code></pre>
  
  <p>Is there any method like: (pseudo code)</p>
  
  <pre><code>set2.substract(set1) {s2, s1 in s2.figure == s1.figure}
  </code></pre>
  
  <p>...so the expected result is <code>[classObj2]</code>?</p>
  
  <p>Many thanks for any suggestion!</p>