While working with NSDate and NSCalendar using Swift I came accross some API methods in NSCalendar that are public but not included in the Online Documentation.
Following some of those API methods:
@availability(iOS, introduced=8.0)
func compareDate(date1: NSDate, toDate date2: NSDate, toUnitGranularity unit: NSCalendarUnit) -> NSComparisonResult
@availability(iOS, introduced=8.0)
func isDate(date1: NSDate, equalToDate date2: NSDate, toUnitGranularity unit: NSCalendarUnit) -> Bool
@availability(iOS, introduced=8.0)
func isDateInToday(date: NSDate) -> Bool
These methods makes date manupulation quite easy but I am not sure if I should be using these as these are undocumented.
Now the question is, are these safe to use in iOS Application? I mean, will they be changed or removed without notice or backward compatibility and will any App that is using these method be approved?
The methods are declared publicly (i.e. they are in NSCalendar.h
) so they are legal to use. They may not be documented online, but that looks like a docs issue as it hasn't been properly updated since 2011 (at the time of writing).
Note also that other people have spotted and commented on the usefulness of these API additions, for example NSHipster.
So, assuming you're only supporting iOS 8+ then you are good to use those (handy) API methods.