Skip to content

Commit

Permalink
- Resolved all deprecation warnings
Browse files Browse the repository at this point in the history
- Added LaunchScreen storyboard
  • Loading branch information
robbdimitrov committed Oct 21, 2018
1 parent 72fbf37 commit 8e36a55
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 40 deletions.
30 changes: 30 additions & 0 deletions Example/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="b2Y-Uh-wnH">
<device id="retina4_7" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.14"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="ySD-sB-ZbG">
<objects>
<viewController id="b2Y-Uh-wnH" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="c0x-rr-jDT"/>
<viewControllerLayoutGuide type="bottom" id="ygF-GN-bR7"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="cpa-lQ-E1Z">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="b8z-xi-DOx" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
</scene>
</scenes>
</document>
4 changes: 3 additions & 1 deletion Example/RDVCalendarView-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.robbdimitrov.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand All @@ -24,6 +24,8 @@
<string>1.0</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
51 changes: 46 additions & 5 deletions RDVCalendarView.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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 */; };
Expand Down Expand Up @@ -49,6 +50,7 @@
62F77D5617BE00BB009873CE /* RDVCalendarView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = RDVCalendarView.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
62F77D5817BE0105009873CE /* RDVCalendarDayCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RDVCalendarDayCell.h; sourceTree = "<group>"; };
62F77D5917BE0105009873CE /* RDVCalendarDayCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RDVCalendarDayCell.m; sourceTree = "<group>"; };
B4005E9A217CDB1400AABBFE /* LaunchScreen.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
B44421A617BE61A300A048A6 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = "<group>"; };
B44421A717BE61A300A048A6 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.md; sourceTree = "<group>"; };
B463BCB218265F0400BF5848 /* iPad-small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "iPad-small.png"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -94,6 +96,7 @@
62C2388A17CB463C009B4090 /* main.m */,
62C2388D17CB463C009B4090 /* RDVCalendarView-Info.plist */,
62C2388E17CB463C009B4090 /* RDVCalendarView-Prefix.pch */,
B4005E9A217CDB1400AABBFE /* LaunchScreen.storyboard */,
);
name = "Supporting Files";
sourceTree = "<group>";
Expand Down Expand Up @@ -193,7 +196,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = RDV;
LastUpgradeCheck = 0460;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Robert Dimitrov";
};
buildConfigurationList = 62F77D2D17BE0080009873CE /* Build configuration list for PBXProject "RDVCalendarView" */;
Expand Down Expand Up @@ -227,6 +230,7 @@
62C2388F17CB463C009B4090 /* [email protected] in Resources */,
62C2389017CB463C009B4090 /* Default.png in Resources */,
62C2389117CB463C009B4090 /* [email protected] in Resources */,
B4005E9B217CDB1400AABBFE /* LaunchScreen.storyboard in Resources */,
62C2389217CB463C009B4090 /* InfoPlist.strings in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -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";
Expand All @@ -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";
Expand All @@ -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;
Expand All @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions RDVCalendarView/RDVCalendarDayCell.m
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down
68 changes: 36 additions & 32 deletions RDVCalendarView/RDVCalendarView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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 &&
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -632,29 +635,30 @@ - (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;

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]];
}
Expand Down

0 comments on commit 8e36a55

Please sign in to comment.