From 19a46335acd866d0d08bd6fd8867b9ed4cb4fae8 Mon Sep 17 00:00:00 2001 From: Simon Nickel Date: Thu, 4 Jan 2018 16:14:17 +0100 Subject: [PATCH 1/3] project: auto update project settings to current version --- .../JBChartViewDemo.xcodeproj/project.pbxproj | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/JBChartViewDemo/JBChartViewDemo.xcodeproj/project.pbxproj b/JBChartViewDemo/JBChartViewDemo.xcodeproj/project.pbxproj index ca29f2456..61adacb2c 100644 --- a/JBChartViewDemo/JBChartViewDemo.xcodeproj/project.pbxproj +++ b/JBChartViewDemo/JBChartViewDemo.xcodeproj/project.pbxproj @@ -476,7 +476,7 @@ 9B2E52F918218CF20079B9D2 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0710; + LastUpgradeCheck = 0920; ORGANIZATIONNAME = Jawbone; }; buildConfigurationList = 9B2E52FC18218CF20079B9D2 /* Build configuration list for PBXProject "JBChartViewDemo" */; @@ -580,19 +580,30 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; 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_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 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_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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", @@ -605,7 +616,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -620,25 +631,36 @@ CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; 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_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 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_LITERAL_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + 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_NS_ASSERTIONS = NO; + 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_ERROR; GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 7.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; VALIDATE_PRODUCT = YES; @@ -653,7 +675,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "JBChartViewDemo/JBChartViewDemo-Prefix.pch"; INFOPLIST_FILE = "JBChartViewDemo/JBChartViewDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_BUNDLE_IDENTIFIER = "com.jawbone.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; @@ -668,7 +690,7 @@ GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = "JBChartViewDemo/JBChartViewDemo-Prefix.pch"; INFOPLIST_FILE = "JBChartViewDemo/JBChartViewDemo-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_BUNDLE_IDENTIFIER = "com.jawbone.${PRODUCT_NAME:rfc1034identifier}"; PRODUCT_NAME = "$(TARGET_NAME)"; WRAPPER_EXTENSION = app; From 2979e0c54dbaa6a45564240884b56b7acbe1df3c Mon Sep 17 00:00:00 2001 From: Simon Nickel Date: Thu, 4 Jan 2018 16:16:09 +0100 Subject: [PATCH 2/3] fix: resolve block warnings --- Classes/Bar/JBBarChartView.m | 4 ++-- Classes/Base/JBChartView.h | 4 ++-- Classes/Base/JBChartView.m | 4 ++-- Classes/Line/JBLineChartView.m | 4 ++-- Classes/Line/Views/JBLineChartDotsView.h | 2 +- Classes/Line/Views/JBLineChartDotsView.m | 2 +- Classes/Line/Views/JBLineChartLinesView.h | 4 ++-- Classes/Line/Views/JBLineChartLinesView.m | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Classes/Bar/JBBarChartView.m b/Classes/Bar/JBBarChartView.m index f2c5d4db4..7d594a099 100644 --- a/Classes/Bar/JBBarChartView.m +++ b/Classes/Bar/JBBarChartView.m @@ -534,7 +534,7 @@ - (CGFloat)barWidth #pragma mark - Setters -- (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)force callback:(void (^)())callback +- (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)force callback:(void (^)(void))callback { if (self.reloading) { @@ -664,7 +664,7 @@ - (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)for } } -- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)())callback +- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)(void))callback { [self setState:state animated:animated force:NO callback:callback]; } diff --git a/Classes/Base/JBChartView.h b/Classes/Base/JBChartView.h index 6fa941071..b20105e48 100644 --- a/Classes/Base/JBChartView.h +++ b/Classes/Base/JBChartView.h @@ -132,7 +132,7 @@ typedef NS_ENUM(NSInteger, JBChartViewState){ * @param force If current state == new state, then setting force to YES will re-configure the chart (default NO). * @param callback Called once the animation is completed. If animated == NO, then callback is immediate. */ -- (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)force callback:(void (^)())callback; +- (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)force callback:(void (^)(void))callback; /** * State setter. @@ -141,7 +141,7 @@ typedef NS_ENUM(NSInteger, JBChartViewState){ * @param animated Whether or not the state should be animated or not. * @param callback Called once the animation is completed. If animated == NO, then callback is immediate. */ -- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)())callback; +- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)(void))callback; /** * State setter. diff --git a/Classes/Base/JBChartView.m b/Classes/Base/JBChartView.m index 2515475bd..a86118568 100644 --- a/Classes/Base/JBChartView.m +++ b/Classes/Base/JBChartView.m @@ -111,7 +111,7 @@ - (void)setFooterView:(UIView *)footerView [self reloadData]; } -- (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)force callback:(void (^)())callback +- (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)force callback:(void (^)(void))callback { if ((_state == state) && !force) { @@ -123,7 +123,7 @@ - (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)for // Override } -- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)())callback +- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)(void))callback { [self setState:state animated:animated force:NO callback:callback]; } diff --git a/Classes/Line/JBLineChartView.m b/Classes/Line/JBLineChartView.m index 23ac7e18e..d2b73999c 100755 --- a/Classes/Line/JBLineChartView.m +++ b/Classes/Line/JBLineChartView.m @@ -748,7 +748,7 @@ - (CGFloat)lineChartDotsView:(JBLineChartDotsView *)lineChartDotsView dimmedSele #pragma mark - Setters -- (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)force callback:(void (^)())callback +- (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)force callback:(void (^)(void))callback { if (self.reloading) { @@ -814,7 +814,7 @@ - (void)setState:(JBChartViewState)state animated:(BOOL)animated force:(BOOL)for } } -- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)())callback +- (void)setState:(JBChartViewState)state animated:(BOOL)animated callback:(void (^)(void))callback { [self setState:state animated:animated force:NO callback:callback]; } diff --git a/Classes/Line/Views/JBLineChartDotsView.h b/Classes/Line/Views/JBLineChartDotsView.h index b2321843f..b31566a1a 100644 --- a/Classes/Line/Views/JBLineChartDotsView.h +++ b/Classes/Line/Views/JBLineChartDotsView.h @@ -21,7 +21,7 @@ extern NSInteger const kJBLineChartDotsViewUnselectedLineIndex; @property (nonatomic, strong) NSDictionary *dotViewsDict; // Data -- (void)reloadDataAnimated:(BOOL)animated callback:(void (^)())callback; +- (void)reloadDataAnimated:(BOOL)animated callback:(void (^)(void))callback; - (void)reloadDataAnimated:(BOOL)animated; - (void)reloadData; diff --git a/Classes/Line/Views/JBLineChartDotsView.m b/Classes/Line/Views/JBLineChartDotsView.m index 2d4dc2ef1..17a12376b 100644 --- a/Classes/Line/Views/JBLineChartDotsView.m +++ b/Classes/Line/Views/JBLineChartDotsView.m @@ -39,7 +39,7 @@ - (id)initWithFrame:(CGRect)frame #pragma mark - Data -- (void)reloadDataAnimated:(BOOL)animated callback:(void (^)())callback +- (void)reloadDataAnimated:(BOOL)animated callback:(void (^)(void))callback { NSAssert([self.dataSource respondsToSelector:@selector(lineChartLinesForLineChartDotsView:)], @"JBLineChartDotsView // dataSource must implement - (NSArray *)lineChartLinesForLineChartDotsView:(JBLineChartDotsView *)lineChartDotsView"); NSArray *lineChartLines = [self.dataSource lineChartLinesForLineChartDotsView:self]; diff --git a/Classes/Line/Views/JBLineChartLinesView.h b/Classes/Line/Views/JBLineChartLinesView.h index b4f083169..ac5af1d82 100644 --- a/Classes/Line/Views/JBLineChartLinesView.h +++ b/Classes/Line/Views/JBLineChartLinesView.h @@ -20,7 +20,7 @@ extern NSInteger const kJBLineChartLinesViewUnselectedLineIndex; @property (nonatomic, assign) NSInteger selectedLineIndex; // -1 to unselect // Data -- (void)reloadDataAnimated:(BOOL)animated callback:(void (^)())callback; +- (void)reloadDataAnimated:(BOOL)animated callback:(void (^)(void))callback; - (void)reloadDataAnimated:(BOOL)animated; - (void)reloadData; @@ -28,7 +28,7 @@ extern NSInteger const kJBLineChartLinesViewUnselectedLineIndex; - (void)setSelectedLineIndex:(NSInteger)selectedLineIndex animated:(BOOL)animated; // Callback helpers -- (void)fireCallback:(void (^)())callback; +- (void)fireCallback:(void (^)(void))callback; @end diff --git a/Classes/Line/Views/JBLineChartLinesView.m b/Classes/Line/Views/JBLineChartLinesView.m index ea335d5cb..032a19884 100644 --- a/Classes/Line/Views/JBLineChartLinesView.m +++ b/Classes/Line/Views/JBLineChartLinesView.m @@ -195,7 +195,7 @@ - (void)drawRect:(CGRect)rect #pragma mark - Data -- (void)reloadDataAnimated:(BOOL)animated callback:(void (^)())callback +- (void)reloadDataAnimated:(BOOL)animated callback:(void (^)(void))callback { NSAssert([self.dataSource respondsToSelector:@selector(lineChartLinesForLineChartLinesView:)], @"JBLineChartLinesView // dataSource must implement - (NSArray *)lineChartLinesForLineChartLinesView:(JBLineChartLinesView *)lineChartLinesView"); NSArray *chartData = [self.dataSource lineChartLinesForLineChartLinesView:self]; @@ -584,7 +584,7 @@ - (CABasicAnimation *)basicPathAnimationFromBezierPath:(UIBezierPath *)fromBezie #pragma mark - Callback Helpers -- (void)fireCallback:(void (^)())callback +- (void)fireCallback:(void (^)(void))callback { dispatch_block_t callbackCopy = [callback copy]; From c62fb9df6696653d56ee390538bf1cbc0148e60a Mon Sep 17 00:00:00 2001 From: Simon Nickel Date: Thu, 4 Jan 2018 16:21:02 +0100 Subject: [PATCH 3/3] fix: removed font size warning, deployment target has been raised to 8.0 sizeWithAttributes is available since 7.0 --- .../Misc/JBChartInformationView.m | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/JBChartViewDemo/JBChartViewDemo/Misc/JBChartInformationView.m b/JBChartViewDemo/JBChartViewDemo/Misc/JBChartInformationView.m index f5652e11e..d32ea41c4 100644 --- a/JBChartViewDemo/JBChartViewDemo/Misc/JBChartInformationView.m +++ b/JBChartViewDemo/JBChartViewDemo/Misc/JBChartInformationView.m @@ -262,25 +262,11 @@ - (id)initWithFrame:(CGRect)frame - (void)layoutSubviews { CGSize valueLabelSize = CGSizeZero; - if ([self.valueLabel.text respondsToSelector:@selector(sizeWithAttributes:)]) - { - valueLabelSize = [self.valueLabel.text sizeWithAttributes:@{NSFontAttributeName:self.valueLabel.font}]; - } - else - { - valueLabelSize = [self.valueLabel.text sizeWithFont:self.valueLabel.font]; - } + valueLabelSize = [self.valueLabel.text sizeWithAttributes:@{NSFontAttributeName:self.valueLabel.font}]; CGSize unitLabelSize = CGSizeZero; - if ([self.unitLabel.text respondsToSelector:@selector(sizeWithAttributes:)]) - { - unitLabelSize = [self.unitLabel.text sizeWithAttributes:@{NSFontAttributeName:self.unitLabel.font}]; - } - else - { - unitLabelSize = [self.unitLabel.text sizeWithFont:self.unitLabel.font]; - } - + unitLabelSize = [self.unitLabel.text sizeWithAttributes:@{NSFontAttributeName:self.unitLabel.font}]; + CGFloat xOffset = ceil((self.bounds.size.width - (valueLabelSize.width + unitLabelSize.width)) * 0.5); self.valueLabel.frame = CGRectMake(xOffset, ceil(self.bounds.size.height * 0.5) - ceil(valueLabelSize.height * 0.5), valueLabelSize.width, valueLabelSize.height);