Here's a code snippet that compiles and works as expected, but I get a warning for depricated use of the unit .NSYearCalendarUnit.
This is within XCode 7 (Swift 2.0)
Playground execution failed: /var/folders/37/2hl0kpw50lv18q1d48gbbb5r0000gn/T/./lldb/16158/playground8.swift:52:20: warning: 'NSYearCalendarUnit' was deprecated in iOS 8.0: Use NSCalendarUnitYear instead
var TermEndDate = NSDate()
if (TermYears>0) {
TermEndDate = userCalendar.dateByAddingUnit(
NSCalendarUnit.NSYearCalendarUnit,
value: TermYears,
toDate: TermStartDate,
options: .WrapComponents )!
}
if (leaseMonths>0) {
TermEndDate = userCalendar.dateByAddingUnit(
NSCalendarUnit.NSMonthCalendarUnit,
value: TermMonths,
toDate: TermEndDate,
options: .WrapComponents )!
}
/var/folders/37/2hl0kpw50lv18q1d48gbbb5r0000gn/T/./lldb/16158/playground8.swift:60:5: error: 'NSCalendarUnit.Type' does not have a member named 'NSCalendarUnitMonth'
NSCalendarUnit.NSCalendarUnitMonth,
^ ~~~~~~~~~~~~~~~~~~~
I've dug through the documentation and can't find what I'm doing wrong.
Thoughts?
Thanks!!!