If I have a UIDatePicker, and I wish to set the minimum and maximum date range to be between thirty years ago and thirty years in the future, how would I set that up?
Adapting @warrenm's answer to Swift:
let currentDate = NSDate()
let dateComponents = NSDateComponents()
dateComponents.year = -13
let minDate = calendar.dateByAddingComponents(dateComponents, toDate: currentDate, options: NSCalendarOptions(rawValue: 0))
dateComponents.year = 30
let maxDate = calendar.dateByAddingComponents(dateComponents, toDate: currentDate, options: NSCalendarOptions(rawValue: 0))
dobPicker.maximumDate = maxDate
dobPicker.minimumDate = minDate