title: Building up an NSCalendarUnit value from an array of individual units
body: <p>I am trying to calculate the number of years/days/mins/etc until a certain <code>NSDate</code>. I am doing: </p>
  
  <pre><code>NSDateComponents *components = [[NSCalendar currentCalendar] components:(NSCalendarUnitYear | NSCalendarUnitWeekOfYear | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond) fromDate:[NSDate date] toDate:date options:0];
  </code></pre>
  
  <p>I am trying to allow the user to select which components they want to see. Say I have an array containing they want <code>NSCalendarUnitYear</code> and <code>NSCalendarUnitMinute</code>. How do I concatenate these into the <code>(NSCalendarUnitYear | NSCalendarUnitMinute)</code>?</p>
  
  <p>I tried:</p>
  
  <pre><code>NSCalendarUnit *units;
  for (NSCalendarUnit *unit in arrayOfUnits) {
      units = units | unit;
  }
  </code></pre>
  
  <p>but this does not compile. Any ideas?</p>