title: Swift: check if date is the same date as any day in array of dates?
body: <p>I have an array of date objects - posts. And I am looping through a month. For each day, I want to check if some date in the array is on the same day. So far I have this: </p>
  
  <pre><code>var date = month?.startOfMonth()
  var end = month?.endOfMonth()
  while date! &lt;= end! {
     if posts.reduce(false,{Calendar.current.isDate(date, inSameDayAsDate: post.timeStamp)}) == true {
        ....
     }
     date = Calendar.current.date(byAdding: .day, value: 1, to: date!)
  
  }
  </code></pre>
  
  <p>I believe that this starts with false and for each day in posts it checks whether its in the same day and if it is it turns the result into true. However I think it also changes it back to false the next time it encounters a false value...</p>
  
  <p>What I want is something that returns true if any of the dates in posts is the same as some day rather than the last one. How can I do this? </p>