This is a little more complicated then just
NSPredicate *predicate = [NSPredicate predicateWithFormat:@\"startDate >= %@ AND endDate <= %@\", startDay,
Massimo Camaro had a great answer. I took the liberty of porting it to Swift and modifying it a little to support a different column name.
func predicateToRetrieveEventsForDate(aDate:NSDate, predicateColumn:String) -> NSPredicate {
// start by retrieving day, weekday, month and year components for the given day
let gregorian = NSCalendar(calendarIdentifier: NSCalendarIdentifierGregorian)
let todayComponents = gregorian?.components([.Day, .Month, .Year], fromDate: aDate)
let theDay = todayComponents?.day
let theMonth = todayComponents?.month
let theYear = todayComponents?.year
// now build a NSDate object for the input date using these components
let components = NSDateComponents()
components.day = theDay!
components.month = theMonth!
components.year = theYear!
let thisDate = gregorian?.dateFromComponents(components)
// build a NSDate object for aDate next day
let offsetComponents = NSDateComponents()
offsetComponents.day = 1
let nextDate = gregorian?.dateByAddingComponents(offsetComponents, toDate: thisDate!, options: NSCalendarOptions(rawValue: 0))
// build the predicate
let predicate = NSPredicate(format: "\(predicateColumn) >= %@ && \(predicateColumn) < %@", thisDate!, nextDate!)
return predicate
}