From 8e36a555324cfc1eb7630b949fb27076b24dc1cc Mon Sep 17 00:00:00 2001 From: Robert Dimitrov Date: Sun, 21 Oct 2018 19:23:10 +0300 Subject: [PATCH] - Resolved all deprecation warnings - Added LaunchScreen storyboard --- Example/LaunchScreen.storyboard | 30 ++++++++++ Example/RDVCalendarView-Info.plist | 4 +- RDVCalendarView.xcodeproj/project.pbxproj | 51 +++++++++++++++-- RDVCalendarView/RDVCalendarDayCell.m | 4 +- RDVCalendarView/RDVCalendarView.m | 68 ++++++++++++----------- 5 files changed, 117 insertions(+), 40 deletions(-) create mode 100644 Example/LaunchScreen.storyboard diff --git a/Example/LaunchScreen.storyboard b/Example/LaunchScreen.storyboard new file mode 100644 index 0000000..e0558e3 --- /dev/null +++ b/Example/LaunchScreen.storyboard @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Example/RDVCalendarView-Info.plist b/Example/RDVCalendarView-Info.plist index 9cec645..5d65aaf 100644 --- a/Example/RDVCalendarView-Info.plist +++ b/Example/RDVCalendarView-Info.plist @@ -9,7 +9,7 @@ CFBundleExecutable ${EXECUTABLE_NAME} CFBundleIdentifier - com.robbdimitrov.${PRODUCT_NAME:rfc1034identifier} + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -24,6 +24,8 @@ 1.0 LSRequiresIPhoneOS + UILaunchStoryboardName + LaunchScreen UIRequiredDeviceCapabilities armv7 diff --git a/RDVCalendarView.xcodeproj/project.pbxproj b/RDVCalendarView.xcodeproj/project.pbxproj index f435809..89f5ce9 100644 --- a/RDVCalendarView.xcodeproj/project.pbxproj +++ b/RDVCalendarView.xcodeproj/project.pbxproj @@ -19,6 +19,7 @@ 62F77D5417BE00A7009873CE /* RDVCalendarViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 62F77D5317BE00A7009873CE /* RDVCalendarViewController.m */; }; 62F77D5717BE00BB009873CE /* RDVCalendarView.m in Sources */ = {isa = PBXBuildFile; fileRef = 62F77D5617BE00BB009873CE /* RDVCalendarView.m */; }; 62F77D5A17BE0105009873CE /* RDVCalendarDayCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 62F77D5917BE0105009873CE /* RDVCalendarDayCell.m */; }; + B4005E9B217CDB1400AABBFE /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B4005E9A217CDB1400AABBFE /* LaunchScreen.storyboard */; }; B44421A817BE61A300A048A6 /* LICENSE in Resources */ = {isa = PBXBuildFile; fileRef = B44421A617BE61A300A048A6 /* LICENSE */; }; B44421A917BE61A300A048A6 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = B44421A717BE61A300A048A6 /* README.md */; }; B463BCB618265F0400BF5848 /* iPad-small.png in Resources */ = {isa = PBXBuildFile; fileRef = B463BCB218265F0400BF5848 /* iPad-small.png */; }; @@ -49,6 +50,7 @@ 62F77D5617BE00BB009873CE /* RDVCalendarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = RDVCalendarView.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 62F77D5817BE0105009873CE /* RDVCalendarDayCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RDVCalendarDayCell.h; sourceTree = ""; }; 62F77D5917BE0105009873CE /* RDVCalendarDayCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDVCalendarDayCell.m; sourceTree = ""; }; + B4005E9A217CDB1400AABBFE /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = ""; }; B44421A617BE61A300A048A6 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = ""; }; B44421A717BE61A300A048A6 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = ""; }; B463BCB218265F0400BF5848 /* iPad-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPad-small.png"; sourceTree = ""; }; @@ -94,6 +96,7 @@ 62C2388A17CB463C009B4090 /* main.m */, 62C2388D17CB463C009B4090 /* RDVCalendarView-Info.plist */, 62C2388E17CB463C009B4090 /* RDVCalendarView-Prefix.pch */, + B4005E9A217CDB1400AABBFE /* LaunchScreen.storyboard */, ); name = "Supporting Files"; sourceTree = ""; @@ -193,7 +196,7 @@ isa = PBXProject; attributes = { CLASSPREFIX = RDV; - LastUpgradeCheck = 0460; + LastUpgradeCheck = 1000; ORGANIZATIONNAME = "Robert Dimitrov"; }; buildConfigurationList = 62F77D2D17BE0080009873CE /* Build configuration list for PBXProject "RDVCalendarView" */; @@ -227,6 +230,7 @@ 62C2388F17CB463C009B4090 /* Default-568h@2x.png in Resources */, 62C2389017CB463C009B4090 /* Default.png in Resources */, 62C2389117CB463C009B4090 /* Default@2x.png in Resources */, + B4005E9B217CDB1400AABBFE /* LaunchScreen.storyboard in Resources */, 62C2389217CB463C009B4090 /* InfoPlist.strings in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -269,25 +273,43 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -301,18 +323,35 @@ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.1; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -326,7 +365,8 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Example/RDVCalendarView-Prefix.pch"; INFOPLIST_FILE = "$(SRCROOT)/Example/RDVCalendarView-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.robbdimitrov.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; @@ -339,7 +379,8 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "Example/RDVCalendarView-Prefix.pch"; INFOPLIST_FILE = "$(SRCROOT)/Example/RDVCalendarView-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 5.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PRODUCT_BUNDLE_IDENTIFIER = "com.robbdimitrov.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; TARGETED_DEVICE_FAMILY = "1,2"; WRAPPER_EXTENSION = app; diff --git a/RDVCalendarView/RDVCalendarDayCell.m b/RDVCalendarView/RDVCalendarDayCell.m index 1c7ac44..b97df5b 100644 --- a/RDVCalendarView/RDVCalendarDayCell.m +++ b/RDVCalendarView/RDVCalendarDayCell.m @@ -95,7 +95,7 @@ - (void)setSelected:(BOOL)selected animated:(BOOL)animated { if ([self selectionStyle] != RDVCalendarDayCellSelectionStyleNone) { __weak RDVCalendarDayCell *weakSelf = self; - void (^block)() = ^{ + void (^block)(void) = ^{ if (selected) { [[weakSelf backgroundView] setAlpha:0.0f]; [[weakSelf selectedBackgroundView] setAlpha:1.0f]; @@ -137,7 +137,7 @@ - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated { if ([self selectionStyle] != RDVCalendarDayCellSelectionStyleNone) { __weak RDVCalendarDayCell *weakSelf = self; - void (^block)() = ^{ + void (^block)(void) = ^{ if (highlighted) { [[weakSelf backgroundView] setAlpha:0.0f]; [[weakSelf selectedBackgroundView] setAlpha:1.0f]; diff --git a/RDVCalendarView/RDVCalendarView.m b/RDVCalendarView/RDVCalendarView.m index 33e8408..17578df 100755 --- a/RDVCalendarView/RDVCalendarView.m +++ b/RDVCalendarView/RDVCalendarView.m @@ -102,15 +102,18 @@ - (id)initWithFrame:(CGRect)frame { NSCalendar *calendar = [self calendar]; - _currentDay = [calendar components:NSDayCalendarUnit|NSMonthCalendarUnit|NSYearCalendarUnit fromDate:[NSDate date]]; + _currentDay = [calendar components:(NSCalendarUnitDay + |NSCalendarUnitMonth + |NSCalendarUnitYear) + fromDate:[NSDate date]]; NSDate *currentDate = [NSDate date]; - _month = [calendar components:NSYearCalendarUnit| - NSMonthCalendarUnit| - NSDayCalendarUnit| - NSWeekdayCalendarUnit| - NSCalendarCalendarUnit + _month = [calendar components:(NSCalendarUnitYear| + NSCalendarUnitMonth| + NSCalendarUnitDay| + NSCalendarUnitWeekday| + NSCalendarUnitCalendar) fromDate:currentDate]; _month.day = 1; @@ -426,16 +429,16 @@ - (void)setSelectedDate:(NSDate *)selectedDate { if (![oldDate isEqualToDate:selectedDate]) { NSCalendar *calendar = [self calendar]; - _selectedDay = [calendar components:NSYearCalendarUnit| - NSMonthCalendarUnit| - NSDayCalendarUnit + _selectedDay = [calendar components:(NSCalendarUnitYear + |NSCalendarUnitMonth + |NSCalendarUnitDay) fromDate:selectedDate]; - self.month = [calendar components:NSYearCalendarUnit| - NSMonthCalendarUnit| - NSDayCalendarUnit| - NSWeekdayCalendarUnit| - NSCalendarCalendarUnit + self.month = [calendar components:(NSCalendarUnitYear + |NSCalendarUnitMonth + |NSCalendarUnitDay + |NSCalendarUnitWeekday + |NSCalendarUnitCalendar) fromDate:selectedDate]; self.month.day = 1; [self updateMonthLabelMonth:self.month]; @@ -473,7 +476,7 @@ - (RDVCalendarDayCell *)dayCellForIndex:(NSInteger)index { if (![[self visibleCells] containsObject:dayCell]) { [dayCell prepareForReuse]; - [dayCell.textLabel setText:[NSString stringWithFormat:@"%d", index + 1]]; + [dayCell.textLabel setText:[NSString stringWithFormat:@"%ld", index + 1]]; if (index + 1 == [self currentDay].day && [self month].month == [self currentDay].month && @@ -577,20 +580,20 @@ - (void)deselectDayCellAtIndex:(NSInteger)index animated:(BOOL)animated { #pragma mark - Helper methods - (NSInteger)numberOfWeeks { - return [[self calendar] rangeOfUnit:NSDayCalendarUnit - inUnit:NSWeekCalendarUnit + return [[self calendar] rangeOfUnit:NSCalendarUnitDay + inUnit:NSCalendarUnitWeekOfMonth forDate:[self firstDay]].length; } - (NSInteger)numberOfDays { - return [[self calendar] rangeOfUnit:NSDayCalendarUnit - inUnit:NSMonthCalendarUnit + return [[self calendar] rangeOfUnit:NSCalendarUnitDay + inUnit:NSCalendarUnitMonth forDate:[self firstDay]].length; } - (NSInteger)numberOfDaysInFirstWeek { - return [[self calendar] rangeOfUnit:NSDayCalendarUnit - inUnit:NSWeekCalendarUnit + return [[self calendar] rangeOfUnit:NSCalendarUnitDay + inUnit:NSCalendarUnitWeekOfMonth forDate:[self firstDay]].length; } @@ -632,17 +635,17 @@ - (void)showPreviousMonth { NSDate *date = [calendar dateFromComponents:self.month]; NSDate *newDate = [calendar dateByAddingComponents:inc toDate:date options:0]; - self.month = [calendar components:NSYearCalendarUnit| - NSMonthCalendarUnit| - NSDayCalendarUnit| - NSWeekdayCalendarUnit| - NSCalendarCalendarUnit fromDate:newDate]; + self.month = [calendar components:(NSCalendarUnitYear + |NSCalendarUnitMonth + |NSCalendarUnitDay + |NSCalendarUnitWeekday + |NSCalendarUnitCalendar) + fromDate:newDate]; [self setDisplayedMonth:[self month]]; } - (void)showNextMonth { - NSCalendar *calendar = [self calendar]; NSDateComponents *inc = [[NSDateComponents alloc] init]; inc.month = 1; @@ -650,11 +653,12 @@ - (void)showNextMonth { NSDate *date = [calendar dateFromComponents:self.month]; NSDate *newDate = [calendar dateByAddingComponents:inc toDate:date options:0]; - self.month = [calendar components:NSYearCalendarUnit| - NSMonthCalendarUnit| - NSDayCalendarUnit| - NSWeekdayCalendarUnit| - NSCalendarCalendarUnit fromDate:newDate]; + self.month = [calendar components:(NSCalendarUnitYear + |NSCalendarUnitMonth + |NSCalendarUnitDay + |NSCalendarUnitWeekday + |NSCalendarUnitCalendar) + fromDate:newDate]; [self setDisplayedMonth:[self month]]; }