Skip to content

Commit

Permalink
iOS 8 deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
keeshux committed Sep 19, 2015
1 parent fa90149 commit e9cb288
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Components/Macros/KSMacrosDates.h
Expand Up @@ -94,7 +94,7 @@ static inline NSString *KSDatesMonthString(const NSUInteger month) {
NSDate *KSDatesDateFromComponents(NSUInteger year, NSUInteger month, NSUInteger day);

static inline NSInteger KSDatesDay(NSDate *date) {
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay
fromDate:date];

return components.day;
Expand Down
14 changes: 7 additions & 7 deletions Components/Macros/KSMacrosDates.m
Expand Up @@ -36,7 +36,7 @@
#pragma mark - Year

NSInteger KSDatesYear(NSDate *date) {
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSYearCalendarUnit
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitYear
fromDate:date];

return components.year;
Expand Down Expand Up @@ -74,7 +74,7 @@ NSInteger KSDatesYear(NSDate *date) {
#pragma mark - Month

NSInteger KSDatesMonth(NSDate *date) {
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSMonthCalendarUnit
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitMonth
fromDate:date];

return components.month;
Expand Down Expand Up @@ -114,7 +114,7 @@ NSInteger KSDatesMonth(NSDate *date) {
components.year = year;
components.month = month;
components.day = day;
return [[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar] dateFromComponents:components];
return [[[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian] dateFromComponents:components];
}

BOOL KSDatesIsPastDay(NSDate *date) {
Expand All @@ -125,7 +125,7 @@ BOOL KSDatesIsPastDay(NSDate *date) {
}

// giorni dalla data parametro ad oggi
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSDayCalendarUnit
NSDateComponents *components = [[NSCalendar currentCalendar] components:NSCalendarUnitDay
fromDate:[NSDate date]
toDate:date
options:0];
Expand All @@ -139,11 +139,11 @@ BOOL KSDatesIsPastDay(NSDate *date) {

NSInteger KSDatesDistanceInDays(NSDate *from, NSDate *to) {
NSCalendar *calendar = [NSCalendar currentCalendar];
const NSUInteger units = NSDayCalendarUnit | NSMonthCalendarUnit | NSYearCalendarUnit;
const NSUInteger units = NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear;
NSDateComponents *fromComponents = [calendar components:units fromDate:from];
NSDateComponents *toComponents = [calendar components:units fromDate:to];

NSDateComponents *components = [calendar components:NSDayCalendarUnit
NSDateComponents *components = [calendar components:NSCalendarUnitDay
fromDate:[calendar dateFromComponents:fromComponents]
toDate:[calendar dateFromComponents:toComponents]
options:0];
Expand All @@ -164,6 +164,6 @@ NSInteger KSDatesDistanceInDays(NSDate *from, NSDate *to) {

NSUInteger KSDatesAge(NSDate *birthDate) {
NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:NSYearCalendarUnit fromDate:birthDate toDate:[NSDate date] options:0];
NSDateComponents *components = [calendar components:NSCalendarUnitYear fromDate:birthDate toDate:[NSDate date] options:0];
return components.year;
}
2 changes: 1 addition & 1 deletion Components/UI/KSActionView/KSActionView.m
Expand Up @@ -86,7 +86,7 @@ - (UIView *)actionView

NSMutableArray *items = [[NSMutableArray alloc] init];
UIBarButtonItem *itemCancel = [[UIBarButtonItem alloc] initWithTitle:_itemCancelString
style:UIBarButtonItemStyleBordered
style:UIBarButtonItemStylePlain
target:self
action:@selector(cancelClicked:)];
UIBarButtonItem *itemSpace = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
Expand Down

0 comments on commit e9cb288

Please sign in to comment.