This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func > (left: NSDate, right: NSDate) -> Bool { | |
return left.compare(right) == .OrderedDescending | |
} | |
extension NSCalendar { | |
func dateRange(startDate startDate: NSDate, endDate: NSDate, stepUnits: NSCalendarUnit, stepValue: Int) -> DateRange { | |
let dateRange = DateRange(calendar: self, startDate: startDate, endDate: endDate, stepUnits: stepUnits, stepValue: stepValue, multiplier: 0) | |
return dateRange |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func requestForDuplicatedObjects(moc: NSManagedObjectContext) -> NSFetchRequest { | |
let objectsToKeepRequest = NSFetchRequest(entityName: "Recipe") | |
// Fetch object IDs representing objects to keep | |
let ed = NSExpressionDescription() | |
ed.expression = NSExpression.expressionForEvaludatedObject() | |
ed.name = "SELF" | |
ed.expressionResultType = .ObjectIDAttributeType | |
objectsToKeepRequest.propertiesToFetch = [ed] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example: view.round([.TopLeft, .TopRight], radius: 15) | |
extension UIView { | |
/** | |
Rounds the given set of corners to the specified radius | |
- parameter corners: Corners to round | |
- parameter radius: Radius to round to | |
*/ | |
func round(corners: UIRectCorner, radius: CGFloat) { |