From 1a5c6611fd101bf1332c445c85c431a09662432e Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sun, 17 Apr 2016 14:53:55 -0400 Subject: [PATCH 001/212] Fixed a plot range animation bug. --- framework/Source/CPTAnimation.m | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/framework/Source/CPTAnimation.m b/framework/Source/CPTAnimation.m index 967defe85..b4ff5f3e6 100644 --- a/framework/Source/CPTAnimation.m +++ b/framework/Source/CPTAnimation.m @@ -3,6 +3,7 @@ #import "CPTAnimationOperation.h" #import "CPTAnimationPeriod.h" #import "CPTDefinitions.h" +#import "CPTPlotRange.h" #import "_CPTAnimationTimingFunctions.h" static const CGFloat kCPTAnimationFrameRate = CPTFloat(1.0 / 60.0); // 60 frames per second @@ -406,6 +407,13 @@ -(void)updateOnMainThreadWithParameters:(nonnull CPTDictionary *)parameters SetterType setterMethod = (SetterType)[boundObject methodForSelector:boundSetter]; setterMethod(boundObject, boundSetter, buffer); } + else if ( [tweenedValue isKindOfClass:[CPTPlotRange class]] ) { + CPTPlotRange *range = (CPTPlotRange *)tweenedValue; + + typedef void (*RangeSetterType)(id, SEL, CPTPlotRange *); + RangeSetterType setterMethod = (RangeSetterType)[boundObject methodForSelector:boundSetter]; + setterMethod(boundObject, boundSetter, range); + } else { // wrapped scalars and structs NSValue *value = (NSValue *)tweenedValue; From cb9639583755edd3e394667cc1b03824fb86ac5f Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 22 Apr 2016 13:07:05 -0400 Subject: [PATCH 002/212] Updated the Mac deployment target to OS X 10.8 (fixed a merge error from release 2.1). --- framework/CorePlot.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/CorePlot.xcodeproj/project.pbxproj b/framework/CorePlot.xcodeproj/project.pbxproj index 05807c599..114400ad1 100644 --- a/framework/CorePlot.xcodeproj/project.pbxproj +++ b/framework/CorePlot.xcodeproj/project.pbxproj @@ -3253,7 +3253,7 @@ FRAMEWORK_VERSION = A; INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-Info.plist"; INSTALL_PATH = "@rpath"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = macosx; @@ -3272,7 +3272,7 @@ FRAMEWORK_VERSION = A; INFOPLIST_FILE = "$(SRCROOT)/Info/CorePlot-Info.plist"; INSTALL_PATH = "@rpath"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = macosx; From 1d09d5e71493988d81962f82334e40fc517f2060 Mon Sep 17 00:00:00 2001 From: Tim Monzures Date: Thu, 12 May 2016 14:40:51 +0800 Subject: [PATCH 003/212] Enable support for retina monitors when calling imageOfLayer --- .../MacOnly/CPTPlatformSpecificCategories.m | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.m b/framework/MacOnly/CPTPlatformSpecificCategories.m index 1030e5798..dc5435a8f 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.m +++ b/framework/MacOnly/CPTPlatformSpecificCategories.m @@ -12,30 +12,40 @@ @implementation CPTLayer(CPTPlatformSpecificLayerExtensions) -(nonnull CPTNativeImage *)imageOfLayer { CGSize boundsSize = self.bounds.size; - - NSBitmapImageRep *layerImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:(NSInteger)boundsSize.width - pixelsHigh:(NSInteger)boundsSize.height - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSCalibratedRGBColorSpace - bytesPerRow:(NSInteger)boundsSize.width * 4 - bitsPerPixel:32]; - + + // Figure out the scale of pixels to points + CGFloat scale = [[NSScreen mainScreen] backingScaleFactor]; + + NSBitmapImageRep *layerImage = [[NSBitmapImageRep alloc] + initWithBitmapDataPlanes:NULL + pixelsWide:(NSInteger)(boundsSize.width * scale) + pixelsHigh:(NSInteger)(boundsSize.height * scale) + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSCalibratedRGBColorSpace + bitmapFormat:NSAlphaFirstBitmapFormat + bytesPerRow:0 + bitsPerPixel:0 + ]; + + + // Setting the size communicates the dpi; enables proper scaling for Retina screens + [layerImage setSize:NSMakeSize(boundsSize.width, boundsSize.height)]; + NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; - + CGContextClearRect( context, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); CGContextSetAllowsAntialiasing(context, true); CGContextSetShouldSmoothFonts(context, false); [self layoutAndRenderInContext:context]; CGContextFlush(context); - + NSImage *image = [[NSImage alloc] initWithSize:NSSizeFromCGSize(boundsSize)]; [image addRepresentation:layerImage]; - + return image; } From b4cc5ae17cd42ad06b3097a988a524ef3b9c1312 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 13 May 2016 21:14:19 -0400 Subject: [PATCH 004/212] Updated formatting configuration for Uncrustify 0.63. --- examples/DropPlot/CPTPlotDocument.m | 2 +- framework/Source/CPTBarPlot.m | 8 ++++---- framework/Source/CPTCalendarFormatter.m | 8 ++++---- framework/Source/CPTPlot.m | 2 +- framework/iPhoneOnly/CPTTextStylePlatformSpecific.h | 2 +- scripts/uncrustify.cfg | 11 ++++++++++- 6 files changed, 21 insertions(+), 12 deletions(-) diff --git a/examples/DropPlot/CPTPlotDocument.m b/examples/DropPlot/CPTPlotDocument.m index 41ef93d2f..22bcfec78 100644 --- a/examples/DropPlot/CPTPlotDocument.m +++ b/examples/DropPlot/CPTPlotDocument.m @@ -156,7 +156,7 @@ -(BOOL)readFromData:(nonnull NSData *)data ofType:(NSString *)typeName error:(NS NSString *fileContents = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding]; // Parse CSV - NSUInteger length = fileContents.length; + NSUInteger length = fileContents.length; NSUInteger lineStart = 0, lineEnd = 0, contentsEnd = 0; NSRange currentRange; diff --git a/framework/Source/CPTBarPlot.m b/framework/Source/CPTBarPlot.m index 16e6c6e60..839825dd0 100644 --- a/framework/Source/CPTBarPlot.m +++ b/framework/Source/CPTBarPlot.m @@ -656,8 +656,8 @@ -(double)doubleLengthInPlotCoordinates:(NSDecimal)decimalLength double length; if ( self.barWidthsAreInViewCoordinates ) { - CGFloat floatLength = CPTDecimalCGFloatValue(decimalLength); - CGPoint originViewPoint = CGPointZero; + CGFloat floatLength = CPTDecimalCGFloatValue(decimalLength); + CGPoint originViewPoint = CGPointZero; CGPoint displacedViewPoint = CPTPointMake(floatLength, floatLength); double originPlotPoint[2], displacedPlotPoint[2]; CPTPlotSpace *thePlotSpace = self.plotSpace; @@ -681,8 +681,8 @@ -(NSDecimal)lengthInPlotCoordinates:(NSDecimal)decimalLength NSDecimal length; if ( self.barWidthsAreInViewCoordinates ) { - CGFloat floatLength = CPTDecimalCGFloatValue(decimalLength); - CGPoint originViewPoint = CGPointZero; + CGFloat floatLength = CPTDecimalCGFloatValue(decimalLength); + CGPoint originViewPoint = CGPointZero; CGPoint displacedViewPoint = CPTPointMake(floatLength, floatLength); NSDecimal originPlotPoint[2], displacedPlotPoint[2]; CPTPlotSpace *thePlotSpace = self.plotSpace; diff --git a/framework/Source/CPTCalendarFormatter.m b/framework/Source/CPTCalendarFormatter.m index dcaa8b8e8..abb1c3be0 100644 --- a/framework/Source/CPTCalendarFormatter.m +++ b/framework/Source/CPTCalendarFormatter.m @@ -189,7 +189,7 @@ -(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue dateComponents.weekdayOrdinal = componentIncrement; break; -#if MAC_OS_X_VERSION_10_5 < MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_3_0 < __IPHONE_OS_VERSION_MAX_ALLOWED +#if MAC_OS_X_VERSION_10_5 *cachedLabels = (NSMutableArray *)[self cachedArrayForKey: CPTPlotBindingDataLabels]; + NSMutableArray *cachedLabels = (NSMutableArray *)[self cachedArrayForKey:CPTPlotBindingDataLabels]; for ( CPTLayer *label in cachedLabels ) { if ( ![label isKindOfClass:nullClass] ) { hasCachedLabels = YES; diff --git a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h index 98141e3a3..b6f4e498f 100644 --- a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h +++ b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h @@ -14,7 +14,7 @@ typedef NS_ENUM (NSInteger, CPTTextAlignment) { // @cond // for iOS SDK compatibility #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE -#if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000 +#if __IPHONE_OS_VERSION_MAX_ALLOWED<70000 @interface NSString(CPTTextStylePlatformSpecificExtensions) -(CGSize)sizeWithAttributes:(nonnull CPTDictionary *)attrs; diff --git a/scripts/uncrustify.cfg b/scripts/uncrustify.cfg index af6a1fc0b..9a72e033e 100644 --- a/scripts/uncrustify.cfg +++ b/scripts/uncrustify.cfg @@ -1,4 +1,4 @@ -# Uncrustify 0.62 +# Uncrustify 0.63 newlines = auto input_tab_size = 4 output_tab_size = 4 @@ -292,6 +292,7 @@ align_pp_define_together = false align_pp_define_gap = 1 align_pp_define_span = 2 align_left_shift = true +align_asm_colon = false align_oc_msg_colon_span = 16 align_oc_msg_colon_first = false align_oc_decl_colon = true @@ -405,6 +406,8 @@ nl_before_do = ignore nl_after_do = ignore nl_ds_struct_enum_cmt = false nl_ds_struct_enum_close_brace = false +nl_before_func_class_def = 0 +nl_before_func_class_proto = 0 nl_class_colon = remove nl_constr_colon = ignore nl_create_if_one_liner = true @@ -427,6 +430,8 @@ ls_code_width = false nl_max = 2 nl_after_func_proto = 1 nl_after_func_proto_group = 2 +nl_before_func_body_def = 0 +nl_before_func_body_proto = 0 nl_after_func_body = 2 nl_after_func_body_class = 0 nl_after_func_body_one_liner = 1 @@ -505,3 +510,7 @@ pp_region_indent_code = false pp_indent_if = 0 pp_if_indent_code = false pp_define_at_level = false +use_indent_func_call_param = true +use_indent_continue_only_once = false +# option(s) with 'not default' value: 0 +# From 72a939094a894e79119853e4725b22355e7619b5 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 14 May 2016 07:50:47 -0400 Subject: [PATCH 005/212] Standardized code formatting. --- .../MacOnly/CPTPlatformSpecificCategories.m | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.m b/framework/MacOnly/CPTPlatformSpecificCategories.m index dc5435a8f..5ad813a76 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.m +++ b/framework/MacOnly/CPTPlatformSpecificCategories.m @@ -12,40 +12,39 @@ @implementation CPTLayer(CPTPlatformSpecificLayerExtensions) -(nonnull CPTNativeImage *)imageOfLayer { CGSize boundsSize = self.bounds.size; - + // Figure out the scale of pixels to points CGFloat scale = [[NSScreen mainScreen] backingScaleFactor]; - + NSBitmapImageRep *layerImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL - pixelsWide:(NSInteger)(boundsSize.width * scale) - pixelsHigh:(NSInteger)(boundsSize.height * scale) - bitsPerSample:8 - samplesPerPixel:4 - hasAlpha:YES - isPlanar:NO - colorSpaceName:NSCalibratedRGBColorSpace - bitmapFormat:NSAlphaFirstBitmapFormat - bytesPerRow:0 - bitsPerPixel:0 - ]; - - + pixelsWide:(NSInteger)(boundsSize.width * scale) + pixelsHigh:(NSInteger)(boundsSize.height * scale) + bitsPerSample:8 + samplesPerPixel:4 + hasAlpha:YES + isPlanar:NO + colorSpaceName:NSCalibratedRGBColorSpace + bitmapFormat:NSAlphaFirstBitmapFormat + bytesPerRow:0 + bitsPerPixel:0 + ]; + // Setting the size communicates the dpi; enables proper scaling for Retina screens [layerImage setSize:NSMakeSize(boundsSize.width, boundsSize.height)]; - + NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; - + CGContextClearRect( context, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); CGContextSetAllowsAntialiasing(context, true); CGContextSetShouldSmoothFonts(context, false); [self layoutAndRenderInContext:context]; CGContextFlush(context); - + NSImage *image = [[NSImage alloc] initWithSize:NSSizeFromCGSize(boundsSize)]; [image addRepresentation:layerImage]; - + return image; } From ee50e56ee6e7069a7cefb01fbd20638d0faa4a11 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 14 May 2016 13:14:43 -0400 Subject: [PATCH 006/212] Use the window backing scale factor (when available) instead of the main screen to generate an image from layer contents. --- .../MacOnly/CPTPlatformSpecificCategories.m | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.m b/framework/MacOnly/CPTPlatformSpecificCategories.m index 5ad813a76..b87e1ab6d 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.m +++ b/framework/MacOnly/CPTPlatformSpecificCategories.m @@ -1,5 +1,7 @@ #import "CPTPlatformSpecificCategories.h" +#import "CPTGraph.h" +#import "CPTGraphHostingView.h" #import "CPTPlatformSpecificFunctions.h" #pragma mark CPTLayer @@ -14,7 +16,21 @@ -(nonnull CPTNativeImage *)imageOfLayer CGSize boundsSize = self.bounds.size; // Figure out the scale of pixels to points - CGFloat scale = [[NSScreen mainScreen] backingScaleFactor]; + CGFloat scale = 0.0; + + if ( [self respondsToSelector:@selector(hostingView)] ) { + scale = ( (CPTGraph *)self ).hostingView.window.backingScaleFactor; + } + else { + NSWindow *myWindow = self.graph.hostingView.window; + + if ( myWindow ) { + scale = myWindow.backingScaleFactor; + } + else { + scale = [NSScreen mainScreen].backingScaleFactor; + } + } NSBitmapImageRep *layerImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL @@ -31,7 +47,7 @@ -(nonnull CPTNativeImage *)imageOfLayer ]; // Setting the size communicates the dpi; enables proper scaling for Retina screens - [layerImage setSize:NSMakeSize(boundsSize.width, boundsSize.height)]; + layerImage.size = NSSizeFromCGSize(boundsSize); NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; From 608b162b0b780216a08b4fec5a38dc87efe7c759 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 14 May 2016 13:16:53 -0400 Subject: [PATCH 007/212] Added Tim Monzures to the license file. --- License.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/License.txt b/License.txt index 53ba4f2a8..e9bf9f52d 100644 --- a/License.txt +++ b/License.txt @@ -1,4 +1,4 @@ -Copyright (c) 2015, Drew McCormack, Brad Larson, Eric Skroch, Barry Wark, Dirkjan Krijnders, Rick Maddy, Vijay Kalusani, Caleb Cannon, Jeff Buck, Thomas Elstner, Jeroen Leenarts, Craig Hockenberry, Hartwig Wiesmann, Koen van der Drift, Nino Ag, Mike Lischke, Trevor Harmon, Travis Fischer, Graham Mueller, Rafał Wójcik, Mike Rossetti, Michael Merickel, Lane Roathe, Ingmar Stein, Sean Holbert, Victor Martin Garcia, Jérôme Morissard, and Demitri Muna. +Copyright (c) 2015, Drew McCormack, Brad Larson, Eric Skroch, Barry Wark, Dirkjan Krijnders, Rick Maddy, Vijay Kalusani, Caleb Cannon, Jeff Buck, Thomas Elstner, Jeroen Leenarts, Craig Hockenberry, Hartwig Wiesmann, Koen van der Drift, Nino Ag, Mike Lischke, Trevor Harmon, Travis Fischer, Graham Mueller, Rafał Wójcik, Mike Rossetti, Michael Merickel, Lane Roathe, Ingmar Stein, Sean Holbert, Victor Martin Garcia, Jérôme Morissard, Demitri Muna, and Tim Monzures. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: From 0b03b9b0b52d15a2e9e79cc63424d73f7d29a714 Mon Sep 17 00:00:00 2001 From: Kal Conley Date: Tue, 14 Jun 2016 13:41:54 +0200 Subject: [PATCH 008/212] Fix conflicting nullability specifier errors with iOS 10 SDK --- framework/Source/CPTCalendarFormatter.m | 2 +- framework/Source/CPTTimeFormatter.m | 2 +- framework/iPhoneOnly/CPTGraphHostingView.m | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/framework/Source/CPTCalendarFormatter.m b/framework/Source/CPTCalendarFormatter.m index dcaa8b8e8..bef5ccd61 100644 --- a/framework/Source/CPTCalendarFormatter.m +++ b/framework/Source/CPTCalendarFormatter.m @@ -142,7 +142,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone * @param coordinateValue The time value. * @return The date string. **/ --(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue +-(nullable NSString *)stringForObjectValue:(id)coordinateValue { NSInteger componentIncrement = 0; diff --git a/framework/Source/CPTTimeFormatter.m b/framework/Source/CPTTimeFormatter.m index d35d6dc94..ed20c9866 100644 --- a/framework/Source/CPTTimeFormatter.m +++ b/framework/Source/CPTTimeFormatter.m @@ -116,7 +116,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone * @param coordinateValue The time value. * @return The date string. **/ --(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue +-(nullable NSString *)stringForObjectValue:(id)coordinateValue { NSString *string = nil; diff --git a/framework/iPhoneOnly/CPTGraphHostingView.m b/framework/iPhoneOnly/CPTGraphHostingView.m index 83a5586b1..a9dd03030 100644 --- a/framework/iPhoneOnly/CPTGraphHostingView.m +++ b/framework/iPhoneOnly/CPTGraphHostingView.m @@ -230,7 +230,7 @@ -(void)touchesEnded:(nonnull NSSet *)touches withEvent:(nullable UIEv } } --(void)touchesCancelled:(nullable NSSet *)touches withEvent:(nullable UIEvent *)event +-(void)touchesCancelled:(NSSet *)touches withEvent:(nullable UIEvent *)event { BOOL handled = NO; From c96d31ee078e7597421e25b6e71e86f8a8cc48d9 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Tue, 14 Jun 2016 22:42:12 -0400 Subject: [PATCH 009/212] Increased the iOS deployment target to iOS 8. Updated all project files for Xcode 8. --- .../project.pbxproj | 64 +++++++++++++++++- .../xcschemes/Build & Copy.xcscheme | 5 +- .../xcschemes/CorePlotQCPlugin.xcscheme | 2 +- documentation/changelog.markdown | 12 ++++ .../AAPLot/AAPLot.xcodeproj/project.pbxproj | 64 +++++++++++++++++- .../xcshareddata/xcschemes/AAPLot.xcscheme | 2 +- .../CPTTestApp-iPad.xcodeproj/project.pbxproj | 64 +++++++++++++++++- .../xcschemes/CPTTestApp-iPad.xcscheme | 2 +- .../project.pbxproj | 65 ++++++++++++++++++- .../xcschemes/CPTTestApp-iPhone.xcscheme | 2 +- .../CPTTestApp.xcodeproj/project.pbxproj | 31 ++++++++- .../xcschemes/CPTTestApp.xcscheme | 2 +- .../Plot_Gallery.xcodeproj/project.pbxproj | 30 ++++++++- .../xcschemes/Plot Gallery-Mac.xcscheme | 2 +- .../xcschemes/Plot Gallery-iOS.xcscheme | 2 +- .../xcschemes/Plot Gallery-tvOS.xcscheme | 2 +- .../DatePlot.xcodeproj/project.pbxproj | 31 ++++++++- .../xcshareddata/xcschemes/DatePlot.xcscheme | 2 +- .../DropPlot.xcodeproj/project.pbxproj | 30 ++++++++- .../xcshareddata/xcschemes/DropPlot.xcscheme | 2 +- .../project.pbxproj | 30 ++++++++- .../xcschemes/minorTickFormatter.xcscheme | 2 +- .../RangePlot.xcodeproj/project.pbxproj | 30 ++++++++- .../xcshareddata/xcschemes/RangePlot.xcscheme | 2 +- .../StockPlot.xcodeproj/project.pbxproj | 64 +++++++++++++++++- .../xcshareddata/xcschemes/StockPlot.xcscheme | 2 +- framework/CorePlot.xcodeproj/project.pbxproj | 46 +++++++++++-- .../xcschemes/CorePlot Mac.xcscheme | 2 +- .../xcschemes/CorePlot iOS.xcscheme | 2 +- .../xcschemes/CorePlot tvOS.xcscheme | 2 +- .../xcschemes/CorePlot-CocoaTouch.xcscheme | 2 +- .../xcschemes/Documentation-Mac.xcscheme | 2 +- .../xcschemes/Documentation-iOS.xcscheme | 2 +- .../xcschemes/Universal Library.xcscheme | 2 +- .../Universal iOS Framework.xcscheme | 2 +- 35 files changed, 557 insertions(+), 51 deletions(-) diff --git a/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj b/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj index 4f7d5cf2e..036b9dd6b 100644 --- a/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj +++ b/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj @@ -62,6 +62,20 @@ remoteGlobalIDString = 8DC2EF4F0486A6940098B216; remoteInfo = CorePlot; }; + C31D02421D10F531008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A89BAB3B1027EFBD004B2FE1 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C31D02441D10F531008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = A89BAB3B1027EFBD004B2FE1 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3B925EA1ADF1CBE00C67086 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = A89BAB3B1027EFBD004B2FE1 /* CorePlot.xcodeproj */; @@ -213,6 +227,8 @@ C3B925ED1ADF1CBE00C67086 /* UnitTests iOS.xctest */, C3B925EF1ADF1CBE00C67086 /* libCorePlot-CocoaTouch.a */, C3B925F11ADF1CBE00C67086 /* CorePlot-CocoaTouchTests.xctest */, + C31D02431D10F531008C1EF2 /* CorePlot.framework */, + C31D02451D10F531008C1EF2 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -246,7 +262,7 @@ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0800; }; buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "CorePlotQCPlugin" */; compatibilityVersion = "Xcode 6.3"; @@ -289,6 +305,20 @@ remoteRef = BC21A97E1035BEAF00FED2A4 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + C31D02431D10F531008C1EF2 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C31D02421D10F531008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C31D02451D10F531008C1EF2 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C31D02441D10F531008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3B925EB1ADF1CBE00C67086 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -437,8 +467,24 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + 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; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SYMROOT = "$(PROJECT_DIR)/../build"; @@ -449,7 +495,23 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = c99; + 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; MACOSX_DEPLOYMENT_TARGET = 10.8; OTHER_LDFLAGS = ""; SYMROOT = "$(PROJECT_DIR)/../build"; diff --git a/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme b/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme index 4b733b333..a994e62a5 100644 --- a/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme +++ b/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme @@ -1,6 +1,6 @@ + buildForAnalyzing = "YES"> Date: Tue, 14 Jun 2016 22:42:30 -0400 Subject: [PATCH 010/212] Enabled new compiler warnings. --- framework/xcconfig/CorePlotWarnings.xcconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/framework/xcconfig/CorePlotWarnings.xcconfig b/framework/xcconfig/CorePlotWarnings.xcconfig index 599c13467..63c6691c4 100644 --- a/framework/xcconfig/CorePlotWarnings.xcconfig +++ b/framework/xcconfig/CorePlotWarnings.xcconfig @@ -55,7 +55,12 @@ ENABLE_STRICT_OBJC_MSGSEND = YES CLANG_ANALYZER_DEADCODE_DEADSTORES = YES CLANG_ANALYZER_MEMORY_MANAGEMENT = YES CLANG_ANALYZER_GCD = YES +CLANG_ANALYZER_LOCALIZABILITY_EMPTY_CONTEXT = YES +CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES +CLANG_ANALYZER_NONNULL = YES CLANG_ANALYZER_OBJC_ATSYNC = YES +CLANG_ANALYZER_OBJC_DEALLOC = YES +CLANG_ANALYZER_OBJC_GENERICS = YES CLANG_ANALYZER_OBJC_NSCFERROR = YES CLANG_ANALYZER_OBJC_INCOMP_METHOD_TYPES = YES CLANG_ANALYZER_OBJC_COLLECTIONS = YES From 3a8f03195031c815f8cb792e2fe06653331952fb Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Tue, 14 Jun 2016 23:07:03 -0400 Subject: [PATCH 011/212] Fixed Xcode 8 compiler warnings in the framework project. --- framework/Source/CPTBarPlot.m | 4 +-- framework/Source/CPTCalendarFormatter.m | 2 +- framework/Source/CPTImage.m | 38 +++++++++++++++------- framework/Source/CPTTimeFormatter.m | 2 +- framework/iPhoneOnly/CPTGraphHostingView.m | 2 +- 5 files changed, 32 insertions(+), 16 deletions(-) diff --git a/framework/Source/CPTBarPlot.m b/framework/Source/CPTBarPlot.m index 839825dd0..06bed146e 100644 --- a/framework/Source/CPTBarPlot.m +++ b/framework/Source/CPTBarPlot.m @@ -44,7 +44,7 @@ @interface CPTBarPlot() @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint tipPoint:(nonnull CGPoint *)tipPoint; --(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex; +-(nullable CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex; -(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint; -(nullable CPTFill *)barFillForIndex:(NSUInteger)idx; -(nullable CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx; @@ -934,7 +934,7 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint t return YES; } --(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex +-(nullable CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex { // Get base and tip points CGPoint basePoint, tipPoint; diff --git a/framework/Source/CPTCalendarFormatter.m b/framework/Source/CPTCalendarFormatter.m index 6a23d6c45..73ee6ec0b 100644 --- a/framework/Source/CPTCalendarFormatter.m +++ b/framework/Source/CPTCalendarFormatter.m @@ -142,7 +142,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone * @param coordinateValue The time value. * @return The date string. **/ --(nullable NSString *)stringForObjectValue:(id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSInteger componentIncrement = 0; diff --git a/framework/Source/CPTImage.m b/framework/Source/CPTImage.m index b94389961..a761c723a 100644 --- a/framework/Source/CPTImage.m +++ b/framework/Source/CPTImage.m @@ -19,7 +19,7 @@ typedef NS_ENUM (NSInteger, CPTSlice) { }; typedef struct _CPTImageSlices { - CGImageRef slice[9]; ///< The image slices used to render a stretchable image. + __nonnull CGImageRef slice[9]; ///< The image slices used to render a stretchable image. } CPTImageSlices; @@ -592,7 +592,10 @@ -(void)setSlices:(CPTImageSlices)newSlices for ( NSUInteger i = 0; i < 9; i++ ) { CGImageRelease(slices.slice[i]); - slices.slice[i] = CGImageRetain(newSlices.slice[i]); + CGImageRef slice = CGImageRetain(newSlices.slice[i]); + if ( slice ) { + slices.slice[i] = slice; + } } } @@ -630,45 +633,54 @@ -(void)makeImageSlices // top row if ( capTop > CPTFloat(0.0) ) { if ( capLeft > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceTopLeft] = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, 0.0, capLeft, capTop) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, 0.0, capLeft, capTop) ); + imageSlices.slice[CPTSliceTopLeft] = sliceImage; } if ( centerSize.width > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceTop] = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, 0.0, centerSize.width, capTop) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, 0.0, centerSize.width, capTop) ); + imageSlices.slice[CPTSliceTop] = sliceImage; } if ( capRight > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceTopRight] = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, 0.0, capRight, capTop) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, 0.0, capRight, capTop) ); + imageSlices.slice[CPTSliceTopRight] = sliceImage; } } // middle row if ( centerSize.height > CPTFloat(0.0) ) { if ( capLeft > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceLeft] = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, capTop, capLeft, centerSize.height) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, capTop, capLeft, centerSize.height) ); + imageSlices.slice[CPTSliceLeft] = sliceImage; } if ( centerSize.width > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceMiddle] = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, capTop, centerSize.width, centerSize.height) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, capTop, centerSize.width, centerSize.height) ); + imageSlices.slice[CPTSliceMiddle] = sliceImage; } if ( capRight > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceRight] = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, capTop, capRight, centerSize.height) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, capTop, capRight, centerSize.height) ); + imageSlices.slice[CPTSliceRight] = sliceImage; } } // bottom row if ( capBottom > CPTFloat(0.0) ) { if ( capLeft > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceBottomLeft] = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, height - capBottom, capLeft, capBottom) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, height - capBottom, capLeft, capBottom) ); + imageSlices.slice[CPTSliceBottomLeft] = sliceImage; } if ( centerSize.width > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceBottom] = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, height - capBottom, centerSize.width, capBottom) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(capLeft, height - capBottom, centerSize.width, capBottom) ); + imageSlices.slice[CPTSliceBottom] = sliceImage; } if ( capRight > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceBottomRight] = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, height - capBottom, capRight, capBottom) ); + CGImageRef sliceImage = CGImageCreateWithImageInRect( theImage, CPTRectMake(width - capRight, height - capBottom, capRight, capBottom) ); + imageSlices.slice[CPTSliceBottomRight] = sliceImage; } } @@ -752,6 +764,10 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context } } + if ( !theImage ) { + return; + } + // draw the image CGFloat imageScale = self.scale; CGFloat scaleRatio = contextScale / imageScale; diff --git a/framework/Source/CPTTimeFormatter.m b/framework/Source/CPTTimeFormatter.m index ed20c9866..4abfd3967 100644 --- a/framework/Source/CPTTimeFormatter.m +++ b/framework/Source/CPTTimeFormatter.m @@ -116,7 +116,7 @@ -(nonnull id)copyWithZone:(nullable NSZone *)zone * @param coordinateValue The time value. * @return The date string. **/ --(nullable NSString *)stringForObjectValue:(id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSString *string = nil; diff --git a/framework/iPhoneOnly/CPTGraphHostingView.m b/framework/iPhoneOnly/CPTGraphHostingView.m index a9dd03030..ccf0df3e5 100644 --- a/framework/iPhoneOnly/CPTGraphHostingView.m +++ b/framework/iPhoneOnly/CPTGraphHostingView.m @@ -230,7 +230,7 @@ -(void)touchesEnded:(nonnull NSSet *)touches withEvent:(nullable UIEv } } --(void)touchesCancelled:(NSSet *)touches withEvent:(nullable UIEvent *)event +-(void)touchesCancelled:(nonnull NSSet *)touches withEvent:(nullable UIEvent *)event { BOOL handled = NO; From 756772942af5d73160f05398e5acee800c724f25 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Tue, 14 Jun 2016 23:07:25 -0400 Subject: [PATCH 012/212] Fixed Xcode 8 compiler warnings in the Objective-C example apps. --- QCPlugin/CPTBarPlotPlugin.m | 7 +++++-- QCPlugin/CPTPieChartPlugin.m | 2 +- QCPlugin/CPTScatterPlotPlugin.m | 7 +++++-- QCPlugin/CorePlotQCPlugin.h | 4 ++-- QCPlugin/CorePlotQCPlugin.m | 19 ++++++++++++------- examples/AAPLot/Classes/RootViewController.m | 2 +- .../src/ios/DetailViewController.m | 2 ++ .../src/ios/ThemeTableViewController.m | 2 ++ .../src/plots/CandlestickPlot.m | 4 ++-- .../CorePlotGallery/src/plots/FunctionPlot.m | 6 +++--- examples/CorePlotGallery/src/plots/OHLCPlot.m | 2 +- .../CorePlotGallery/src/plots/RangePlot.m | 2 +- .../src/shared/PiNumberFormatter.m | 2 +- .../CorePlotGallery/src/shared/PlotItem.m | 4 ++-- .../src/tvOS/DetailViewControllerTV.m | 2 ++ .../src/tvOS/ThemeTableViewControllerTV.m | 2 ++ .../StockPlot/Classes/RootViewController.m | 5 ++--- 17 files changed, 46 insertions(+), 28 deletions(-) diff --git a/QCPlugin/CPTBarPlotPlugin.m b/QCPlugin/CPTBarPlotPlugin.m index 98757ff2e..8a85bd372 100644 --- a/QCPlugin/CPTBarPlotPlugin.m +++ b/QCPlugin/CPTBarPlotPlugin.m @@ -35,7 +35,7 @@ @implementation CPTBarPlotPlugIn }; } -+(nonnull CPTDictionary *)attributesForPropertyPortWithKey:(nonnull NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { // A few additional ports for the bar plot chart type ... @@ -177,7 +177,10 @@ -(BOOL)configurePlots plot.barWidth = @(barWidth); plot.barOffset = @(self.inputBarOffset); plot.barsAreHorizontal = self.inputHorizontalBars; - plot.fill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:[self areaFillColor:index]]]; + CGColorRef fillColor = [self areaFillColor:index]; + if ( fillColor ) { + plot.fill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:fillColor]]; + } [plot reloadData]; } diff --git a/QCPlugin/CPTPieChartPlugin.m b/QCPlugin/CPTPieChartPlugin.m index d2a6628d5..a7ca04379 100644 --- a/QCPlugin/CPTPieChartPlugin.m +++ b/QCPlugin/CPTPieChartPlugin.m @@ -67,7 +67,7 @@ +(nonnull CPTStringArray *)sortedPropertyPortKeys return [[super sortedPropertyPortKeys] arrayByAddingObjectsFromArray:pieChartPropertyPortKeys]; } -+(nonnull CPTDictionary *)attributesForPropertyPortWithKey:(nonnull NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { // A few additional ports for the pie chart type ... if ( [key isEqualToString:@"inputPieRadius"] ) { diff --git a/QCPlugin/CPTScatterPlotPlugin.m b/QCPlugin/CPTScatterPlotPlugin.m index dbe784b14..3fd32a752 100644 --- a/QCPlugin/CPTScatterPlotPlugin.m +++ b/QCPlugin/CPTScatterPlotPlugin.m @@ -193,8 +193,11 @@ -(BOOL)configurePlots plot.plotSymbol.lineStyle = lineStyle; plot.plotSymbol.fill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:[self dataSymbolColor:index]]]; plot.plotSymbol.size = CGSizeMake(10.0, 10.0); - plot.areaFill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:[self areaFillColor:index]]]; - plot.areaBaseValue = @( MAX( self.inputYMin, MIN(self.inputYMax, 0.0) ) ); + CGColorRef fillColor = [self areaFillColor:index]; + if ( fillColor ) { + plot.areaFill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:fillColor]]; + } + plot.areaBaseValue = @( MAX( self.inputYMin, MIN(self.inputYMax, 0.0) ) ); [plot reloadData]; } diff --git a/QCPlugin/CorePlotQCPlugin.h b/QCPlugin/CorePlotQCPlugin.h index 1a24245b4..e0ec5811c 100644 --- a/QCPlugin/CorePlotQCPlugin.h +++ b/QCPlugin/CorePlotQCPlugin.h @@ -48,7 +48,7 @@ -(nonnull CGColorRef)dataLineColor:(NSUInteger)index; -(CGFloat)dataLineWidth:(NSUInteger)index; --(nonnull CGColorRef)areaFillColor:(NSUInteger)index; --(nonnull CGImageRef)newAreaFillImage:(NSUInteger)index; +-(nullable CGColorRef)areaFillColor:(NSUInteger)index; +-(nullable CGImageRef)newAreaFillImage:(NSUInteger)index; @end diff --git a/QCPlugin/CorePlotQCPlugin.m b/QCPlugin/CorePlotQCPlugin.m index b814402bf..99d4c9080 100644 --- a/QCPlugin/CorePlotQCPlugin.m +++ b/QCPlugin/CorePlotQCPlugin.m @@ -10,7 +10,7 @@ @interface CorePlotQCPlugIn() @property (nonatomic, readwrite, strong, nullable) NSMutableData *imageData; @property (nonatomic, readwrite, assign, nullable) CGContextRef bitmapContext; -@property (nonatomic, readwrite, strong, nonnull) id imageProvider; +@property (nonatomic, readwrite, strong, nullable) id imageProvider; void drawErrorText(CGContextRef __nonnull context, CGRect rect); @@ -186,7 +186,7 @@ +(nonnull CPTStringArray *)sortedPropertyPortKeys @"inputAxisMinorTickWidth"]; } -+(nonnull CPTDictionary *)attributesForPropertyPortWithKey:(nonnull NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { /* * Specify the optional attributes for property based ports (QCPortAttributeNameKey, QCPortAttributeDefaultValueKey...). @@ -513,14 +513,14 @@ -(CGFloat)dataLineWidth:(NSUInteger)index return inputValue.doubleValue; } --(nonnull CGColorRef)areaFillColor:(NSUInteger)index +-(nullable CGColorRef)areaFillColor:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index]; return (__bridge CGColorRef)([self valueForInputKey:key]); } --(nonnull CGImageRef)newAreaFillImage:(NSUInteger)index +-(nullable CGImageRef)newAreaFillImage:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotFillImage%lu", (unsigned long)index]; @@ -828,9 +828,14 @@ -(BOOL)execute:(nonnull id)context atTime:(NSTimeInterval)time CGContextFlush(bmContext); // ... and put it on the output port - self.outputImage = self.imageProvider; - - return YES; + id provider = self.imageProvider; + if ( provider ) { + self.outputImage = provider; + return YES; + } + else { + return NO; + } } @end diff --git a/examples/AAPLot/Classes/RootViewController.m b/examples/AAPLot/Classes/RootViewController.m index 9f53bd403..c8218a811 100644 --- a/examples/AAPLot/Classes/RootViewController.m +++ b/examples/AAPLot/Classes/RootViewController.m @@ -46,7 +46,7 @@ -(void)loadFlipsideViewController UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(toggleView)]; - UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"AAPLot"]; + UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:NSLocalizedString(@"AAPLot", @"App name")]; navigationItem.rightBarButtonItem = buttonItem; [self.flipsideNavigationBar pushNavigationItem:navigationItem animated:NO]; } diff --git a/examples/CorePlotGallery/src/ios/DetailViewController.m b/examples/CorePlotGallery/src/ios/DetailViewController.m index a50fe4923..ecf8ed0c1 100644 --- a/examples/CorePlotGallery/src/ios/DetailViewController.m +++ b/examples/CorePlotGallery/src/ios/DetailViewController.m @@ -44,6 +44,8 @@ -(void)setupView -(void)awakeFromNib { + [super awakeFromNib]; + [self setupView]; } diff --git a/examples/CorePlotGallery/src/ios/ThemeTableViewController.m b/examples/CorePlotGallery/src/ios/ThemeTableViewController.m index a0901f3ae..08d140dc7 100644 --- a/examples/CorePlotGallery/src/ios/ThemeTableViewController.m +++ b/examples/CorePlotGallery/src/ios/ThemeTableViewController.m @@ -41,6 +41,8 @@ -(void)setupThemes -(void)awakeFromNib { + [super awakeFromNib]; + [self setupThemes]; } diff --git a/examples/CorePlotGallery/src/plots/CandlestickPlot.m b/examples/CorePlotGallery/src/plots/CandlestickPlot.m index ed592f22b..ac1898980 100644 --- a/examples/CorePlotGallery/src/plots/CandlestickPlot.m +++ b/examples/CorePlotGallery/src/plots/CandlestickPlot.m @@ -9,7 +9,7 @@ @interface CandlestickPlot() -@property (nonatomic, readwrite, strong, nonnull) CPTGraph *graph; +@property (nonatomic, readwrite, strong, nullable) CPTGraph *graph; @property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; @end @@ -28,7 +28,7 @@ -(nonnull instancetype)init { if ( (self = [super init]) ) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"Candlestick Plot"; self.section = kFinancialPlots; diff --git a/examples/CorePlotGallery/src/plots/FunctionPlot.m b/examples/CorePlotGallery/src/plots/FunctionPlot.m index 8455ce546..24d94d2a5 100644 --- a/examples/CorePlotGallery/src/plots/FunctionPlot.m +++ b/examples/CorePlotGallery/src/plots/FunctionPlot.m @@ -118,13 +118,13 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT switch ( plotNum ) { case 0: - titleString = @"y = sin(x)"; + titleString = NSLocalizedString(@"y = sin(x)", @"y = sin(x)"); function = &sin; lineColor = [CPTColor redColor]; break; case 1: - titleString = @"y = cos(x)"; + titleString = NSLocalizedString(@"y = cos(x)", @"y = cos(x)"); block = ^(double xVal) { return cos(xVal); }; @@ -132,7 +132,7 @@ -(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withT break; case 2: - titleString = @"y = tan(x)"; + titleString = NSLocalizedString(@"y = tan(x)", @"y = tan(x)"); function = &tan; lineColor = [CPTColor blueColor]; break; diff --git a/examples/CorePlotGallery/src/plots/OHLCPlot.m b/examples/CorePlotGallery/src/plots/OHLCPlot.m index 2032889fb..86cfca07f 100644 --- a/examples/CorePlotGallery/src/plots/OHLCPlot.m +++ b/examples/CorePlotGallery/src/plots/OHLCPlot.m @@ -28,7 +28,7 @@ -(nonnull instancetype)init { if ( (self = [super init]) ) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"OHLC Plot"; self.section = kFinancialPlots; diff --git a/examples/CorePlotGallery/src/plots/RangePlot.m b/examples/CorePlotGallery/src/plots/RangePlot.m index d5c80ba63..31bb76cdd 100644 --- a/examples/CorePlotGallery/src/plots/RangePlot.m +++ b/examples/CorePlotGallery/src/plots/RangePlot.m @@ -32,7 +32,7 @@ -(nonnull instancetype)init { if ( (self = [super init]) ) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"Range Plot"; self.section = kFinancialPlots; diff --git a/examples/CorePlotGallery/src/shared/PiNumberFormatter.m b/examples/CorePlotGallery/src/shared/PiNumberFormatter.m index 44db81b2e..f8cfe1e59 100644 --- a/examples/CorePlotGallery/src/shared/PiNumberFormatter.m +++ b/examples/CorePlotGallery/src/shared/PiNumberFormatter.m @@ -17,7 +17,7 @@ @implementation PiNumberFormatter * @param coordinateValue The numeric value. * @return The formatted string. **/ --(nullable NSString *)stringForObjectValue:(nonnull id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSString *string = nil; diff --git a/examples/CorePlotGallery/src/shared/PlotItem.m b/examples/CorePlotGallery/src/shared/PlotItem.m index c1643e3a9..414d26910 100644 --- a/examples/CorePlotGallery/src/shared/PlotItem.m +++ b/examples/CorePlotGallery/src/shared/PlotItem.m @@ -57,8 +57,8 @@ -(nonnull instancetype)init defaultLayerHostingView = nil; graphs = [[NSMutableArray alloc] init]; - section = nil; - title = nil; + section = @""; + title = @""; } return self; diff --git a/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m b/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m index e98a8f379..87f3aafa0 100644 --- a/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m +++ b/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m @@ -40,6 +40,8 @@ -(void)setupView -(void)awakeFromNib { + [super awakeFromNib]; + [self setupView]; } diff --git a/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m b/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m index d8f3ce37b..560c42897 100644 --- a/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m +++ b/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m @@ -41,6 +41,8 @@ -(void)setupThemes -(void)awakeFromNib { + [super awakeFromNib]; + [self setupThemes]; } diff --git a/examples/StockPlot/Classes/RootViewController.m b/examples/StockPlot/Classes/RootViewController.m index f543b6e9f..7e5dace94 100644 --- a/examples/StockPlot/Classes/RootViewController.m +++ b/examples/StockPlot/Classes/RootViewController.m @@ -46,7 +46,7 @@ -(void)didReceiveMemoryWarning -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; - self.navigationItem.title = @"Stocks"; + self.navigationItem.title = NSLocalizedString(@"Stocks", @"App name"); // the graph will set itself as delegate of the dataPuller when we push it, so we need to reset this. for ( APYahooDataPuller *dp in self.stocks ) { dp.delegate = self; @@ -62,7 +62,7 @@ -(void)inspectStock:(nonnull APYahooDataPuller *)aStock if ( [high isEqualToNumber:[NSDecimalNumber notANumber]] || [low isEqualToNumber:[NSDecimalNumber notANumber]] || (aStock.financialData.count <= 0) ) { NSString *message = [NSString stringWithFormat:@"No information available for %@", aStock.symbol]; - UIAlertView *av = [[UIAlertView alloc] initWithTitle:@"Alert" message:message delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil]; + UIAlertView *av = [[UIAlertView alloc] initWithTitle:NSLocalizedString(@"Alert", @"Alert title") message:message delegate:nil cancelButtonTitle:@"Okay" otherButtonTitles:nil]; [av show]; } else { @@ -239,7 +239,6 @@ -(void)dealloc dp.delegate = nil; } } - stocks = nil; } /* From d89bdb21da90f000cbe288a1ed6756b227c9e82a Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Tue, 14 Jun 2016 23:10:43 -0400 Subject: [PATCH 013/212] Updated the Travis configuration to build with Xcode 8. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 927fa9fa8..0de77074a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ language: objective-c -osx_image: xcode7.1 +osx_image: xcode8 ios_env: SDK:iphonesimulator From 93ae2d455ce2a37911bc8fe384c3c2a6971ea9b4 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Wed, 15 Jun 2016 20:55:02 -0400 Subject: [PATCH 014/212] Updated the Swift example apps to Swift 3 and fixed all Xcode 8 warnings. --- .../Classes/BarChartController.swift | 36 +++++++-------- .../Classes/PieChartController.swift | 32 +++++++------- .../Classes/ScatterPlotController.swift | 44 +++++++++---------- .../Classes/iPhoneAppDelegate.swift | 2 +- .../DatePlot.xcodeproj/project.pbxproj | 8 ++-- examples/DatePlot/Source/AppDelegate.swift | 12 +++++ examples/DatePlot/Source/DateController.swift | 27 ++++++------ examples/DatePlot/Source/main.swift | 3 -- 8 files changed, 86 insertions(+), 78 deletions(-) create mode 100644 examples/DatePlot/Source/AppDelegate.swift delete mode 100644 examples/DatePlot/Source/main.swift diff --git a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift index 87c0984d9..7aadad198 100644 --- a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift @@ -5,13 +5,13 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { // MARK: Initialization - override func viewDidAppear(animated : Bool) + override func viewDidAppear(_ animated : Bool) { super.viewDidAppear(animated) // Create graph from theme - let newGraph = CPTXYGraph(frame: CGRectZero) - newGraph.applyTheme(CPTTheme(named: kCPTDarkGradientTheme)) + let newGraph = CPTXYGraph(frame: .zero) + newGraph.apply(CPTTheme(named: kCPTDarkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph @@ -36,7 +36,7 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { // Graph title let paragraphStyle = NSMutableParagraphStyle() - paragraphStyle.alignment = .Center + paragraphStyle.alignment = .center let lineOne = "Graph Title" let lineTwo = "Line 2" @@ -49,8 +49,8 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { let titleRange1 = NSRange(location: 0, length: lineOne.utf16.count) let titleRange2 = NSRange(location: lineOne.utf16.count + 1, length: lineTwo.utf16.count) - graphTitle.addAttribute(NSForegroundColorAttributeName, value:UIColor.whiteColor(), range:titleRange1) - graphTitle.addAttribute(NSForegroundColorAttributeName, value:UIColor.grayColor(), range:titleRange2) + graphTitle.addAttribute(NSForegroundColorAttributeName, value:UIColor.white(), range:titleRange1) + graphTitle.addAttribute(NSForegroundColorAttributeName, value:UIColor.gray(), range:titleRange2) graphTitle.addAttribute(NSParagraphStyleAttributeName, value:paragraphStyle, range:NSRange(location: 0, length: graphTitle.length)) graphTitle.addAttribute(NSFontAttributeName, value:line1Font!, range:titleRange1) graphTitle.addAttribute(NSFontAttributeName, value:line2Font!, range:titleRange2) @@ -58,7 +58,7 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { newGraph.attributedTitle = graphTitle newGraph.titleDisplacement = CGPoint(x: 0.0, y:-20.0) - newGraph.titlePlotAreaFrameAnchor = .Top + newGraph.titlePlotAreaFrameAnchor = .top // Plot space let plotSpace = newGraph.defaultPlotSpace as! CPTXYPlotSpace @@ -79,7 +79,7 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { // Custom labels x.labelRotation = CGFloat(M_PI_4) - x.labelingPolicy = .None + x.labelingPolicy = .none let customTickLocations = [1, 5, 10, 15] let xAxisLabels = ["Label A", "Label B", "Label C", "Label D"] @@ -110,41 +110,41 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { } // First bar plot - let barPlot1 = CPTBarPlot.tubularBarPlotWithColor(CPTColor.darkGrayColor(), horizontalBars:false) + let barPlot1 = CPTBarPlot.tubularBarPlot(with: .darkGray(), horizontalBars:false) barPlot1.baseValue = 0.0 barPlot1.dataSource = self barPlot1.barOffset = -0.2 barPlot1.identifier = "Bar Plot 1" - newGraph.addPlot(barPlot1, toPlotSpace:plotSpace) + newGraph.add(barPlot1, to:plotSpace) // Second bar plot - let barPlot2 = CPTBarPlot.tubularBarPlotWithColor(CPTColor.blueColor(), horizontalBars:false) + let barPlot2 = CPTBarPlot.tubularBarPlot(with: .blue(), horizontalBars:false) barPlot2.dataSource = self barPlot2.baseValue = 0.0 barPlot2.barOffset = 0.25 barPlot2.barCornerRadius = 2.0 barPlot2.identifier = "Bar Plot 2" - newGraph.addPlot(barPlot2, toPlotSpace:plotSpace) + newGraph.add(barPlot2, to:plotSpace) self.barGraph = newGraph } // MARK: - Plot Data Source Methods - func numberOfRecordsForPlot(plot: CPTPlot) -> UInt + func numberOfRecords(for plot: CPTPlot) -> UInt { return 16 } - func numberForPlot(plot: CPTPlot, field: UInt, recordIndex: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> AnyObject? { switch CPTBarPlotField(rawValue: Int(field))! { - case .BarLocation: - return recordIndex as NSNumber + case .barLocation: + return record as NSNumber - case .BarTip: + case .barTip: let plotID = plot.identifier as! String - return (plotID == "Bar Plot 2" ? recordIndex : ((recordIndex + 1) * (recordIndex + 1)) ) as NSNumber + return (plotID == "Bar Plot 2" ? record : ((record + 1) * (record + 1)) ) as NSNumber default: return nil diff --git a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift index ea01894e6..46f4a4466 100644 --- a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift @@ -7,13 +7,13 @@ class PieChartController : UIViewController, CPTPieChartDataSource { // MARK: Initialization - override func viewDidAppear(animated : Bool) + override func viewDidAppear(_ animated : Bool) { super.viewDidAppear(animated) // Create graph from theme - let newGraph = CPTXYGraph(frame: CGRectZero) - newGraph.applyTheme(CPTTheme(named: kCPTDarkGradientTheme)) + let newGraph = CPTXYGraph(frame: .zero) + newGraph.apply(CPTTheme(named: kCPTDarkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph @@ -27,55 +27,55 @@ class PieChartController : UIViewController, CPTPieChartDataSource { newGraph.axisSet = nil let whiteText = CPTMutableTextStyle() - whiteText.color = CPTColor.whiteColor() + whiteText.color = .white() newGraph.titleTextStyle = whiteText newGraph.title = "Graph Title" // Add pie chart - let piePlot = CPTPieChart(frame: CGRectZero) + let piePlot = CPTPieChart(frame: .zero) piePlot.dataSource = self piePlot.pieRadius = 131.0 piePlot.identifier = "Pie Chart 1" piePlot.startAngle = CGFloat(M_PI_4) - piePlot.sliceDirection = .CounterClockwise + piePlot.sliceDirection = .counterClockwise piePlot.centerAnchor = CGPoint(x: 0.5, y: 0.38) piePlot.borderLineStyle = CPTLineStyle() piePlot.delegate = self - newGraph.addPlot(piePlot) + newGraph.add(piePlot) self.pieGraph = newGraph } // MARK: - Plot Data Source Methods - func numberOfRecordsForPlot(plot: CPTPlot) -> UInt + func numberOfRecords(for plot: CPTPlot) -> UInt { return UInt(self.dataForChart.count) } - func numberForPlot(plot: CPTPlot, field: UInt, recordIndex: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> AnyObject? { - if Int(recordIndex) > self.dataForChart.count { + if Int(record) > self.dataForChart.count { return nil } else { switch CPTPieChartField(rawValue: Int(field))! { - case .SliceWidth: - return (self.dataForChart)[Int(recordIndex)] as NSNumber + case .sliceWidth: + return (self.dataForChart)[Int(record)] as NSNumber default: - return recordIndex as NSNumber + return record as NSNumber } } } - func dataLabelForPlot(plot: CPTPlot, recordIndex: UInt) -> CPTLayer? + func dataLabel(for plot: CPTPlot, record: UInt) -> CPTLayer? { - let label = CPTTextLayer(text:"\(recordIndex)") + let label = CPTTextLayer(text:"\(record)") if let textStyle = label.textStyle?.mutableCopy() as? CPTMutableTextStyle { - textStyle.color = CPTColor.lightGrayColor() + textStyle.color = .lightGray() label.textStyle = textStyle } diff --git a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift index 2f1681dd3..94ce8e4bc 100644 --- a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift +++ b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift @@ -8,13 +8,13 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // MARK: Initialization - override func viewDidAppear(animated : Bool) + override func viewDidAppear(_ animated : Bool) { super.viewDidAppear(animated) // Create graph from theme - let newGraph = CPTXYGraph(frame: CGRectZero) - newGraph.applyTheme(CPTTheme(named: kCPTDarkGradientTheme)) + let newGraph = CPTXYGraph(frame: .zero) + newGraph.apply(CPTTheme(named: kCPTDarkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph @@ -58,35 +58,35 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { } // Create a blue plot area - let boundLinePlot = CPTScatterPlot(frame: CGRectZero) + let boundLinePlot = CPTScatterPlot(frame: .zero) let blueLineStyle = CPTMutableLineStyle() blueLineStyle.miterLimit = 1.0 blueLineStyle.lineWidth = 3.0 - blueLineStyle.lineColor = CPTColor.blueColor() + blueLineStyle.lineColor = .blue() boundLinePlot.dataLineStyle = blueLineStyle boundLinePlot.identifier = "Blue Plot" boundLinePlot.dataSource = self - newGraph.addPlot(boundLinePlot) + newGraph.add(boundLinePlot) let fillImage = CPTImage(named:"BlueTexture") - fillImage.tiled = true + fillImage.isTiled = true boundLinePlot.areaFill = CPTFill(image: fillImage) boundLinePlot.areaBaseValue = 0.0 // Add plot symbols let symbolLineStyle = CPTMutableLineStyle() - symbolLineStyle.lineColor = CPTColor.blackColor() - let plotSymbol = CPTPlotSymbol.ellipsePlotSymbol() - plotSymbol.fill = CPTFill(color: CPTColor.blueColor()) + symbolLineStyle.lineColor = .black() + let plotSymbol = CPTPlotSymbol.ellipse() + plotSymbol.fill = CPTFill(color: .blue()) plotSymbol.lineStyle = symbolLineStyle plotSymbol.size = CGSize(width: 10.0, height: 10.0) boundLinePlot.plotSymbol = plotSymbol // Create a green plot area - let dataSourceLinePlot = CPTScatterPlot(frame: CGRectZero) + let dataSourceLinePlot = CPTScatterPlot(frame: .zero) let greenLineStyle = CPTMutableLineStyle() greenLineStyle.lineWidth = 3.0 - greenLineStyle.lineColor = CPTColor.greenColor() + greenLineStyle.lineColor = .green() greenLineStyle.dashPattern = [5.0, 5.0] dataSourceLinePlot.dataLineStyle = greenLineStyle dataSourceLinePlot.identifier = "Green Plot" @@ -94,7 +94,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // Put an area gradient under the plot above let areaColor = CPTColor(componentRed: 0.3, green: 1.0, blue: 0.3, alpha: 0.8) - let areaGradient = CPTGradient(beginningColor: areaColor, endingColor: CPTColor.clearColor()) + let areaGradient = CPTGradient(beginning: areaColor, ending: .clear()) areaGradient.angle = -90.0 let areaGradientFill = CPTFill(gradient: areaGradient) dataSourceLinePlot.areaFill = areaGradientFill @@ -102,14 +102,14 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // Animate in the new plot, as an example dataSourceLinePlot.opacity = 0.0 - newGraph.addPlot(dataSourceLinePlot) + newGraph.add(dataSourceLinePlot) let fadeInAnimation = CABasicAnimation(keyPath: "opacity") fadeInAnimation.duration = 1.0 - fadeInAnimation.removedOnCompletion = false + fadeInAnimation.isRemovedOnCompletion = false fadeInAnimation.fillMode = kCAFillModeForwards fadeInAnimation.toValue = 1.0 - dataSourceLinePlot.addAnimation(fadeInAnimation, forKey: "animateOpacity") + dataSourceLinePlot.add(fadeInAnimation, forKey: "animateOpacity") // Add some initial data var contentArray = [plotDataType]() @@ -126,16 +126,16 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // MARK: - Plot Data Source Methods - func numberOfRecordsForPlot(plot: CPTPlot) -> UInt + func numberOfRecords(for plot: CPTPlot) -> UInt { return UInt(self.dataForPlot.count) } - func numberForPlot(plot: CPTPlot, field: UInt, recordIndex: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> AnyObject? { let plotField = CPTScatterPlotField(rawValue: Int(field)) - if let num = self.dataForPlot[Int(recordIndex)][plotField!] { + if let num = self.dataForPlot[Int(record)][plotField!] { let plotID = plot.identifier as! String if (plotField! == .Y) && (plotID == "Green Plot") { return (num + 1.0) as NSNumber @@ -162,13 +162,13 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { if let labelTextStyle = axis.labelTextStyle?.mutableCopy() as? CPTMutableTextStyle { if tickLocation.doubleValue >= 0.0 { - labelTextStyle.color = CPTColor.greenColor() + labelTextStyle.color = .green() } else { - labelTextStyle.color = CPTColor.redColor() + labelTextStyle.color = .red() } - let labelString = formatter.stringForObjectValue(tickLocation) + let labelString = formatter.string(for:tickLocation) let newLabelLayer = CPTTextLayer(text: labelString, style: labelTextStyle) let newLabel = CPTAxisLabel(contentLayer: newLabelLayer) diff --git a/examples/CPTTestApp-iPhone/Classes/iPhoneAppDelegate.swift b/examples/CPTTestApp-iPhone/Classes/iPhoneAppDelegate.swift index e19b8b21d..42189f9ec 100644 --- a/examples/CPTTestApp-iPhone/Classes/iPhoneAppDelegate.swift +++ b/examples/CPTTestApp-iPhone/Classes/iPhoneAppDelegate.swift @@ -11,7 +11,7 @@ class iPhoneAppDelegate : NSObject, UIApplicationDelegate, UITabBarControllerDel @IBOutlet var window: UIWindow? = nil @IBOutlet var tabBarController: UITabBarController? = nil - func applicationDidFinishLaunching(application: UIApplication) { + func applicationDidFinishLaunching(_ application: UIApplication) { if let myWindow = self.window { myWindow.rootViewController = self.tabBarController myWindow.makeKeyAndVisible() diff --git a/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj b/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj index b8dc1ddb8..99d8c4cd2 100644 --- a/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj +++ b/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj @@ -13,7 +13,7 @@ 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; 90AF4F440F36CF1800753D26 /* DatePlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = 90AF4F430F36CF1800753D26 /* DatePlot.xib */; }; BC8E737D0FC0B3CF00DF8511 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */; }; - C33E19A8198330CA00182AF2 /* main.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33E19A7198330CA00182AF2 /* main.swift */; }; + C33E19A8198330CA00182AF2 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C33E19A7198330CA00182AF2 /* AppDelegate.swift */; }; C3A14440197DE35F0048F1FF /* DateController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C3A1443F197DE35F0048F1FF /* DateController.swift */; }; C3D3937419FD6E3500148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3937319FD6E3500148319 /* Images.xcassets */; }; /* End PBXBuildFile section */ @@ -111,7 +111,7 @@ 8D1107320486CEB800E47090 /* DatePlot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DatePlot.app; sourceTree = BUILT_PRODUCTS_DIR; }; 90AF4F430F36CF1800753D26 /* DatePlot.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = DatePlot.xib; sourceTree = ""; }; BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - C33E19A7198330CA00182AF2 /* main.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = main.swift; path = Source/main.swift; sourceTree = ""; }; + C33E19A7198330CA00182AF2 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Source/AppDelegate.swift; sourceTree = ""; }; C3A1443E197DE35F0048F1FF /* DatePlot-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DatePlot-Bridging-Header.h"; sourceTree = ""; }; C3A1443F197DE35F0048F1FF /* DateController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DateController.swift; path = Source/DateController.swift; sourceTree = ""; }; C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; @@ -151,6 +151,7 @@ isa = PBXGroup; children = ( C3A1443E197DE35F0048F1FF /* DatePlot-Bridging-Header.h */, + C33E19A7198330CA00182AF2 /* AppDelegate.swift */, C3A1443F197DE35F0048F1FF /* DateController.swift */, ); name = Classes; @@ -224,7 +225,6 @@ C33E19A219832EEA00182AF2 /* Other Sources */ = { isa = PBXGroup; children = ( - C33E19A7198330CA00182AF2 /* main.swift */, C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */, ); name = "Other Sources"; @@ -365,7 +365,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C33E19A8198330CA00182AF2 /* main.swift in Sources */, + C33E19A8198330CA00182AF2 /* AppDelegate.swift in Sources */, C3A14440197DE35F0048F1FF /* DateController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/examples/DatePlot/Source/AppDelegate.swift b/examples/DatePlot/Source/AppDelegate.swift new file mode 100644 index 000000000..32a1c9cba --- /dev/null +++ b/examples/DatePlot/Source/AppDelegate.swift @@ -0,0 +1,12 @@ +import Cocoa + +@NSApplicationMain +class AppDelegate: NSObject, NSApplicationDelegate { + func applicationDidFinishLaunching(_ aNotification: Notification) { + // Insert code here to initialize your application + } + + func applicationWillTerminate(_ aNotification: Notification) { + // Insert code here to tear down your application + } +} diff --git a/examples/DatePlot/Source/DateController.swift b/examples/DatePlot/Source/DateController.swift index 5ebba13a6..43a4e0358 100644 --- a/examples/DatePlot/Source/DateController.swift +++ b/examples/DatePlot/Source/DateController.swift @@ -19,13 +19,13 @@ class DateController : NSObject, CPTPlotDataSource { // If you make sure your dates are calculated at noon, you shouldn't have to // worry about daylight savings. If you use midnight, you will have to adjust // for daylight savings time. - let refDate = NSDateFormatter().dateFromString("12:00 Oct 29, 2009") + let refDate = DateFormatter().date(from: "12:00 Oct 29, 2009") // Create graph - let newGraph = CPTXYGraph(frame: CGRectZero) + let newGraph = CPTXYGraph(frame: .zero) let theme = CPTTheme(named: kCPTDarkGradientTheme) - newGraph.applyTheme(theme) + newGraph.apply(theme) if let host = self.hostView { host.hostedGraph = newGraph; @@ -43,8 +43,8 @@ class DateController : NSObject, CPTPlotDataSource { x.majorIntervalLength = oneDay x.orthogonalPosition = 2.0 x.minorTicksPerInterval = 0; - let dateFormatter = NSDateFormatter() - dateFormatter.dateStyle = NSDateFormatterStyle.ShortStyle + let dateFormatter = DateFormatter() + dateFormatter.dateStyle = .shortStyle let timeFormatter = CPTTimeFormatter(dateFormatter:dateFormatter) timeFormatter.referenceDate = refDate; x.labelFormatter = timeFormatter; @@ -55,21 +55,21 @@ class DateController : NSObject, CPTPlotDataSource { y.minorTicksPerInterval = 5 y.orthogonalPosition = oneDay - y.labelingPolicy = .None + y.labelingPolicy = .none } // Create a plot that uses the data source method - let dataSourceLinePlot = CPTScatterPlot(frame: CGRectZero) + let dataSourceLinePlot = CPTScatterPlot(frame: .zero) dataSourceLinePlot.identifier = "Date Plot" if let lineStyle = dataSourceLinePlot.dataLineStyle?.mutableCopy() as? CPTMutableLineStyle { lineStyle.lineWidth = 3.0 - lineStyle.lineColor = CPTColor.greenColor() + lineStyle.lineColor = .green() dataSourceLinePlot.dataLineStyle = lineStyle } dataSourceLinePlot.dataSource = self - newGraph.addPlot(dataSourceLinePlot) + newGraph.add(dataSourceLinePlot) self.graph = newGraph } @@ -87,19 +87,18 @@ class DateController : NSObject, CPTPlotDataSource { // MARK: - Plot Data Source Methods - func numberOfRecordsForPlot(plot: CPTPlot) -> UInt - { + func numberOfRecords(for plot: CPTPlot) -> UInt { return UInt(self.plotData.count) } - func numberForPlot(plot: CPTPlot, field: UInt, recordIndex: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> AnyObject? { switch CPTScatterPlotField(rawValue: Int(field))! { case .X: - return (oneDay * Double(recordIndex)) as NSNumber + return (oneDay * Double(record)) as NSNumber case .Y: - return self.plotData[Int(recordIndex)] as NSNumber + return self.plotData[Int(record)] as NSNumber } } } diff --git a/examples/DatePlot/Source/main.swift b/examples/DatePlot/Source/main.swift deleted file mode 100644 index f43c39451..000000000 --- a/examples/DatePlot/Source/main.swift +++ /dev/null @@ -1,3 +0,0 @@ -import Cocoa - -NSApplicationMain(Process.argc, Process.unsafeArgv) From dadb011a7a4e2e02cdd792dc1e3a208b372e586e Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Tue, 21 Jun 2016 20:33:38 -0400 Subject: [PATCH 015/212] =?UTF-8?q?Constrain=20angles=20to=200...2=CF=80?= =?UTF-8?q?=20when=20drawing=20pie=20charts.=20Fixed=20issue=20#287.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- framework/Source/CPTPieChart.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/Source/CPTPieChart.m b/framework/Source/CPTPieChart.m index 72e7669c5..b63f7c6a6 100644 --- a/framework/Source/CPTPieChart.m +++ b/framework/Source/CPTPieChart.m @@ -724,7 +724,7 @@ -(CGFloat)radiansForPieSliceValue:(CGFloat)pieSliceValue angle += pieSliceValue * pieRange; break; } - return angle; + return fmod(angle, 2.0 * M_PI); } -(void)addSliceToPath:(nonnull CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle From 8fe361e1a6a523abd0b25d3c5978232fbc4e42d4 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 15 Jul 2016 12:53:48 -0400 Subject: [PATCH 016/212] Fixed another Swift 3 change in the DatePlot example app. --- examples/DatePlot/Source/DateController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/DatePlot/Source/DateController.swift b/examples/DatePlot/Source/DateController.swift index 43a4e0358..db2f80006 100644 --- a/examples/DatePlot/Source/DateController.swift +++ b/examples/DatePlot/Source/DateController.swift @@ -44,7 +44,7 @@ class DateController : NSObject, CPTPlotDataSource { x.orthogonalPosition = 2.0 x.minorTicksPerInterval = 0; let dateFormatter = DateFormatter() - dateFormatter.dateStyle = .shortStyle + dateFormatter.dateStyle = .short let timeFormatter = CPTTimeFormatter(dateFormatter:dateFormatter) timeFormatter.referenceDate = refDate; x.labelFormatter = timeFormatter; From dcf3ef2475369c3e8059543a690553fd11984e6c Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 15 Jul 2016 17:11:15 -0400 Subject: [PATCH 017/212] Layer and animation delegate protocols now inherit from CALayerDelegate and CAAnimationDelegate when available. Fixed some new compiler warnings from Xcode 8 beta 2. Fixed issue #290. --- documentation/doxygen/doxygen-cocoa-tags.xml | 45 ++++++++++++++++++ .../doxygen/doxygen-cocoa-touch-tags.xml | 47 ++++++++++++++++++- .../Classes/CPTTestApp_iPadViewController.h | 5 +- .../Classes/PieChartController.swift | 4 +- .../Classes/ScatterPlotController.swift | 4 +- .../Source/SelectionDemoController.h | 4 +- .../CorePlotGallery/src/plots/DonutChart.h | 1 + .../Classes/APYahooDataPullerGraph.m | 10 ---- .../Classes/APYahooDataPullerGraph.xib | 16 +++---- .../StockPlot/Classes/RootViewController.m | 5 -- examples/StockPlot/Launch Screen.xib | 11 +++-- examples/StockPlot/MainWindow.xib | 8 ++-- examples/StockPlot/RootViewController.xib | 8 ++-- framework/Source/CPTAnimation.h | 10 ++++ framework/Source/CPTAxis.h | 2 +- framework/Source/CPTAxis.m | 8 ++-- framework/Source/CPTBarPlot.m | 4 +- framework/Source/CPTLayer.h | 17 +++++++ framework/Source/CPTLegend.h | 2 +- framework/Source/CPTLegend.m | 4 +- framework/Source/CPTPieChart.m | 4 +- framework/Source/CPTPlot.h | 2 +- framework/Source/CPTPlot.m | 4 +- framework/Source/CPTPlotArea.h | 2 +- framework/Source/CPTPlotArea.m | 4 +- framework/Source/CPTRangePlot.m | 4 +- framework/Source/CPTScatterPlot.m | 6 +-- framework/Source/CPTTradingRangePlot.m | 4 +- 28 files changed, 178 insertions(+), 67 deletions(-) diff --git a/documentation/doxygen/doxygen-cocoa-tags.xml b/documentation/doxygen/doxygen-cocoa-tags.xml index e004861d2..1578dd526 100644 --- a/documentation/doxygen/doxygen-cocoa-tags.xml +++ b/documentation/doxygen/doxygen-cocoa-tags.xml @@ -758,6 +758,21 @@ + + CAAnimationDelegate + https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAAnimationDelegate_protocol/Introduction/Introduction.html/ + NSObject-p + + void + animationDidStart: + //apple_ref/occ/intfcm/CAAnimationDelegate/animationDidStart + + + void + animationDidStop:finished: + //apple_ref/occ/intfcm/CAAnimationDelegate/animationDidStopfinished + + CALayer https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html @@ -860,6 +875,36 @@ //apple_ref/occ/instm/CALayer/setNeedsLayout + + CALayerDelegate + https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CALayerDelegate_protocol/Introduction/Introduction.html/ + NSObject-p + + id + actionForLayer:forKey: + //apple_ref/occ/intfcm/CALayerDelegate/actionForLayerforKey + + + void + displayLayer: + //apple_ref/occ/intfcm/CALayerDelegate/displayLayer + + + void + drawLayer:inContext: + //apple_ref/occ/intfcm/CALayerDelegate/drawLayerinContext + + + void + layerWillDraw: + //apple_ref/occ/intfcm/CALayerDelegate/layerWillDraw + + + void + layoutSublayersOfLayer: + //apple_ref/occ/intfcm/CALayerDelegate/layoutSublayersOfLayer + + CAMediaTiming https://developer.apple.com/library/mac/#documentation/GraphicsImaging/Reference/CAMediaTiming_protocol/Introduction/Introduction.html diff --git a/documentation/doxygen/doxygen-cocoa-touch-tags.xml b/documentation/doxygen/doxygen-cocoa-touch-tags.xml index 92439a53f..1de3c13d3 100644 --- a/documentation/doxygen/doxygen-cocoa-touch-tags.xml +++ b/documentation/doxygen/doxygen-cocoa-touch-tags.xml @@ -687,6 +687,21 @@ + + CAAnimationDelegate + https://developer.apple.com/library/ios/documentation/Foundation/Reference/CAAnimationDelegate_Protocol_Ref/ + NSObject-p + + void + animationDidStart: + //apple_ref/occ/intfcm/CAAnimationDelegate/animationDidStart + + + void + animationDidStop:finished: + //apple_ref/occ/intfcm/CAAnimationDelegate/animationDidStopfinished + + CALayer https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CALayer_class/Introduction/Introduction.html @@ -788,6 +803,36 @@ //apple_ref/occ/instm/CALayer/setNeedsLayout + + CALayerDelegate + https://developer.apple.com/library/ios/documentation/Foundation/Reference/CALayerDelegate_Protocol_Ref/ + NSObject-p + + id + actionForLayer:forKey: + //apple_ref/occ/intfcm/CALayerDelegate/actionForLayerforKey + + + void + displayLayer: + //apple_ref/occ/intfcm/CALayerDelegate/displayLayer + + + void + drawLayer:inContext: + //apple_ref/occ/intfcm/CALayerDelegate/drawLayerinContext + + + void + layerWillDraw: + //apple_ref/occ/intfcm/CALayerDelegate/layerWillDraw + + + void + layoutSublayersOfLayer: + //apple_ref/occ/intfcm/CALayerDelegate/layoutSublayersOfLayer + + CAMediaTiming https://developer.apple.com/library/ios/#documentation/GraphicsImaging/Reference/CAMediaTiming_protocol/Introduction/Introduction.html @@ -954,4 +999,4 @@ //apple_ref/c/tdef/NSZone - \ No newline at end of file + diff --git a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.h b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.h index 1b24934bd..120d9fbf3 100644 --- a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.h +++ b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.h @@ -8,7 +8,10 @@ #import "CorePlot-CocoaTouch.h" #import -@interface CPTTestApp_iPadViewController : UIViewController +@interface CPTTestApp_iPadViewController : UIViewController @property (nonatomic, readwrite, strong, nonnull) CPTNumberArray *dataForChart; @property (nonatomic, readwrite, strong, nonnull) NSArray *dataForPlot; diff --git a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift index 46f4a4466..9ab4d4754 100644 --- a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift @@ -1,6 +1,6 @@ import UIKit -class PieChartController : UIViewController, CPTPieChartDataSource { +class PieChartController : UIViewController, CPTPieChartDataSource, CPTPieChartDelegate { private var pieGraph : CPTXYGraph? = nil let dataForChart = [20.0, 30.0, 60.0] @@ -96,7 +96,7 @@ class PieChartController : UIViewController, CPTPieChartDataSource { // MARK: - Delegate Methods - func pieChart(plot: CPTPlot, sliceWasSelectedAtRecordIndex recordIndex: UInt) + private func pieChart(plot: CPTPlot, sliceWasSelectedAtRecordIndex recordIndex: UInt) { self.pieGraph?.title = "Selected index: \(recordIndex)" } diff --git a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift index 94ce8e4bc..1e4df0fd2 100644 --- a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift +++ b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift @@ -1,6 +1,6 @@ import UIKit -class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { +class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxisDelegate { private var scatterGraph : CPTXYGraph? = nil typealias plotDataType = [CPTScatterPlotField : Double] @@ -151,7 +151,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // MARK: - Axis Delegate Methods - func axis(axis: CPTAxis, shouldUpdateAxisLabelsAtLocations locations: NSSet!) -> Bool + private func axis(axis: CPTAxis, shouldUpdateAxisLabelsAtLocations locations: NSSet!) -> Bool { if let formatter = axis.labelFormatter { let labelOffset = axis.labelOffset diff --git a/examples/CPTTestApp/Source/SelectionDemoController.h b/examples/CPTTestApp/Source/SelectionDemoController.h index d4e3be7dc..a94d0e322 100644 --- a/examples/CPTTestApp/Source/SelectionDemoController.h +++ b/examples/CPTTestApp/Source/SelectionDemoController.h @@ -1,6 +1,8 @@ #import #import -@interface SelectionDemoController : NSObject +@interface SelectionDemoController : NSObject @end diff --git a/examples/CorePlotGallery/src/plots/DonutChart.h b/examples/CorePlotGallery/src/plots/DonutChart.h index ad7f4823e..bab4de00a 100644 --- a/examples/CorePlotGallery/src/plots/DonutChart.h +++ b/examples/CorePlotGallery/src/plots/DonutChart.h @@ -2,6 +2,7 @@ @interface DonutChart : PlotItem @end diff --git a/examples/StockPlot/Classes/APYahooDataPullerGraph.m b/examples/StockPlot/Classes/APYahooDataPullerGraph.m index 3b056904d..8e3204d7d 100644 --- a/examples/StockPlot/Classes/APYahooDataPullerGraph.m +++ b/examples/StockPlot/Classes/APYahooDataPullerGraph.m @@ -93,16 +93,6 @@ -(void)viewDidLoad [self reloadData]; } --(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration -{ - // NSLog(@"willRotateToInterfaceOrientation"); -} - --(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - // NSLog(@"didRotateFromInterfaceOrientation"); -} - -(void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. diff --git a/examples/StockPlot/Classes/APYahooDataPullerGraph.xib b/examples/StockPlot/Classes/APYahooDataPullerGraph.xib index 979259557..5004be323 100644 --- a/examples/StockPlot/Classes/APYahooDataPullerGraph.xib +++ b/examples/StockPlot/Classes/APYahooDataPullerGraph.xib @@ -1,8 +1,9 @@ - + - + + @@ -13,17 +14,14 @@ - + - - - - + - + @@ -32,7 +30,7 @@ - + diff --git a/examples/StockPlot/Classes/RootViewController.m b/examples/StockPlot/Classes/RootViewController.m index 7e5dace94..f36fd6fc4 100644 --- a/examples/StockPlot/Classes/RootViewController.m +++ b/examples/StockPlot/Classes/RootViewController.m @@ -179,11 +179,6 @@ -(UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndex return cell; } --(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - self.graph.view.frame = self.view.bounds; -} - #pragma mark - #pragma mark accessors diff --git a/examples/StockPlot/Launch Screen.xib b/examples/StockPlot/Launch Screen.xib index a4454db08..3548d2299 100644 --- a/examples/StockPlot/Launch Screen.xib +++ b/examples/StockPlot/Launch Screen.xib @@ -1,24 +1,25 @@ - + - + + + - + - + diff --git a/examples/StockPlot/MainWindow.xib b/examples/StockPlot/MainWindow.xib index ddc52b78a..c2a6c8cb1 100644 --- a/examples/StockPlot/MainWindow.xib +++ b/examples/StockPlot/MainWindow.xib @@ -1,7 +1,9 @@ - + - + + + @@ -19,7 +21,7 @@ - + diff --git a/examples/StockPlot/RootViewController.xib b/examples/StockPlot/RootViewController.xib index 046950821..e1e5f9e24 100644 --- a/examples/StockPlot/RootViewController.xib +++ b/examples/StockPlot/RootViewController.xib @@ -1,7 +1,9 @@ - + - + + + @@ -14,7 +16,7 @@ - + diff --git a/framework/Source/CPTAnimation.h b/framework/Source/CPTAnimation.h index 1802cde6c..3ed23488e 100644 --- a/framework/Source/CPTAnimation.h +++ b/framework/Source/CPTAnimation.h @@ -1,3 +1,5 @@ +#import + @class CPTAnimationOperation; @class CPTAnimationPeriod; @@ -39,10 +41,18 @@ typedef NS_ENUM (NSInteger, CPTAnimationCurve) { CPTAnimationCurveQuinticInOut ///< Quintic in and out animation curve. }; +#pragma mark - + /** * @brief Animation delegate. **/ +#if ( ( TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 100000 ) ) \ + || (TARGET_OS_MAC && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 ) ) +// CAAnimationDelegate is defined by Core Animation in iOS 10.0+, macOS 10.12+, and tvOS 10.0+ +@protocol CPTAnimationDelegate +#else @protocol CPTAnimationDelegate +#endif @optional diff --git a/framework/Source/CPTAxis.h b/framework/Source/CPTAxis.h index 2bde6b4ed..65bec6a8a 100644 --- a/framework/Source/CPTAxis.h +++ b/framework/Source/CPTAxis.h @@ -44,7 +44,7 @@ typedef NSMutableArray<__kindof CPTAxis *> CPTMutableAxisArray; /** * @brief Axis labeling delegate. **/ -@protocol CPTAxisDelegate +@protocol CPTAxisDelegate @optional diff --git a/framework/Source/CPTAxis.m b/framework/Source/CPTAxis.m index d91deca53..a3c619a3e 100644 --- a/framework/Source/CPTAxis.m +++ b/framework/Source/CPTAxis.m @@ -1548,7 +1548,7 @@ -(void)updateAxisLabelsAtLocations:(nullable CPTNumberSet *)locations inRange:(n BOOL theLabelFormatterChanged; CPTShadow *theShadow; - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( useMajorAxisLabels ) { if ( locations.count > 0 ) { @@ -1732,7 +1732,7 @@ -(void)relabel if ( !self.plotSpace ) { return; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(axisShouldRelabel:)] && ![theDelegate axisShouldRelabel:self] ) { self.needsRelabel = NO; return; @@ -2072,7 +2072,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; // Tick labels if ( [theDelegate respondsToSelector:@selector(axis:labelTouchDown:)] || @@ -2183,7 +2183,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; // Tick labels if ( [theDelegate respondsToSelector:@selector(axis:labelTouchUp:)] || diff --git a/framework/Source/CPTBarPlot.m b/framework/Source/CPTBarPlot.m index 06bed146e..ba07e3288 100644 --- a/framework/Source/CPTBarPlot.m +++ b/framework/Source/CPTBarPlot.m @@ -1397,7 +1397,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(barPlot:barTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(barPlot:barTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(barPlot:barWasSelectedAtRecordIndex:)] || @@ -1466,7 +1466,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(barPlot:barTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(barPlot:barTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(barPlot:barWasSelectedAtRecordIndex:)] || diff --git a/framework/Source/CPTLayer.h b/framework/Source/CPTLayer.h index ec2381a44..52ddc6df6 100644 --- a/framework/Source/CPTLayer.h +++ b/framework/Source/CPTLayer.h @@ -37,6 +37,23 @@ typedef NSSet CPTSublayerSet; **/ typedef NSMutableSet CPTMutableSublayerSet; +#pragma mark - + +/** + * @brief Layer delegate. + **/ +#if ( ( TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= 100000 ) ) \ + || (TARGET_OS_MAC && (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 ) ) +// CALayerDelegate is defined by Core Animation in iOS 10.0+, macOS 10.12+, and tvOS 10.0+ +@protocol CPTLayerDelegate +#else +@protocol CPTLayerDelegate +#endif + +@end + +#pragma mark - + @interface CPTLayer : CALayer /// @name Graph diff --git a/framework/Source/CPTLegend.h b/framework/Source/CPTLegend.h index a15240eac..e339e94c5 100644 --- a/framework/Source/CPTLegend.h +++ b/framework/Source/CPTLegend.h @@ -41,7 +41,7 @@ typedef NS_ENUM (NSInteger, CPTLegendSwatchLayout) { /** * @brief Legend delegate. **/ -@protocol CPTLegendDelegate +@protocol CPTLegendDelegate @optional diff --git a/framework/Source/CPTLegend.m b/framework/Source/CPTLegend.m index a55c030c7..20eb78cf6 100644 --- a/framework/Source/CPTLegend.m +++ b/framework/Source/CPTLegend.m @@ -1206,7 +1206,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:touchDownAtIndex:)] || [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:touchDownAtIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:wasSelectedAtIndex:)] || @@ -1277,7 +1277,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:touchUpAtIndex:)] || [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:touchUpAtIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(legend:legendEntryForPlot:wasSelectedAtIndex:)] || diff --git a/framework/Source/CPTPieChart.m b/framework/Source/CPTPieChart.m index b63f7c6a6..c1e587b13 100644 --- a/framework/Source/CPTPieChart.m +++ b/framework/Source/CPTPieChart.m @@ -1095,7 +1095,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(pieChart:sliceTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(pieChart:sliceTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(pieChart:sliceWasSelectedAtRecordIndex:)] || @@ -1164,7 +1164,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(pieChart:sliceTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(pieChart:sliceTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(pieChart:sliceWasSelectedAtRecordIndex:)] || diff --git a/framework/Source/CPTPlot.h b/framework/Source/CPTPlot.h index e9d2833f8..d7c68f00d 100644 --- a/framework/Source/CPTPlot.h +++ b/framework/Source/CPTPlot.h @@ -162,7 +162,7 @@ typedef NSMutableArray<__kindof CPTPlot *> CPTMutablePlotArray; /** * @brief Plot delegate. **/ -@protocol CPTPlotDelegate +@protocol CPTPlotDelegate @optional diff --git a/framework/Source/CPTPlot.m b/framework/Source/CPTPlot.m index 7df92b6df..98b912041 100644 --- a/framework/Source/CPTPlot.m +++ b/framework/Source/CPTPlot.m @@ -1895,7 +1895,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(plot:dataLabelTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelWasSelectedAtRecordIndex:)] || @@ -1973,7 +1973,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(plot:dataLabelTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelWasSelectedAtRecordIndex:)] || diff --git a/framework/Source/CPTPlotArea.h b/framework/Source/CPTPlotArea.h index b606caa2c..1d29c5f78 100644 --- a/framework/Source/CPTPlotArea.h +++ b/framework/Source/CPTPlotArea.h @@ -14,7 +14,7 @@ /** * @brief Plot area delegate. **/ -@protocol CPTPlotAreaDelegate +@protocol CPTPlotAreaDelegate @optional diff --git a/framework/Source/CPTPlotArea.m b/framework/Source/CPTPlotArea.m index 216ca4152..7263da862 100644 --- a/framework/Source/CPTPlotArea.m +++ b/framework/Source/CPTPlotArea.m @@ -702,7 +702,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(plotAreaTouchDown:)] || [theDelegate respondsToSelector:@selector(plotAreaTouchDown:withEvent:)] || [theDelegate respondsToSelector:@selector(plotAreaWasSelected:)] || @@ -756,7 +756,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in CGPoint lastPoint = self.touchedPoint; self.touchedPoint = CPTPointMake(NAN, NAN); - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(plotAreaTouchUp:)] || [theDelegate respondsToSelector:@selector(plotAreaTouchUp:withEvent:)] || [theDelegate respondsToSelector:@selector(plotAreaWasSelected:)] || diff --git a/framework/Source/CPTRangePlot.m b/framework/Source/CPTRangePlot.m index 95ee7a8ac..9b1d7483e 100644 --- a/framework/Source/CPTRangePlot.m +++ b/framework/Source/CPTRangePlot.m @@ -1133,7 +1133,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(rangePlot:rangeTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(rangePlot:rangeTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(rangePlot:rangeWasSelectedAtRecordIndex:)] || @@ -1202,7 +1202,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(rangePlot:rangeTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(rangePlot:rangeTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(rangePlot:rangeWasSelectedAtRecordIndex:)] || diff --git a/framework/Source/CPTScatterPlot.m b/framework/Source/CPTScatterPlot.m index 6ab1d51a2..eb9757bcc 100644 --- a/framework/Source/CPTScatterPlot.m +++ b/framework/Source/CPTScatterPlot.m @@ -915,7 +915,7 @@ -(void)renderAsVectorInContext:(nonnull CGContextRef)context CGPathRef dataLinePath = [self newDataLinePathForViewPoints:viewPoints indexRange:viewIndexRange baselineYValue:CPTNAN]; // Give the delegate a chance to prepare for the drawing. - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(scatterPlot:prepareForDrawingPlotLine:inContext:)] ) { [theDelegate scatterPlot:self prepareForDrawingPlotLine:dataLinePath inContext:context]; } @@ -1913,7 +1913,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; BOOL symbolTouchUpHandled = NO; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchDownAtRecordIndex:)] || @@ -2030,7 +2030,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; BOOL symbolSelectHandled = NO; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchUpAtRecordIndex:)] || diff --git a/framework/Source/CPTTradingRangePlot.m b/framework/Source/CPTTradingRangePlot.m index 99085ddcc..0326f1d57 100644 --- a/framework/Source/CPTTradingRangePlot.m +++ b/framework/Source/CPTTradingRangePlot.m @@ -1519,7 +1519,7 @@ -(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint) return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(tradingRangePlot:barTouchDownAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(tradingRangePlot:barTouchDownAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(tradingRangePlot:barWasSelectedAtRecordIndex:)] || @@ -1588,7 +1588,7 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( [theDelegate respondsToSelector:@selector(tradingRangePlot:barTouchUpAtRecordIndex:)] || [theDelegate respondsToSelector:@selector(tradingRangePlot:barTouchUpAtRecordIndex:withEvent:)] || [theDelegate respondsToSelector:@selector(tradingRangePlot:barWasSelectedAtRecordIndex:)] || From fe93e08aee3a1abba3ea22afa5481f4a9db36b03 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sun, 7 Aug 2016 20:41:47 -0400 Subject: [PATCH 018/212] Updated the Swift example apps with Swift 3.0 changes in Xcode 8 beta 4. --- .../CPTTestApp-iPhone.xcodeproj/project.pbxproj | 7 +++++++ .../CPTTestApp-iPhone/Classes/BarChartController.swift | 4 ++-- .../CPTTestApp-iPhone/Classes/PieChartController.swift | 4 ++-- .../CPTTestApp-iPhone/Classes/ScatterPlotController.swift | 2 +- examples/DatePlot/DatePlot.xcodeproj/project.pbxproj | 7 +++++++ 5 files changed, 19 insertions(+), 5 deletions(-) diff --git a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj index 4c96c7238..48555a5cd 100644 --- a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj +++ b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj @@ -249,6 +249,11 @@ attributes = { LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0800; + TargetAttributes = { + 1D6058900D05DD3D006BFB54 = { + LastSwiftMigration = 0800; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CPTTestApp-iPhone" */; compatibilityVersion = "Xcode 6.3"; @@ -394,6 +399,7 @@ PRODUCT_NAME = "CPTTestApp-iPhone"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SWIFT_OBJC_BRIDGING_HEADER = "CPTTestApp-iPhone-Bridging-Header.h"; + SWIFT_VERSION = 3.0; USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; }; name = Debug; @@ -422,6 +428,7 @@ "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SWIFT_OBJC_BRIDGING_HEADER = "CPTTestApp-iPhone-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; }; name = Release; diff --git a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift index 7aadad198..e20fddb5f 100644 --- a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift @@ -49,8 +49,8 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { let titleRange1 = NSRange(location: 0, length: lineOne.utf16.count) let titleRange2 = NSRange(location: lineOne.utf16.count + 1, length: lineTwo.utf16.count) - graphTitle.addAttribute(NSForegroundColorAttributeName, value:UIColor.white(), range:titleRange1) - graphTitle.addAttribute(NSForegroundColorAttributeName, value:UIColor.gray(), range:titleRange2) + graphTitle.addAttribute(NSForegroundColorAttributeName, value:UIColor.white, range:titleRange1) + graphTitle.addAttribute(NSForegroundColorAttributeName, value:UIColor.gray, range:titleRange2) graphTitle.addAttribute(NSParagraphStyleAttributeName, value:paragraphStyle, range:NSRange(location: 0, length: graphTitle.length)) graphTitle.addAttribute(NSFontAttributeName, value:line1Font!, range:titleRange1) graphTitle.addAttribute(NSFontAttributeName, value:line2Font!, range:titleRange2) diff --git a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift index 9ab4d4754..016f0fa1c 100644 --- a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift @@ -83,7 +83,7 @@ class PieChartController : UIViewController, CPTPieChartDataSource, CPTPieChartD return label } - func radialOffsetForPieChart(piePlot: CPTPieChart, recordIndex: UInt) -> CGFloat + func radialOffset(for piePlot: CPTPieChart, record recordIndex: UInt) -> CGFloat { var offset: CGFloat = 0.0 @@ -96,7 +96,7 @@ class PieChartController : UIViewController, CPTPieChartDataSource, CPTPieChartD // MARK: - Delegate Methods - private func pieChart(plot: CPTPlot, sliceWasSelectedAtRecordIndex recordIndex: UInt) + private func pieChart(_ plot: CPTPlot, sliceWasSelectedAtRecordIndex recordIndex: UInt) { self.pieGraph?.title = "Selected index: \(recordIndex)" } diff --git a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift index 1e4df0fd2..90b173754 100644 --- a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift +++ b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift @@ -151,7 +151,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxi // MARK: - Axis Delegate Methods - private func axis(axis: CPTAxis, shouldUpdateAxisLabelsAtLocations locations: NSSet!) -> Bool + private func axis(_ axis: CPTAxis, shouldUpdateAxisLabelsAtLocations locations: NSSet!) -> Bool { if let formatter = axis.labelFormatter { let labelOffset = axis.labelOffset diff --git a/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj b/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj index 99d8c4cd2..d57d8fa79 100644 --- a/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj +++ b/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj @@ -262,6 +262,11 @@ BuildIndependentTargetsInParallel = NO; LastSwiftUpdateCheck = 0700; LastUpgradeCheck = 0800; + TargetAttributes = { + 8D1107260486CEB800E47090 = { + LastSwiftMigration = 0800; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DatePlot" */; compatibilityVersion = "Xcode 6.3"; @@ -416,6 +421,7 @@ PRODUCT_NAME = DatePlot; SWIFT_OBJC_BRIDGING_HEADER = "DatePlot-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; }; name = Debug; }; @@ -440,6 +446,7 @@ PRODUCT_NAME = DatePlot; SWIFT_OBJC_BRIDGING_HEADER = "DatePlot-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 3.0; }; name = Release; }; From 1c0c68b0a094a219455f02771f1c39990f439305 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 13 Aug 2016 22:03:13 -0400 Subject: [PATCH 019/212] Fixed a compiler warning for 32-bit builds. --- framework/Source/CPTPieChart.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/Source/CPTPieChart.m b/framework/Source/CPTPieChart.m index c1e587b13..3487c03b6 100644 --- a/framework/Source/CPTPieChart.m +++ b/framework/Source/CPTPieChart.m @@ -724,7 +724,7 @@ -(CGFloat)radiansForPieSliceValue:(CGFloat)pieSliceValue angle += pieSliceValue * pieRange; break; } - return fmod(angle, 2.0 * M_PI); + return fmod( angle, CPTFloat(2.0 * M_PI) ); } -(void)addSliceToPath:(nonnull CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle From 58d45d5bef84f2d93ee163fb0890b95b273eeeaf Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Mon, 15 Aug 2016 20:20:12 -0400 Subject: [PATCH 020/212] Fixed compiler warnings for 32-bit builds in the unit tests. --- framework/Source/CPTAxisLabelTests.m | 2 +- framework/Source/CPTDataSourceTestCase.m | 2 +- framework/Source/CPTLayerTests.m | 6 +++--- framework/Source/CPTXYPlotSpaceTests.m | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/framework/Source/CPTAxisLabelTests.m b/framework/Source/CPTAxisLabelTests.m index 22bf84e9a..eee894a7f 100644 --- a/framework/Source/CPTAxisLabelTests.m +++ b/framework/Source/CPTAxisLabelTests.m @@ -6,7 +6,7 @@ #import "CPTUtilities.h" #import -static const double precision = 1.0e-6; +static const CGFloat precision = CPTFloat(1.0e-6); @implementation CPTAxisLabelTests diff --git a/framework/Source/CPTDataSourceTestCase.m b/framework/Source/CPTDataSourceTestCase.m index ce5a50380..333df3157 100644 --- a/framework/Source/CPTDataSourceTestCase.m +++ b/framework/Source/CPTDataSourceTestCase.m @@ -122,7 +122,7 @@ -(nullable CPTNumberArray *)numbersForPlot:(nonnull CPTPlot *)plot XCTAssertTrue([[self plots] containsObject:plot], @"Plot missing"); CPTMutableNumberArray *shiftedResult = [NSMutableArray arrayWithCapacity:result.count]; for ( NSDecimalNumber *d in result ) { - [shiftedResult addObject:[d decimalNumberByAdding:[NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromDouble( CPTDataSourceTestCasePlotOffset * ([self.plots indexOfObject:plot] + 1) )]]]; + [shiftedResult addObject:[d decimalNumberByAdding:[NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromCGFloat( CPTDataSourceTestCasePlotOffset * ([self.plots indexOfObject:plot] + 1) )]]]; } result = shiftedResult; diff --git a/framework/Source/CPTLayerTests.m b/framework/Source/CPTLayerTests.m index ad279c43c..879fb87d6 100644 --- a/framework/Source/CPTLayerTests.m +++ b/framework/Source/CPTLayerTests.m @@ -4,7 +4,7 @@ #import "CPTUtilities.h" #import "NSNumberExtensions.h" -static const double precision = 1.0e-6; +static const CGFloat precision = CPTFloat(1.0e-6); @interface CPTLayerTests() @@ -152,10 +152,10 @@ -(void)testPositionsWithScale:(CGFloat)scale anchorPoint:(CGPoint)anchor expecte CGFloat expected = ( (NSNumber *)(expectedValues[i]) ).cgFloatValue; NSString *errMessage; - errMessage = [NSString stringWithFormat:@"pixelAlign at x = %g with scale %g and anchor %@", position, scale, CPTStringFromPoint(anchor)]; + errMessage = [NSString stringWithFormat:@"pixelAlign at x = %g with scale %g and anchor %@", (double)position, (double)scale, CPTStringFromPoint(anchor)]; XCTAssertEqualWithAccuracy(alignedPoint.x, expected, precision, @"%@", errMessage); - errMessage = [NSString stringWithFormat:@"pixelAlign at y = %g with scale %g and anchor %@", position, scale, CPTStringFromPoint(anchor)]; + errMessage = [NSString stringWithFormat:@"pixelAlign at y = %g with scale %g and anchor %@", (double)position, (double)scale, CPTStringFromPoint(anchor)]; XCTAssertEqualWithAccuracy(alignedPoint.y, expected, precision, @"%@", errMessage); } } diff --git a/framework/Source/CPTXYPlotSpaceTests.m b/framework/Source/CPTXYPlotSpaceTests.m index 1185faedf..8b0075245 100644 --- a/framework/Source/CPTXYPlotSpaceTests.m +++ b/framework/Source/CPTXYPlotSpaceTests.m @@ -465,7 +465,7 @@ -(void)testPlotPointArrayForViewPointLogModulus [plotSpace plotPointForPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", plotPoint[CPTCoordinateX]]; - XCTAssertEqualWithAccuracy([plotPoint[CPTCoordinateX] doubleValue], CPTInverseLogModulus(1.0), CPTFloat(0.01), @"%@", errMessage); + XCTAssertEqualWithAccuracy([plotPoint[CPTCoordinateX] doubleValue], CPTInverseLogModulus(1.0), 0.01, @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", plotPoint[CPTCoordinateY]]; XCTAssertEqual([plotPoint[CPTCoordinateY] doubleValue], 0.0, @"%@", errMessage); } @@ -513,7 +513,7 @@ -(void)testDoublePrecisionPlotPointForViewPointLogModulus [plotSpace doublePrecisionPlotPoint:plotPoint numberOfCoordinates:2 forPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %g", plotPoint[CPTCoordinateX]]; - XCTAssertEqualWithAccuracy(plotPoint[CPTCoordinateX], CPTInverseLogModulus(1.0), CPTFloat(0.01), @"%@", errMessage); + XCTAssertEqualWithAccuracy(plotPoint[CPTCoordinateX], CPTInverseLogModulus(1.0), 0.01, @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %g", plotPoint[CPTCoordinateY]]; XCTAssertEqual(plotPoint[CPTCoordinateY], 0.0, @"%@", errMessage); } From 4f033f06a14f46a50188d22609b1794493b261bc Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Mon, 15 Aug 2016 21:16:38 -0400 Subject: [PATCH 021/212] Updated the Swift example apps with Swift 3.0 changes in Xcode 8 beta 6. --- .../Classes/BarChartController.swift | 8 ++-- .../Classes/PieChartController.swift | 4 +- .../Classes/ScatterPlotController.swift | 37 ++++++++++--------- examples/DatePlot/Source/DateController.swift | 6 +-- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift index e20fddb5f..b28098ff5 100644 --- a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift @@ -89,7 +89,7 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { for tickLocation in customTickLocations { let newLabel = CPTAxisLabel(text:xAxisLabels[labelLocation], textStyle:x.labelTextStyle) labelLocation += 1 - newLabel.tickLocation = tickLocation + newLabel.tickLocation = NSNumber.init(value: tickLocation) newLabel.offset = x.labelOffset + x.majorTickLength newLabel.rotation = CGFloat(M_PI_4) customLabels.insert(newLabel) @@ -114,7 +114,7 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { barPlot1.baseValue = 0.0 barPlot1.dataSource = self barPlot1.barOffset = -0.2 - barPlot1.identifier = "Bar Plot 1" + barPlot1.identifier = NSString.init(string: "Bar Plot 1") newGraph.add(barPlot1, to:plotSpace) // Second bar plot @@ -123,7 +123,7 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { barPlot2.baseValue = 0.0 barPlot2.barOffset = 0.25 barPlot2.barCornerRadius = 2.0 - barPlot2.identifier = "Bar Plot 2" + barPlot2.identifier = NSString.init(string: "Bar Plot 2") newGraph.add(barPlot2, to:plotSpace) self.barGraph = newGraph @@ -136,7 +136,7 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { return 16 } - func number(for plot: CPTPlot, field: UInt, record: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> Any? { switch CPTBarPlotField(rawValue: Int(field))! { case .barLocation: diff --git a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift index 016f0fa1c..50ece431a 100644 --- a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift @@ -36,7 +36,7 @@ class PieChartController : UIViewController, CPTPieChartDataSource, CPTPieChartD let piePlot = CPTPieChart(frame: .zero) piePlot.dataSource = self piePlot.pieRadius = 131.0 - piePlot.identifier = "Pie Chart 1" + piePlot.identifier = NSString.init(string: "Pie Chart 1") piePlot.startAngle = CGFloat(M_PI_4) piePlot.sliceDirection = .counterClockwise piePlot.centerAnchor = CGPoint(x: 0.5, y: 0.38) @@ -54,7 +54,7 @@ class PieChartController : UIViewController, CPTPieChartDataSource, CPTPieChartD return UInt(self.dataForChart.count) } - func number(for plot: CPTPlot, field: UInt, record: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> Any? { if Int(record) > self.dataForChart.count { return nil diff --git a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift index 90b173754..5e1e6685f 100644 --- a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift +++ b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift @@ -64,7 +64,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxi blueLineStyle.lineWidth = 3.0 blueLineStyle.lineColor = .blue() boundLinePlot.dataLineStyle = blueLineStyle - boundLinePlot.identifier = "Blue Plot" + boundLinePlot.identifier = NSString.init(string: "Blue Plot") boundLinePlot.dataSource = self newGraph.add(boundLinePlot) @@ -89,7 +89,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxi greenLineStyle.lineColor = .green() greenLineStyle.dashPattern = [5.0, 5.0] dataSourceLinePlot.dataLineStyle = greenLineStyle - dataSourceLinePlot.identifier = "Green Plot" + dataSourceLinePlot.identifier = NSString.init(string: "Green Plot") dataSourceLinePlot.dataSource = self // Put an area gradient under the plot above @@ -131,7 +131,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxi return UInt(self.dataForPlot.count) } - func number(for plot: CPTPlot, field: UInt, record: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> Any? { let plotField = CPTScatterPlotField(rawValue: Int(field)) @@ -158,24 +158,25 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxi var newLabels = Set() - for tickLocation in locations { - if let labelTextStyle = axis.labelTextStyle?.mutableCopy() as? CPTMutableTextStyle { + if let labelTextStyle = axis.labelTextStyle?.mutableCopy() as? CPTMutableTextStyle { + for location in locations { + if let tickLocation = location as? NSNumber { + if tickLocation.doubleValue >= 0.0 { + labelTextStyle.color = .green() + } + else { + labelTextStyle.color = .red() + } - if tickLocation.doubleValue >= 0.0 { - labelTextStyle.color = .green() - } - else { - labelTextStyle.color = .red() - } + let labelString = formatter.string(for:tickLocation) + let newLabelLayer = CPTTextLayer(text: labelString, style: labelTextStyle) - let labelString = formatter.string(for:tickLocation) - let newLabelLayer = CPTTextLayer(text: labelString, style: labelTextStyle) + let newLabel = CPTAxisLabel(contentLayer: newLabelLayer) + newLabel.tickLocation = tickLocation + newLabel.offset = labelOffset - let newLabel = CPTAxisLabel(contentLayer: newLabelLayer) - newLabel.tickLocation = tickLocation as! NSNumber - newLabel.offset = labelOffset - - newLabels.insert(newLabel) + newLabels.insert(newLabel) + } } axis.axisLabels = newLabels diff --git a/examples/DatePlot/Source/DateController.swift b/examples/DatePlot/Source/DateController.swift index db2f80006..b71accfc2 100644 --- a/examples/DatePlot/Source/DateController.swift +++ b/examples/DatePlot/Source/DateController.swift @@ -34,13 +34,13 @@ class DateController : NSObject, CPTPlotDataSource { // Setup scatter plot space let plotSpace = newGraph.defaultPlotSpace as! CPTXYPlotSpace - plotSpace.xRange = CPTPlotRange(location:0.0, length:oneDay * 5.0) + plotSpace.xRange = CPTPlotRange(location:0.0, length:NSNumber.init(value: oneDay * 5.0)) plotSpace.yRange = CPTPlotRange(location:1.0, length:3.0) // Axes let axisSet = newGraph.axisSet as! CPTXYAxisSet if let x = axisSet.xAxis { - x.majorIntervalLength = oneDay + x.majorIntervalLength = NSNumber.init(value: oneDay) x.orthogonalPosition = 2.0 x.minorTicksPerInterval = 0; let dateFormatter = DateFormatter() @@ -91,7 +91,7 @@ class DateController : NSObject, CPTPlotDataSource { return UInt(self.plotData.count) } - func number(for plot: CPTPlot, field: UInt, record: UInt) -> AnyObject? + func number(for plot: CPTPlot, field: UInt, record: UInt) -> Any? { switch CPTScatterPlotField(rawValue: Int(field))! { case .X: From 300fe0a175974b221baaab76d5f81a2699ceae3f Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Wed, 17 Aug 2016 20:00:22 -0400 Subject: [PATCH 022/212] Updated the Swift example apps with Swift 3.0 changes in Xcode 8 beta 6. --- examples/DatePlot/Source/DateController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/DatePlot/Source/DateController.swift b/examples/DatePlot/Source/DateController.swift index b71accfc2..406ef3aa0 100644 --- a/examples/DatePlot/Source/DateController.swift +++ b/examples/DatePlot/Source/DateController.swift @@ -53,14 +53,14 @@ class DateController : NSObject, CPTPlotDataSource { if let y = axisSet.yAxis { y.majorIntervalLength = 0.5 y.minorTicksPerInterval = 5 - y.orthogonalPosition = oneDay + y.orthogonalPosition = NSNumber.init(value: oneDay) y.labelingPolicy = .none } // Create a plot that uses the data source method let dataSourceLinePlot = CPTScatterPlot(frame: .zero) - dataSourceLinePlot.identifier = "Date Plot" + dataSourceLinePlot.identifier = NSString.init(string: "Date Plot") if let lineStyle = dataSourceLinePlot.dataLineStyle?.mutableCopy() as? CPTMutableLineStyle { lineStyle.lineWidth = 3.0 From b425fb766bdd7aba3771873feca3ae9a1b64ddf1 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Wed, 17 Aug 2016 20:02:34 -0400 Subject: [PATCH 023/212] Added swift function names to eliminate Swift 3 name collisions. --- framework/Source/CPTPlot.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/Source/CPTPlot.h b/framework/Source/CPTPlot.h index d7c68f00d..97115caa2 100644 --- a/framework/Source/CPTPlot.h +++ b/framework/Source/CPTPlot.h @@ -327,8 +327,10 @@ typedef NSMutableArray<__kindof CPTPlot *> CPTMutablePlotArray; -(void)reloadDataInIndexRange:(NSRange)indexRange; -(void)insertDataAtIndex:(NSUInteger)idx numberOfRecords:(NSUInteger)numberOfRecords; -(void)deleteDataInIndexRange:(NSRange)indexRange; --(void)reloadPlotData; --(void)reloadPlotDataInIndexRange:(NSRange)indexRange; +-(void)reloadPlotData NS_SWIFT_NAME( CPTPlot.reloadPlotData() ); + +-(void)reloadPlotDataInIndexRange:(NSRange)indexRange NS_SWIFT_NAME( CPTPlot.reloadPlotData(inIndexRange:) ); + /// @} /// @name Plot Data From ec1759ef3d1d00220055e1d6af1e75d9de40b0a5 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Thu, 18 Aug 2016 20:35:42 -0400 Subject: [PATCH 024/212] Added typedefs for arrays and sets of CPTLayer objects. --- framework/Source/CPTLayer.h | 21 +++++++++++++++++++++ framework/Source/CPTPlot.h | 2 +- framework/Source/CPTPlot.m | 16 ++++++++-------- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/framework/Source/CPTLayer.h b/framework/Source/CPTLayer.h index 52ddc6df6..5f137fe6c 100644 --- a/framework/Source/CPTLayer.h +++ b/framework/Source/CPTLayer.h @@ -5,6 +5,7 @@ /// @file @class CPTGraph; +@class CPTLayer; @class CPTShadow; /// @name Layout @@ -17,6 +18,26 @@ extern NSString *__nonnull const CPTLayerBoundsDidChangeNotification; /// @} +/** + * @brief An array of CPTLayer objects. + **/ +typedef NSArray CPTLayerArray; + +/** + * @brief A mutable array of CPTLayer objects. + **/ +typedef NSMutableArray CPTMutableLayerArray; + +/** + * @brief A set of CPTLayer objects. + **/ +typedef NSSet CPTLayerSet; + +/** + * @brief A mutable set of CPTLayer objects. + **/ +typedef NSMutableSet CPTMutableLayerSet; + /** * @brief An array of CALayer objects. **/ diff --git a/framework/Source/CPTPlot.h b/framework/Source/CPTPlot.h index 97115caa2..30347acb6 100644 --- a/framework/Source/CPTPlot.h +++ b/framework/Source/CPTPlot.h @@ -139,7 +139,7 @@ typedef NSMutableArray<__kindof CPTPlot *> CPTMutablePlotArray; * @param indexRange The range of the data indexes of interest. * @return An array of data labels. **/ --(nullable NSArray *)dataLabelsForPlot:(nonnull CPTPlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTLayerArray *)dataLabelsForPlot:(nonnull CPTPlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets a data label for the given plot. * This method will not be called if diff --git a/framework/Source/CPTPlot.m b/framework/Source/CPTPlot.m index 98b912041..4fd091bed 100644 --- a/framework/Source/CPTPlot.m +++ b/framework/Source/CPTPlot.m @@ -56,7 +56,7 @@ @interface CPTPlot() @property (nonatomic, readwrite, assign) BOOL needsRelabel; @property (nonatomic, readwrite, assign) NSRange labelIndexRange; @property (nonatomic, readwrite, strong, nullable) CPTMutableAnnotationArray *labelAnnotations; -@property (nonatomic, readwrite, copy, nullable) NSArray *dataLabels; +@property (nonatomic, readwrite, copy, nullable) CPTLayerArray *dataLabels; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownLabelIndex; @property (nonatomic, readwrite, assign) NSUInteger cachedDataCount; @@ -709,9 +709,9 @@ -(void)reloadDataLabelsInIndexRange:(NSRange)indexRange atRecordIndex:indexRange.location]; } else if ( [theDataSource respondsToSelector:@selector(dataLabelForPlot:recordIndex:)] ) { - id nilObject = [CPTPlot nilData]; - NSMutableArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableLayerArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTLayer *labelLayer = [theDataSource dataLabelForPlot:self recordIndex:idx]; @@ -1599,8 +1599,8 @@ -(void)relabel NSFormatter *dataLabelFormatter = self.labelFormatter; BOOL plotProvidesLabels = dataLabelTextStyle && dataLabelFormatter; - BOOL hasCachedLabels = NO; - NSMutableArray *cachedLabels = (NSMutableArray *)[self cachedArrayForKey:CPTPlotBindingDataLabels]; + BOOL hasCachedLabels = NO; + CPTMutableLayerArray *cachedLabels = (CPTMutableLayerArray *)[self cachedArrayForKey:CPTPlotBindingDataLabels]; for ( CPTLayer *label in cachedLabels ) { if ( ![label isKindOfClass:nullClass] ) { hasCachedLabels = YES; @@ -2034,12 +2034,12 @@ -(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)in /// @cond --(nullable NSArray *)dataLabels +-(nullable CPTLayerArray *)dataLabels { return [self cachedArrayForKey:CPTPlotBindingDataLabels]; } --(void)setDataLabels:(nullable NSArray *)newDataLabels +-(void)setDataLabels:(nullable CPTLayerArray *)newDataLabels { [self cacheArray:newDataLabels forKey:CPTPlotBindingDataLabels]; [self setNeedsRelabel]; From b1470b1474162ae9a9b6928341a9cb14b096403a Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Thu, 18 Aug 2016 20:39:18 -0400 Subject: [PATCH 025/212] Fixed missing data labels when adding and removing plot data. Fixed issue #293. --- framework/Source/CPTPlot.m | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/framework/Source/CPTPlot.m b/framework/Source/CPTPlot.m index 4fd091bed..f1e0d4892 100644 --- a/framework/Source/CPTPlot.m +++ b/framework/Source/CPTPlot.m @@ -628,6 +628,15 @@ -(void)insertDataAtIndex:(NSUInteger)idx numberOfRecords:(NSUInteger)numberOfRec } } + CPTMutableAnnotationArray *labelArray = self.labelAnnotations; + if ( labelArray ) { + id nullObject = [NSNull null]; + NSUInteger lastIndex = idx + numberOfRecords - 1; + for ( NSUInteger i = idx; i <= lastIndex; i++ ) { + [labelArray insertObject:nullObject atIndex:i]; + } + } + self.cachedDataCount += numberOfRecords; [self reloadDataInIndexRange:NSMakeRange(idx, numberOfRecords)]; } @@ -659,8 +668,20 @@ -(void)deleteDataInIndexRange:(NSRange)indexRange } } + CPTMutableAnnotationArray *labelArray = self.labelAnnotations; + + NSUInteger maxIndex = NSMaxRange(indexRange); + Class annotationClass = [CPTAnnotation class]; + + for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { + CPTAnnotation *annotation = labelArray[i]; + if ( [annotation isKindOfClass:annotationClass] ) { + [self removeAnnotation:annotation]; + } + } + [labelArray removeObjectsInRange:indexRange]; + self.cachedDataCount -= indexRange.length; - [self relabelIndexRange:NSMakeRange(indexRange.location, self.cachedDataCount - indexRange.location)]; [self setNeedsDisplay]; } From 176573269744945e022b709a0aacb51cc39390a4 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 19 Aug 2016 20:43:17 -0400 Subject: [PATCH 026/212] Added tvOS to the the page headers in the generated API documentation. --- documentation/doxygen/doxygen touch.config | 4 ++-- documentation/doxygen/doxygen.config | 2 +- framework/Source/mainpage.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/documentation/doxygen/doxygen touch.config b/documentation/doxygen/doxygen touch.config index 437d31484..847e7bb09 100644 --- a/documentation/doxygen/doxygen touch.config +++ b/documentation/doxygen/doxygen touch.config @@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "Core Plot (iOS)" +PROJECT_NAME = "Core Plot (iOS and tvOS)" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -44,7 +44,7 @@ PROJECT_NUMBER = # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "Cocoa plotting framework for Mac OS X and iOS" +PROJECT_BRIEF = "Cocoa plotting framework for Mac OS X, iOS, and tvOS" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/documentation/doxygen/doxygen.config b/documentation/doxygen/doxygen.config index c96d56493..6653a4a8e 100644 --- a/documentation/doxygen/doxygen.config +++ b/documentation/doxygen/doxygen.config @@ -44,7 +44,7 @@ PROJECT_NUMBER = # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = "Cocoa plotting framework for Mac OS X and iOS" +PROJECT_BRIEF = "Cocoa plotting framework for Mac OS X, iOS, and tvOS" # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 diff --git a/framework/Source/mainpage.h b/framework/Source/mainpage.h index 417135609..402872198 100644 --- a/framework/Source/mainpage.h +++ b/framework/Source/mainpage.h @@ -2,7 +2,7 @@ * * @section intro Introduction * - * Core Plot is a 2D plotting framework for Mac OS X and iOS. + * Core Plot is a 2D Cocoa plotting framework for Mac OS X, iOS, and tvOS. * It is highly customizable and capable of drawing many types of plots. * See the Example Graphs * wiki page and the example applications From d3c48b08cf80af0e223f49843a2b2ad37cfdfce8 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 19 Aug 2016 20:43:54 -0400 Subject: [PATCH 027/212] Ignore the NS_SWIFT_NAME() macro when generating documentation. --- documentation/doxygen/doxygen touch.config | 3 ++- documentation/doxygen/doxygen.config | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/documentation/doxygen/doxygen touch.config b/documentation/doxygen/doxygen touch.config index 847e7bb09..7b182c6ba 100644 --- a/documentation/doxygen/doxygen touch.config +++ b/documentation/doxygen/doxygen touch.config @@ -2069,7 +2069,8 @@ PREDEFINED = TARGET_OS_IPHONE, \ "NS_DESIGNATED_INITIALIZER:='' ," \ "NS_RETURNS_INNER_POINTER:='' ," \ "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type ," \ - "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type" + "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type ," \ + "NS_SWIFT_NAME(_name):=''" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/documentation/doxygen/doxygen.config b/documentation/doxygen/doxygen.config index 6653a4a8e..de141a6a6 100644 --- a/documentation/doxygen/doxygen.config +++ b/documentation/doxygen/doxygen.config @@ -2066,7 +2066,8 @@ INCLUDE_FILE_PATTERNS = PREDEFINED = "NS_DESIGNATED_INITIALIZER:='' ," \ "NS_RETURNS_INNER_POINTER:='' ," \ "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type ," \ - "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type" + "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type ," \ + "NS_SWIFT_NAME(_name):=''" # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The From 08461c3b0e5995f2d2e30eb63d040d2a5dc119e2 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sun, 21 Aug 2016 14:21:00 -0400 Subject: [PATCH 028/212] Added Swift name mappings for all string constants. --- documentation/changelog.markdown | 2 ++ documentation/doxygen/doxygen touch.config | 13 ++++++---- documentation/doxygen/doxygen.config | 13 ++++++---- .../Classes/BarChartController.swift | 2 +- .../Classes/PieChartController.swift | 2 +- .../Classes/ScatterPlotController.swift | 2 +- framework/Source/CPTBarPlot.h | 15 +++++++---- framework/Source/CPTBarPlot.m | 10 +++---- framework/Source/CPTDefinitions.h | 16 ++++++++++++ framework/Source/CPTExceptions.h | 13 +++++++--- framework/Source/CPTExceptions.m | 6 ++--- framework/Source/CPTGraph.h | 26 +++++++++++++------ framework/Source/CPTGraph.m | 8 +++--- framework/Source/CPTLayer.h | 7 ++++- framework/Source/CPTLayer.m | 2 +- framework/Source/CPTLegend.h | 11 +++++--- framework/Source/CPTLegend.m | 6 ++--- framework/Source/CPTPieChart.h | 11 +++++--- framework/Source/CPTPieChart.m | 6 ++--- framework/Source/CPTPlot.h | 7 ++++- framework/Source/CPTPlot.m | 2 +- framework/Source/CPTPlotSpace.h | 24 ++++++++++++----- framework/Source/CPTPlotSpace.m | 8 +++--- framework/Source/CPTRangePlot.h | 19 +++++++++----- framework/Source/CPTRangePlot.m | 14 +++++----- framework/Source/CPTScatterPlot.h | 11 +++++--- framework/Source/CPTScatterPlot.m | 6 ++--- framework/Source/CPTTheme.h | 21 ++++++++++----- framework/Source/CPTTheme.m | 4 +-- framework/Source/CPTTradingRangePlot.h | 25 +++++++++++------- framework/Source/CPTTradingRangePlot.m | 20 +++++++------- framework/Source/_CPTDarkGradientTheme.m | 2 +- framework/Source/_CPTPlainBlackTheme.m | 2 +- framework/Source/_CPTPlainWhiteTheme.m | 2 +- framework/Source/_CPTSlateTheme.m | 2 +- framework/Source/_CPTStocksTheme.m | 2 +- 36 files changed, 220 insertions(+), 122 deletions(-) diff --git a/documentation/changelog.markdown b/documentation/changelog.markdown index 3835463fe..4f8f4a975 100644 --- a/documentation/changelog.markdown +++ b/documentation/changelog.markdown @@ -6,6 +6,8 @@ To be determined. ## Details - **New**: Increased the iOS deployment target to iOS 8. +- **Changed**: Added Swift name mappings for all string constants. +- **Changed**: Updated all Swift example apps to Swift 3. - **Changed**: Miscellaneous bug fixes and cleanup. diff --git a/documentation/doxygen/doxygen touch.config b/documentation/doxygen/doxygen touch.config index 7b182c6ba..d18a23b42 100644 --- a/documentation/doxygen/doxygen touch.config +++ b/documentation/doxygen/doxygen touch.config @@ -2066,11 +2066,14 @@ INCLUDE_FILE_PATTERNS = PREDEFINED = TARGET_OS_IPHONE, \ TARGET_OS_TV, \ TARGET_OS_SIMULATOR, \ - "NS_DESIGNATED_INITIALIZER:='' ," \ - "NS_RETURNS_INNER_POINTER:='' ," \ - "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type ," \ - "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type ," \ - "NS_SWIFT_NAME(_name):=''" + "NS_DESIGNATED_INITIALIZER:= " \ + "NS_RETURNS_INNER_POINTER:= " \ + "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_SWIFT_NAME(_name):= " \ + "cpt_deprecated:= " \ + "cpt_swift_enum:= " \ + "cpt_swift_struct:= " # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/documentation/doxygen/doxygen.config b/documentation/doxygen/doxygen.config index de141a6a6..942b4ec35 100644 --- a/documentation/doxygen/doxygen.config +++ b/documentation/doxygen/doxygen.config @@ -2063,11 +2063,14 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = "NS_DESIGNATED_INITIALIZER:='' ," \ - "NS_RETURNS_INNER_POINTER:='' ," \ - "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type ," \ - "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type ," \ - "NS_SWIFT_NAME(_name):=''" +PREDEFINED = "NS_DESIGNATED_INITIALIZER:= " \ + "NS_RETURNS_INNER_POINTER:= " \ + "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_SWIFT_NAME(_name):= " \ + "cpt_deprecated:= " \ + "cpt_swift_enum:= " \ + "cpt_swift_struct:= " # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this # tag can be used to specify a list of macro names that should be expanded. The diff --git a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift index b28098ff5..d8ec6d36b 100644 --- a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift @@ -11,7 +11,7 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { // Create graph from theme let newGraph = CPTXYGraph(frame: .zero) - newGraph.apply(CPTTheme(named: kCPTDarkGradientTheme)) + newGraph.apply(CPTTheme(named: .darkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph diff --git a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift index 50ece431a..7ccb93a88 100644 --- a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift @@ -13,7 +13,7 @@ class PieChartController : UIViewController, CPTPieChartDataSource, CPTPieChartD // Create graph from theme let newGraph = CPTXYGraph(frame: .zero) - newGraph.apply(CPTTheme(named: kCPTDarkGradientTheme)) + newGraph.apply(CPTTheme(named: .darkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph diff --git a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift index 5e1e6685f..2f41d6be9 100644 --- a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift +++ b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift @@ -14,7 +14,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxi // Create graph from theme let newGraph = CPTXYGraph(frame: .zero) - newGraph.apply(CPTTheme(named: kCPTDarkGradientTheme)) + newGraph.apply(CPTTheme(named: .darkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph diff --git a/framework/Source/CPTBarPlot.h b/framework/Source/CPTBarPlot.h index 307be7b0b..f44f7ad94 100644 --- a/framework/Source/CPTBarPlot.h +++ b/framework/Source/CPTBarPlot.h @@ -13,13 +13,18 @@ @class CPTTextLayer; @class CPTTextStyle; +/** + * @brief Bar plot bindings. + **/ +typedef NSString *CPTBarPlotBinding cpt_swift_struct; + /// @ingroup plotBindingsBarPlot /// @{ -extern NSString *__nonnull const CPTBarPlotBindingBarLocations; -extern NSString *__nonnull const CPTBarPlotBindingBarTips; -extern NSString *__nonnull const CPTBarPlotBindingBarBases; -extern NSString *__nonnull const CPTBarPlotBindingBarFills; -extern NSString *__nonnull const CPTBarPlotBindingBarLineStyles; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarLocations; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarTips; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarBases; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarFills; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarLineStyles; /// @} /** diff --git a/framework/Source/CPTBarPlot.m b/framework/Source/CPTBarPlot.m index ba07e3288..6bdaaf8a5 100644 --- a/framework/Source/CPTBarPlot.m +++ b/framework/Source/CPTBarPlot.m @@ -27,11 +27,11 @@ * @endif **/ -NSString *const CPTBarPlotBindingBarLocations = @"barLocations"; ///< Bar locations. -NSString *const CPTBarPlotBindingBarTips = @"barTips"; ///< Bar tips. -NSString *const CPTBarPlotBindingBarBases = @"barBases"; ///< Bar bases. -NSString *const CPTBarPlotBindingBarFills = @"barFills"; ///< Bar fills. -NSString *const CPTBarPlotBindingBarLineStyles = @"barLineStyles"; ///< Bar line styles. +CPTBarPlotBinding const CPTBarPlotBindingBarLocations = @"barLocations"; ///< Bar locations. +CPTBarPlotBinding const CPTBarPlotBindingBarTips = @"barTips"; ///< Bar tips. +CPTBarPlotBinding const CPTBarPlotBindingBarBases = @"barBases"; ///< Bar bases. +CPTBarPlotBinding const CPTBarPlotBindingBarFills = @"barFills"; ///< Bar fills. +CPTBarPlotBinding const CPTBarPlotBindingBarLineStyles = @"barLineStyles"; ///< Bar line styles. /// @cond @interface CPTBarPlot() diff --git a/framework/Source/CPTDefinitions.h b/framework/Source/CPTDefinitions.h index 10787bdb7..7ca25c47b 100644 --- a/framework/Source/CPTDefinitions.h +++ b/framework/Source/CPTDefinitions.h @@ -42,6 +42,22 @@ #define cpt_deprecated __attribute__( (deprecated) ) +// Swift wrappers + +/** + * @def cpt_swift_enum + * @hideinitializer + * @brief Marks a type definition to be imported into Swift as an enumeration. + **/ +#define cpt_swift_enum __attribute__( ( swift_wrapper(enum) ) ) + +/** + * @def cpt_swift_struct + * @hideinitializer + * @brief Marks a type definition to be imported into Swift as a structure. + **/ +#define cpt_swift_struct __attribute__( ( swift_wrapper(struct) ) ) + // Type safety defines /** diff --git a/framework/Source/CPTExceptions.h b/framework/Source/CPTExceptions.h index d62def47a..67eed530c 100644 --- a/framework/Source/CPTExceptions.h +++ b/framework/Source/CPTExceptions.h @@ -1,8 +1,15 @@ /// @file +#import "CPTDefinitions.h" + +/** + * @brief Custom exception type. + **/ +typedef NSString *CPTExceptionType cpt_swift_struct; + /// @name Custom Exception Identifiers /// @{ -extern NSString *__nonnull const CPTException; -extern NSString *__nonnull const CPTDataException; -extern NSString *__nonnull const CPTNumericDataException; +extern CPTExceptionType __nonnull const CPTException; +extern CPTExceptionType __nonnull const CPTDataException; +extern CPTExceptionType __nonnull const CPTNumericDataException; /// @} diff --git a/framework/Source/CPTExceptions.m b/framework/Source/CPTExceptions.m index 349839242..efe533257 100644 --- a/framework/Source/CPTExceptions.m +++ b/framework/Source/CPTExceptions.m @@ -1,5 +1,5 @@ #import "CPTExceptions.h" -NSString *const CPTException = @"CPTException"; ///< General Core Plot exceptions. -NSString *const CPTDataException = @"CPTDataException"; ///< Core Plot data exceptions. -NSString *const CPTNumericDataException = @"CPTNumericDataException"; ///< Core Plot numeric data exceptions. +CPTExceptionType const CPTException = @"CPTException"; ///< General Core Plot exceptions. +CPTExceptionType const CPTDataException = @"CPTDataException"; ///< Core Plot data exceptions. +CPTExceptionType const CPTNumericDataException = @"CPTNumericDataException"; ///< Core Plot numeric data exceptions. diff --git a/framework/Source/CPTGraph.h b/framework/Source/CPTGraph.h index f6ac1f1c4..7c4c397ac 100644 --- a/framework/Source/CPTGraph.h +++ b/framework/Source/CPTGraph.h @@ -14,35 +14,45 @@ @class CPTTextStyle; @class CPTLayerAnnotation; +/** + * @brief Graph notification type. + **/ +typedef NSString *CPTGraphNotification cpt_swift_struct; + +/** + * @brief The userInfo dictionary keys used by CPTGraph plot space notifications. + **/ +typedef NSString *CPTGraphPlotSpaceKey cpt_swift_struct; + /// @name Graph /// @{ /** @brief Notification sent by various objects to tell the graph it should redraw itself. * @ingroup notification **/ -extern NSString *__nonnull const CPTGraphNeedsRedrawNotification; +extern CPTGraphNotification __nonnull const CPTGraphNeedsRedrawNotification NS_SWIFT_NAME(needsRedraw); /** @brief Notification sent by a graph after adding a new plot space. * @ingroup notification * * The notification userInfo dictionary will include the new plot space under the - * CPTGraphPlotSpaceNotificationKey key. + * #CPTGraphPlotSpaceNotificationKey key. **/ -extern NSString *__nonnull const CPTGraphDidAddPlotSpaceNotification; +extern CPTGraphNotification __nonnull const CPTGraphDidAddPlotSpaceNotification NS_SWIFT_NAME(didAddPlotSpace); /** @brief Notification sent by a graph after removing a plot space. * @ingroup notification * * The notification userInfo dictionary will include the removed plot space under the - * CPTGraphPlotSpaceNotificationKey key. + * #CPTGraphPlotSpaceNotificationKey key. **/ -extern NSString *__nonnull const CPTGraphDidRemovePlotSpaceNotification; +extern CPTGraphNotification __nonnull const CPTGraphDidRemovePlotSpaceNotification NS_SWIFT_NAME(didRemovePlotSpace); -/** @brief The userInfo dictionary key used by the CPTGraphDidAddPlotSpaceNotification - * and CPTGraphDidRemovePlotSpaceNotification notifications for the plot space. +/** @brief The userInfo dictionary key used by the #CPTGraphDidAddPlotSpaceNotification + * and #CPTGraphDidRemovePlotSpaceNotification notifications for the plot space. * @ingroup notification **/ -extern NSString *__nonnull const CPTGraphPlotSpaceNotificationKey; +extern CPTGraphPlotSpaceKey __nonnull const CPTGraphPlotSpaceNotificationKey; /// @} diff --git a/framework/Source/CPTGraph.m b/framework/Source/CPTGraph.m index ba591f216..13dd7ae08 100644 --- a/framework/Source/CPTGraph.m +++ b/framework/Source/CPTGraph.m @@ -22,10 +22,10 @@ * @ingroup animation **/ -NSString *const CPTGraphNeedsRedrawNotification = @"CPTGraphNeedsRedrawNotification"; -NSString *const CPTGraphDidAddPlotSpaceNotification = @"CPTGraphDidAddPlotSpaceNotification"; -NSString *const CPTGraphDidRemovePlotSpaceNotification = @"CPTGraphDidRemovePlotSpaceNotification"; -NSString *const CPTGraphPlotSpaceNotificationKey = @"CPTGraphPlotSpaceNotificationKey"; +CPTGraphNotification const CPTGraphNeedsRedrawNotification = @"CPTGraphNeedsRedrawNotification"; +CPTGraphNotification const CPTGraphDidAddPlotSpaceNotification = @"CPTGraphDidAddPlotSpaceNotification"; +CPTGraphNotification const CPTGraphDidRemovePlotSpaceNotification = @"CPTGraphDidRemovePlotSpaceNotification"; +CPTGraphPlotSpaceKey const CPTGraphPlotSpaceNotificationKey = @"CPTGraphPlotSpaceNotificationKey"; /// @cond @interface CPTGraph() diff --git a/framework/Source/CPTLayer.h b/framework/Source/CPTLayer.h index 5f137fe6c..729623938 100644 --- a/framework/Source/CPTLayer.h +++ b/framework/Source/CPTLayer.h @@ -8,13 +8,18 @@ @class CPTLayer; @class CPTShadow; +/** + * @brief Layer notification type. + **/ +typedef NSString *CPTLayerNotification cpt_swift_struct; + /// @name Layout /// @{ /** @brief Notification sent by all layers when the layer @link CALayer::bounds bounds @endlink change. * @ingroup notification **/ -extern NSString *__nonnull const CPTLayerBoundsDidChangeNotification; +extern CPTLayerNotification __nonnull const CPTLayerBoundsDidChangeNotification NS_SWIFT_NAME(boundsDidChange); /// @} diff --git a/framework/Source/CPTLayer.m b/framework/Source/CPTLayer.m index be45a9adc..2141fb181 100644 --- a/framework/Source/CPTLayer.m +++ b/framework/Source/CPTLayer.m @@ -11,7 +11,7 @@ #import #import -NSString *const CPTLayerBoundsDidChangeNotification = @"CPTLayerBoundsDidChangeNotification"; +CPTLayerNotification const CPTLayerBoundsDidChangeNotification = @"CPTLayerBoundsDidChangeNotification"; /** @defgroup animation Animatable Properties * @brief Custom layer properties that can be animated using Core Animation. diff --git a/framework/Source/CPTLegend.h b/framework/Source/CPTLegend.h index e339e94c5..06c9bf942 100644 --- a/framework/Source/CPTLegend.h +++ b/framework/Source/CPTLegend.h @@ -8,23 +8,28 @@ @class CPTLineStyle; @class CPTTextStyle; +/** + * @brief Graph notification type. + **/ +typedef NSString *CPTLegendNotification cpt_swift_struct; + /// @name Legend /// @{ /** @brief Notification sent by plots to tell the legend it should redraw itself. * @ingroup notification **/ -extern NSString *__nonnull const CPTLegendNeedsRedrawForPlotNotification; +extern CPTLegendNotification __nonnull const CPTLegendNeedsRedrawForPlotNotification NS_SWIFT_NAME(needsRedrawForPlot); /** @brief Notification sent by plots to tell the legend it should update its layout and redraw itself. * @ingroup notification **/ -extern NSString *__nonnull const CPTLegendNeedsLayoutForPlotNotification; +extern CPTLegendNotification __nonnull const CPTLegendNeedsLayoutForPlotNotification NS_SWIFT_NAME(needsLayoutForPlot); /** @brief Notification sent by plots to tell the legend it should reload all legend entries. * @ingroup notification **/ -extern NSString *__nonnull const CPTLegendNeedsReloadEntriesForPlotNotification; +extern CPTLegendNotification __nonnull const CPTLegendNeedsReloadEntriesForPlotNotification NS_SWIFT_NAME(needsReloadEntriesForPlot); /// @} diff --git a/framework/Source/CPTLegend.m b/framework/Source/CPTLegend.m index 20eb78cf6..351e6e2b0 100644 --- a/framework/Source/CPTLegend.m +++ b/framework/Source/CPTLegend.m @@ -20,9 +20,9 @@ * @ingroup animation **/ -NSString *const CPTLegendNeedsRedrawForPlotNotification = @"CPTLegendNeedsRedrawForPlotNotification"; -NSString *const CPTLegendNeedsLayoutForPlotNotification = @"CPTLegendNeedsLayoutForPlotNotification"; -NSString *const CPTLegendNeedsReloadEntriesForPlotNotification = @"CPTLegendNeedsReloadEntriesForPlotNotification"; +CPTLegendNotification const CPTLegendNeedsRedrawForPlotNotification = @"CPTLegendNeedsRedrawForPlotNotification"; +CPTLegendNotification const CPTLegendNeedsLayoutForPlotNotification = @"CPTLegendNeedsLayoutForPlotNotification"; +CPTLegendNotification const CPTLegendNeedsReloadEntriesForPlotNotification = @"CPTLegendNeedsReloadEntriesForPlotNotification"; /// @cond @interface CPTLegend() diff --git a/framework/Source/CPTPieChart.h b/framework/Source/CPTPieChart.h index 1ff0d9587..e7aeb6e25 100644 --- a/framework/Source/CPTPieChart.h +++ b/framework/Source/CPTPieChart.h @@ -9,11 +9,16 @@ @class CPTTextLayer; @class CPTLineStyle; +/** + * @brief Pie chart bindings. + **/ +typedef NSString *CPTPieChartBinding cpt_swift_struct; + /// @ingroup plotBindingsPieChart /// @{ -extern NSString *__nonnull const CPTPieChartBindingPieSliceWidthValues; -extern NSString *__nonnull const CPTPieChartBindingPieSliceFills; -extern NSString *__nonnull const CPTPieChartBindingPieSliceRadialOffsets; +extern CPTPieChartBinding __nonnull const CPTPieChartBindingPieSliceWidthValues; +extern CPTPieChartBinding __nonnull const CPTPieChartBindingPieSliceFills; +extern CPTPieChartBinding __nonnull const CPTPieChartBindingPieSliceRadialOffsets; /// @} /** diff --git a/framework/Source/CPTPieChart.m b/framework/Source/CPTPieChart.m index 3487c03b6..705bd2607 100644 --- a/framework/Source/CPTPieChart.m +++ b/framework/Source/CPTPieChart.m @@ -25,9 +25,9 @@ * @endif **/ -NSString *const CPTPieChartBindingPieSliceWidthValues = @"sliceWidths"; ///< Pie slice widths. -NSString *const CPTPieChartBindingPieSliceFills = @"sliceFills"; ///< Pie slice interior fills. -NSString *const CPTPieChartBindingPieSliceRadialOffsets = @"sliceRadialOffsets"; ///< Pie slice radial offsets. +CPTPieChartBinding const CPTPieChartBindingPieSliceWidthValues = @"sliceWidths"; ///< Pie slice widths. +CPTPieChartBinding const CPTPieChartBindingPieSliceFills = @"sliceFills"; ///< Pie slice interior fills. +CPTPieChartBinding const CPTPieChartBindingPieSliceRadialOffsets = @"sliceRadialOffsets"; ///< Pie slice radial offsets. /// @cond @interface CPTPieChart() diff --git a/framework/Source/CPTPlot.h b/framework/Source/CPTPlot.h index 30347acb6..5a5e87fc3 100644 --- a/framework/Source/CPTPlot.h +++ b/framework/Source/CPTPlot.h @@ -14,9 +14,14 @@ @class CPTPlotRange; @class CPTTextStyle; +/** + * @brief Plot bindings. + **/ +typedef NSString *CPTPlotBinding cpt_swift_struct; + /// @ingroup plotBindingsAllPlots /// @{ -extern NSString *__nonnull const CPTPlotBindingDataLabels; +extern CPTPlotBinding __nonnull const CPTPlotBindingDataLabels; /// @} /** diff --git a/framework/Source/CPTPlot.m b/framework/Source/CPTPlot.m index f1e0d4892..bb7afa5c7 100644 --- a/framework/Source/CPTPlot.m +++ b/framework/Source/CPTPlot.m @@ -45,7 +45,7 @@ * @endif **/ -NSString *const CPTPlotBindingDataLabels = @"dataLabels"; ///< Plot data labels. +CPTPlotBinding const CPTPlotBindingDataLabels = @"dataLabels"; ///< Plot data labels. /// @cond @interface CPTPlot() diff --git a/framework/Source/CPTPlotSpace.h b/framework/Source/CPTPlotSpace.h index 646e906fa..902817b73 100644 --- a/framework/Source/CPTPlotSpace.h +++ b/framework/Source/CPTPlotSpace.h @@ -7,6 +7,16 @@ @class CPTGraph; @class CPTPlotSpace; +/** + * @brief Plot space mapping notification type. + **/ +typedef NSString *CPTPlotSpaceCoordinateMapping cpt_swift_struct; + +/** + * @brief The userInfo dictionary keys used by #CPTPlotSpaceCoordinateMappingDidChangeNotification notifications. + **/ +typedef NSString *CPTPlotSpaceInfoKey cpt_swift_struct; + /// @name Plot Space /// @{ @@ -16,32 +26,32 @@ * the plot space coordinate system and drawing coordinates changes. * @ingroup notification **/ -extern NSString *__nonnull const CPTPlotSpaceCoordinateMappingDidChangeNotification; +extern CPTPlotSpaceCoordinateMapping __nonnull const CPTPlotSpaceCoordinateMappingDidChangeNotification; -/** @brief The userInfo dictionary key used by the CPTPlotSpaceCoordinateMappingDidChangeNotification +/** @brief The userInfo dictionary key used by the #CPTPlotSpaceCoordinateMappingDidChangeNotification * to indicate the plot coordinate affected by the mapping change. * * The value associated with this key is the CPTCoordinate affected by the change wrapped in an instance of NSNumber. * @ingroup notification **/ -extern NSString *__nonnull const CPTPlotSpaceCoordinateKey; +extern CPTPlotSpaceInfoKey __nonnull const CPTPlotSpaceCoordinateKey; -/** @brief The userInfo dictionary key used by the CPTPlotSpaceCoordinateMappingDidChangeNotification +/** @brief The userInfo dictionary key used by the #CPTPlotSpaceCoordinateMappingDidChangeNotification * to indicate whether the mapping change is a scroll movement or other change. * * The value associated with this key is a boolean value wrapped in an instance of NSNumber. The value * is @YES if the plot space change represents a horizontal or vertical translation, @NO otherwise. * @ingroup notification **/ -extern NSString *__nonnull const CPTPlotSpaceScrollingKey; +extern CPTPlotSpaceInfoKey __nonnull const CPTPlotSpaceScrollingKey; -/** @brief The userInfo dictionary key used by the CPTPlotSpaceCoordinateMappingDidChangeNotification +/** @brief The userInfo dictionary key used by the #CPTPlotSpaceCoordinateMappingDidChangeNotification * to indicate the displacement offset for scrolling changes in drawing coordinates. * * The value associated with this key is the displacement offset wrapped in an instance of NSNumber. * @ingroup notification **/ -extern NSString *__nonnull const CPTPlotSpaceDisplacementKey; +extern CPTPlotSpaceInfoKey __nonnull const CPTPlotSpaceDisplacementKey; /// @} diff --git a/framework/Source/CPTPlotSpace.m b/framework/Source/CPTPlotSpace.m index 8a40414a2..e6a518d9b 100644 --- a/framework/Source/CPTPlotSpace.m +++ b/framework/Source/CPTPlotSpace.m @@ -4,11 +4,11 @@ #import "CPTMutablePlotRange.h" #import "CPTUtilities.h" -NSString *const CPTPlotSpaceCoordinateMappingDidChangeNotification = @"CPTPlotSpaceCoordinateMappingDidChangeNotification"; +CPTPlotSpaceCoordinateMapping const CPTPlotSpaceCoordinateMappingDidChangeNotification = @"CPTPlotSpaceCoordinateMappingDidChangeNotification"; -NSString *const CPTPlotSpaceCoordinateKey = @"CPTPlotSpaceCoordinateKey"; -NSString *const CPTPlotSpaceScrollingKey = @"CPTPlotSpaceScrollingKey"; -NSString *const CPTPlotSpaceDisplacementKey = @"CPTPlotSpaceDisplacementKey"; +CPTPlotSpaceInfoKey const CPTPlotSpaceCoordinateKey = @"CPTPlotSpaceCoordinateKey"; +CPTPlotSpaceInfoKey const CPTPlotSpaceScrollingKey = @"CPTPlotSpaceScrollingKey"; +CPTPlotSpaceInfoKey const CPTPlotSpaceDisplacementKey = @"CPTPlotSpaceDisplacementKey"; /// @cond diff --git a/framework/Source/CPTRangePlot.h b/framework/Source/CPTRangePlot.h index e8a0cb07e..6e9d3f112 100644 --- a/framework/Source/CPTRangePlot.h +++ b/framework/Source/CPTRangePlot.h @@ -5,15 +5,20 @@ @class CPTFill; @class CPTRangePlot; +/** + * @brief Range plot bindings. + **/ +typedef NSString *CPTRangePlotBinding cpt_swift_struct; + /// @ingroup plotBindingsRangePlot /// @{ -extern NSString *__nonnull const CPTRangePlotBindingXValues; -extern NSString *__nonnull const CPTRangePlotBindingYValues; -extern NSString *__nonnull const CPTRangePlotBindingHighValues; -extern NSString *__nonnull const CPTRangePlotBindingLowValues; -extern NSString *__nonnull const CPTRangePlotBindingLeftValues; -extern NSString *__nonnull const CPTRangePlotBindingRightValues; -extern NSString *__nonnull const CPTRangePlotBindingBarLineStyles; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingXValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingYValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingHighValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingLowValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingLeftValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingRightValues; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingBarLineStyles; /// @} /** diff --git a/framework/Source/CPTRangePlot.m b/framework/Source/CPTRangePlot.m index 9b1d7483e..c1fc4d271 100644 --- a/framework/Source/CPTRangePlot.m +++ b/framework/Source/CPTRangePlot.m @@ -27,13 +27,13 @@ * @endif **/ -NSString *const CPTRangePlotBindingXValues = @"xValues"; ///< X values. -NSString *const CPTRangePlotBindingYValues = @"yValues"; ///< Y values. -NSString *const CPTRangePlotBindingHighValues = @"highValues"; ///< High values. -NSString *const CPTRangePlotBindingLowValues = @"lowValues"; ///< Low values. -NSString *const CPTRangePlotBindingLeftValues = @"leftValues"; ///< Left price values. -NSString *const CPTRangePlotBindingRightValues = @"rightValues"; ///< Right price values. -NSString *const CPTRangePlotBindingBarLineStyles = @"barLineStyles"; ///< Bar line styles. +CPTRangePlotBinding const CPTRangePlotBindingXValues = @"xValues"; ///< X values. +CPTRangePlotBinding const CPTRangePlotBindingYValues = @"yValues"; ///< Y values. +CPTRangePlotBinding const CPTRangePlotBindingHighValues = @"highValues"; ///< High values. +CPTRangePlotBinding const CPTRangePlotBindingLowValues = @"lowValues"; ///< Low values. +CPTRangePlotBinding const CPTRangePlotBindingLeftValues = @"leftValues"; ///< Left price values. +CPTRangePlotBinding const CPTRangePlotBindingRightValues = @"rightValues"; ///< Right price values. +CPTRangePlotBinding const CPTRangePlotBindingBarLineStyles = @"barLineStyles"; ///< Bar line styles. /// @cond struct CGPointError { diff --git a/framework/Source/CPTScatterPlot.h b/framework/Source/CPTScatterPlot.h index 2d09335c5..8cd3b9a7d 100644 --- a/framework/Source/CPTScatterPlot.h +++ b/framework/Source/CPTScatterPlot.h @@ -9,11 +9,16 @@ @class CPTScatterPlot; @class CPTFill; +/** + * @brief Scatter plot bindings. + **/ +typedef NSString *CPTScatterPlotBinding cpt_swift_struct; + /// @ingroup plotBindingsScatterPlot /// @{ -extern NSString *__nonnull const CPTScatterPlotBindingXValues; -extern NSString *__nonnull const CPTScatterPlotBindingYValues; -extern NSString *__nonnull const CPTScatterPlotBindingPlotSymbols; +extern CPTScatterPlotBinding __nonnull const CPTScatterPlotBindingXValues; +extern CPTScatterPlotBinding __nonnull const CPTScatterPlotBindingYValues; +extern CPTScatterPlotBinding __nonnull const CPTScatterPlotBindingPlotSymbols; /// @} /** diff --git a/framework/Source/CPTScatterPlot.m b/framework/Source/CPTScatterPlot.m index eb9757bcc..e101e18b3 100644 --- a/framework/Source/CPTScatterPlot.m +++ b/framework/Source/CPTScatterPlot.m @@ -27,9 +27,9 @@ * @endif **/ -NSString *const CPTScatterPlotBindingXValues = @"xValues"; ///< X values. -NSString *const CPTScatterPlotBindingYValues = @"yValues"; ///< Y values. -NSString *const CPTScatterPlotBindingPlotSymbols = @"plotSymbols"; ///< Plot symbols. +CPTScatterPlotBinding const CPTScatterPlotBindingXValues = @"xValues"; ///< X values. +CPTScatterPlotBinding const CPTScatterPlotBindingYValues = @"yValues"; ///< Y values. +CPTScatterPlotBinding const CPTScatterPlotBindingPlotSymbols = @"plotSymbols"; ///< Plot symbols. /// @cond @interface CPTScatterPlot() diff --git a/framework/Source/CPTTheme.h b/framework/Source/CPTTheme.h index 705ef54ec..83cda6ef7 100644 --- a/framework/Source/CPTTheme.h +++ b/framework/Source/CPTTheme.h @@ -1,10 +1,17 @@ +#import "CPTDefinitions.h" + +/** + * @brief Theme name type. + **/ +typedef NSString *CPTThemeName cpt_swift_struct; + /// @ingroup themeNames /// @{ -extern NSString *__nonnull const kCPTDarkGradientTheme; ///< A graph theme with dark gray gradient backgrounds and light gray lines. -extern NSString *__nonnull const kCPTPlainBlackTheme; ///< A graph theme with black backgrounds and white lines. -extern NSString *__nonnull const kCPTPlainWhiteTheme; ///< A graph theme with white backgrounds and black lines. -extern NSString *__nonnull const kCPTSlateTheme; ///< A graph theme with colors that match the default iPhone navigation bar, toolbar buttons, and table views. -extern NSString *__nonnull const kCPTStocksTheme; ///< A graph theme with a gradient background and white lines. +extern CPTThemeName __nonnull const kCPTDarkGradientTheme; ///< A graph theme with dark gray gradient backgrounds and light gray lines. +extern CPTThemeName __nonnull const kCPTPlainBlackTheme; ///< A graph theme with black backgrounds and white lines. +extern CPTThemeName __nonnull const kCPTPlainWhiteTheme; ///< A graph theme with white backgrounds and black lines. +extern CPTThemeName __nonnull const kCPTSlateTheme; ///< A graph theme with colors that match the default iPhone navigation bar, toolbar buttons, and table views. +extern CPTThemeName __nonnull const kCPTStocksTheme; ///< A graph theme with a gradient background and white lines. /// @} @class CPTGraph; @@ -20,8 +27,8 @@ extern NSString *__nonnull const kCPTStocksTheme; ///< A graph theme with /// @{ +(void)registerTheme:(nonnull Class)themeClass; +(nullable NSArray *)themeClasses; -+(nullable instancetype)themeNamed:(nullable NSString *)themeName; -+(nonnull NSString *)name; ++(nullable instancetype)themeNamed:(nullable CPTThemeName)themeName; ++(nonnull CPTThemeName)name; /// @} /// @name Theme Usage diff --git a/framework/Source/CPTTheme.m b/framework/Source/CPTTheme.m index 350ffa90b..ae9c34ce2 100644 --- a/framework/Source/CPTTheme.m +++ b/framework/Source/CPTTheme.m @@ -110,7 +110,7 @@ +(BOOL)supportsSecureCoding * @return A CPTTheme instance with name matching @par{themeName} or @nil if no themes with a matching name were found. * @see See @ref themeNames "Theme Names" for a list of named themes provided by Core Plot. **/ -+(nullable instancetype)themeNamed:(nullable NSString *)themeName ++(nullable instancetype)themeNamed:(nullable CPTThemeName)themeName { CPTTheme *newTheme = nil; @@ -149,7 +149,7 @@ +(void)registerTheme:(nonnull Class)themeClass /** @brief The name used for this theme class. * @return The name. **/ -+(nonnull NSString *)name ++(nonnull CPTThemeName)name { return NSStringFromClass(self); } diff --git a/framework/Source/CPTTradingRangePlot.h b/framework/Source/CPTTradingRangePlot.h index 513d8ccaf..77c319b9b 100644 --- a/framework/Source/CPTTradingRangePlot.h +++ b/framework/Source/CPTTradingRangePlot.h @@ -7,18 +7,23 @@ @class CPTTradingRangePlot; +/** + * @brief Trading range plot bindings. + **/ +typedef NSString *CPTTradingRangePlotBinding cpt_swift_struct; + /// @ingroup plotBindingsTradingRangePlot /// @{ -extern NSString *__nonnull const CPTTradingRangePlotBindingXValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingOpenValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingHighValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingLowValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingCloseValues; -extern NSString *__nonnull const CPTTradingRangePlotBindingIncreaseFills; -extern NSString *__nonnull const CPTTradingRangePlotBindingDecreaseFills; -extern NSString *__nonnull const CPTTradingRangePlotBindingLineStyles; -extern NSString *__nonnull const CPTTradingRangePlotBindingIncreaseLineStyles; -extern NSString *__nonnull const CPTTradingRangePlotBindingDecreaseLineStyles; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingXValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingOpenValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingHighValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingLowValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingCloseValues; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingIncreaseFills; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingDecreaseFills; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingLineStyles; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingIncreaseLineStyles; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingDecreaseLineStyles; /// @} /** diff --git a/framework/Source/CPTTradingRangePlot.m b/framework/Source/CPTTradingRangePlot.m index 0326f1d57..6ec8ce1d3 100644 --- a/framework/Source/CPTTradingRangePlot.m +++ b/framework/Source/CPTTradingRangePlot.m @@ -26,16 +26,16 @@ * @endif **/ -NSString *const CPTTradingRangePlotBindingXValues = @"xValues"; ///< X values. -NSString *const CPTTradingRangePlotBindingOpenValues = @"openValues"; ///< Open price values. -NSString *const CPTTradingRangePlotBindingHighValues = @"highValues"; ///< High price values. -NSString *const CPTTradingRangePlotBindingLowValues = @"lowValues"; ///< Low price values. -NSString *const CPTTradingRangePlotBindingCloseValues = @"closeValues"; ///< Close price values. -NSString *const CPTTradingRangePlotBindingIncreaseFills = @"increaseFills"; ///< Fills used with a candlestick plot when close >= open. -NSString *const CPTTradingRangePlotBindingDecreaseFills = @"decreaseFills"; ///< Fills used with a candlestick plot when close < open. -NSString *const CPTTradingRangePlotBindingLineStyles = @"lineStyles"; ///< Line styles used to draw candlestick or OHLC symbols. -NSString *const CPTTradingRangePlotBindingIncreaseLineStyles = @"increaseLineStyles"; ///< Line styles used to outline candlestick symbols when close >= open. -NSString *const CPTTradingRangePlotBindingDecreaseLineStyles = @"decreaseLineStyles"; ///< Line styles used to outline candlestick symbols when close < open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingXValues = @"xValues"; ///< X values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingOpenValues = @"openValues"; ///< Open price values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingHighValues = @"highValues"; ///< High price values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingLowValues = @"lowValues"; ///< Low price values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingCloseValues = @"closeValues"; ///< Close price values. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingIncreaseFills = @"increaseFills"; ///< Fills used with a candlestick plot when close >= open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingDecreaseFills = @"decreaseFills"; ///< Fills used with a candlestick plot when close < open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingLineStyles = @"lineStyles"; ///< Line styles used to draw candlestick or OHLC symbols. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingIncreaseLineStyles = @"increaseLineStyles"; ///< Line styles used to outline candlestick symbols when close >= open. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingDecreaseLineStyles = @"decreaseLineStyles"; ///< Line styles used to outline candlestick symbols when close < open. static const CPTCoordinate independentCoord = CPTCoordinateX; static const CPTCoordinate dependentCoord = CPTCoordinateY; diff --git a/framework/Source/_CPTDarkGradientTheme.m b/framework/Source/_CPTDarkGradientTheme.m index 34c2f40c6..1f2801e84 100644 --- a/framework/Source/_CPTDarkGradientTheme.m +++ b/framework/Source/_CPTDarkGradientTheme.m @@ -12,7 +12,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTDarkGradientTheme = @"Dark Gradients"; +CPTThemeName const kCPTDarkGradientTheme = @"Dark Gradients"; /// @cond @interface _CPTDarkGradientTheme() diff --git a/framework/Source/_CPTPlainBlackTheme.m b/framework/Source/_CPTPlainBlackTheme.m index ad52aa0b8..0bff8bb06 100644 --- a/framework/Source/_CPTPlainBlackTheme.m +++ b/framework/Source/_CPTPlainBlackTheme.m @@ -11,7 +11,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTPlainBlackTheme = @"Plain Black"; +CPTThemeName const kCPTPlainBlackTheme = @"Plain Black"; /** * @brief Creates a CPTXYGraph instance formatted with black backgrounds and white lines. diff --git a/framework/Source/_CPTPlainWhiteTheme.m b/framework/Source/_CPTPlainWhiteTheme.m index 485475e47..aa2f1fd10 100644 --- a/framework/Source/_CPTPlainWhiteTheme.m +++ b/framework/Source/_CPTPlainWhiteTheme.m @@ -11,7 +11,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTPlainWhiteTheme = @"Plain White"; +CPTThemeName const kCPTPlainWhiteTheme = @"Plain White"; /** * @brief Creates a CPTXYGraph instance formatted with white backgrounds and black lines. diff --git a/framework/Source/_CPTSlateTheme.m b/framework/Source/_CPTSlateTheme.m index 35cff032b..92f34f922 100644 --- a/framework/Source/_CPTSlateTheme.m +++ b/framework/Source/_CPTSlateTheme.m @@ -12,7 +12,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTSlateTheme = @"Slate"; +CPTThemeName const kCPTSlateTheme = @"Slate"; /// @cond @interface _CPTSlateTheme() diff --git a/framework/Source/_CPTStocksTheme.m b/framework/Source/_CPTStocksTheme.m index 83d2dc92d..b807cfe38 100644 --- a/framework/Source/_CPTStocksTheme.m +++ b/framework/Source/_CPTStocksTheme.m @@ -12,7 +12,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTStocksTheme = @"Stocks"; +CPTThemeName const kCPTStocksTheme = @"Stocks"; /** * @brief Creates a CPTXYGraph instance formatted with a gradient background and white lines. From 3b3800b13286740729844359a26de67050d24140 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 26 Aug 2016 15:27:33 -0400 Subject: [PATCH 029/212] Added additional margin space in CPTTextLayer to fix truncated text with some fonts. Fixed issue #280. --- framework/Source/CPTTextLayer.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/framework/Source/CPTTextLayer.m b/framework/Source/CPTTextLayer.m index f220ce7d9..c767c130a 100644 --- a/framework/Source/CPTTextLayer.m +++ b/framework/Source/CPTTextLayer.m @@ -328,10 +328,12 @@ -(CGSize)sizeThatFits } // Add small margin - textSize.width += kCPTTextLayerMarginWidth * CPTFloat(2.0); + CGFloat margin = kCPTTextLayerMarginWidth * CPTFloat(2.0) * self.contentsScale; + + textSize.width += margin; textSize.width = ceil(textSize.width); - textSize.height += kCPTTextLayerMarginWidth * CPTFloat(2.0); + textSize.height += margin; textSize.height = ceil(textSize.height); } From 1d887ac08073bba1218eb439c3078e78de36c67f Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Mon, 5 Sep 2016 16:21:15 -0400 Subject: [PATCH 030/212] Reverted the last change. --- framework/Source/CPTTextLayer.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/framework/Source/CPTTextLayer.m b/framework/Source/CPTTextLayer.m index c767c130a..f220ce7d9 100644 --- a/framework/Source/CPTTextLayer.m +++ b/framework/Source/CPTTextLayer.m @@ -328,12 +328,10 @@ -(CGSize)sizeThatFits } // Add small margin - CGFloat margin = kCPTTextLayerMarginWidth * CPTFloat(2.0) * self.contentsScale; - - textSize.width += margin; + textSize.width += kCPTTextLayerMarginWidth * CPTFloat(2.0); textSize.width = ceil(textSize.width); - textSize.height += margin; + textSize.height += kCPTTextLayerMarginWidth * CPTFloat(2.0); textSize.height = ceil(textSize.height); } From 2b3ab7a14a083e1a98dc476973d7cc7f8eb4a783 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Wed, 7 Sep 2016 20:04:51 -0400 Subject: [PATCH 031/212] Defined a constant value to standardize string drawing options. --- framework/MacOnly/CPTPlatformSpecificCategories.m | 2 +- framework/MacOnly/CPTTextStylePlatformSpecific.m | 2 +- framework/Source/CPTDefinitions.h | 2 ++ framework/Source/CPTDefinitions.m | 4 ++++ framework/iPhoneOnly/CPTPlatformSpecificCategories.m | 2 +- framework/iPhoneOnly/CPTTextStylePlatformSpecific.m | 6 +++--- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.m b/framework/MacOnly/CPTPlatformSpecificCategories.m index b87e1ab6d..7da93b251 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.m +++ b/framework/MacOnly/CPTPlatformSpecificCategories.m @@ -95,7 +95,7 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context CPTPushCGContext(context); [self drawWithRect:NSRectFromCGRect(rect) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine]; + options:CPTStringDrawingOptions]; CPTPopCGContext(); } diff --git a/framework/MacOnly/CPTTextStylePlatformSpecific.m b/framework/MacOnly/CPTTextStylePlatformSpecific.m index b733fc305..bcb5685c7 100644 --- a/framework/MacOnly/CPTTextStylePlatformSpecific.m +++ b/framework/MacOnly/CPTTextStylePlatformSpecific.m @@ -261,7 +261,7 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo NSParagraphStyleAttributeName: paragraphStyle }; [self drawWithRect:NSRectFromCGRect(rect) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:attributes]; } CPTPopCGContext(); diff --git a/framework/Source/CPTDefinitions.h b/framework/Source/CPTDefinitions.h index 7ca25c47b..38da64fcf 100644 --- a/framework/Source/CPTDefinitions.h +++ b/framework/Source/CPTDefinitions.h @@ -214,6 +214,8 @@ CPTEdgeInsets; extern const CPTEdgeInsets CPTEdgeInsetsZero; ///< Defines a set of stretchable image edge insets where all of the values are zero (@num{0}). +extern const NSStringDrawingOptions CPTStringDrawingOptions; ///< String drawing options used when measuring and drawing text. + /** * @brief An array of numbers. **/ diff --git a/framework/Source/CPTDefinitions.m b/framework/Source/CPTDefinitions.m index 7b54f79ab..5af8aaada 100644 --- a/framework/Source/CPTDefinitions.m +++ b/framework/Source/CPTDefinitions.m @@ -1,3 +1,7 @@ #import "CPTDefinitions.h" const CPTEdgeInsets CPTEdgeInsetsZero = { CPTFloat(0.0), CPTFloat(0.0), CPTFloat(0.0), CPTFloat(0.0) }; + +const NSStringDrawingOptions CPTStringDrawingOptions = NSStringDrawingUsesLineFragmentOrigin | + NSStringDrawingUsesFontLeading | + NSStringDrawingTruncatesLastVisibleLine; diff --git a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m index c3b42aace..6af4e8cab 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m +++ b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m @@ -107,7 +107,7 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context CPTPushCGContext(context); [self drawWithRect:rect - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions context:nil]; CPTPopCGContext(); diff --git a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m index 4fdedfc01..b519d6987 100644 --- a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m +++ b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m @@ -173,7 +173,7 @@ -(CGSize)sizeWithTextStyle:(nullable CPTTextStyle *)style #if TARGET_OS_SIMULATOR || TARGET_OS_TV CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:style.attributes context:nil]; textSize = rect.size; @@ -232,7 +232,7 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo #if TARGET_OS_SIMULATOR || TARGET_OS_TV [self drawWithRect:rect - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:style.attributes context:nil]; #else @@ -240,7 +240,7 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inCo // -drawWithRect:options:attributes:context: method is available in iOS 7.0 and later if ( [self respondsToSelector:@selector(drawWithRect:options:attributes:context:)] ) { [self drawWithRect:rect - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:style.attributes context:nil]; } From e5607eb4ae2c17f198d6f6fabb38ec940858e51b Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Wed, 7 Sep 2016 20:33:32 -0400 Subject: [PATCH 032/212] Use the -boundingRectWithSize:options:attributes:context: method for all string measurement. Fixed issue #280. --- .../MacOnly/CPTPlatformSpecificCategories.h | 5 +++ .../MacOnly/CPTPlatformSpecificCategories.m | 25 +++++++++++++++ .../MacOnly/CPTTextStylePlatformSpecific.m | 24 ++++---------- framework/Source/CPTLegendEntry.m | 8 ++--- framework/Source/CPTTextLayer.m | 8 ++--- .../CPTPlatformSpecificCategories.h | 5 +++ .../CPTPlatformSpecificCategories.m | 17 ++++++++++ .../iPhoneOnly/CPTTextStylePlatformSpecific.h | 15 --------- .../iPhoneOnly/CPTTextStylePlatformSpecific.m | 32 ++----------------- 9 files changed, 66 insertions(+), 73 deletions(-) diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.h b/framework/MacOnly/CPTPlatformSpecificCategories.h index 96732d478..f47f00e94 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.h +++ b/framework/MacOnly/CPTPlatformSpecificCategories.h @@ -39,4 +39,9 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context; /// @} +/// @name Measurement +/// @{ +-(CGSize)sizeAsDrawn; +/// @} + @end diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.m b/framework/MacOnly/CPTPlatformSpecificCategories.m index 7da93b251..3261e9cff 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.m +++ b/framework/MacOnly/CPTPlatformSpecificCategories.m @@ -100,4 +100,29 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context CPTPopCGContext(); } +/** + * @brief Computes the size of the styled text when drawn rounded up to the nearest whole number in each dimension. + **/ +-(CGSize)sizeAsDrawn +{ + CGRect rect = CGRectZero; + + if ( [self respondsToSelector:@selector(boundingRectWithSize:options:context:)] ) { + rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + context:nil]; + } + else { + rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions]; + } + + CGSize textSize = rect.size; + + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); + + return textSize; +} + @end diff --git a/framework/MacOnly/CPTTextStylePlatformSpecific.m b/framework/MacOnly/CPTTextStylePlatformSpecific.m index bcb5685c7..533bf4888 100644 --- a/framework/MacOnly/CPTTextStylePlatformSpecific.m +++ b/framework/MacOnly/CPTTextStylePlatformSpecific.m @@ -198,25 +198,15 @@ @implementation NSString(CPTTextStyleExtensions) **/ -(CGSize)sizeWithTextStyle:(nullable CPTTextStyle *)style { - NSFont *theFont = nil; - NSString *fontName = style.fontName; - - if ( fontName ) { - theFont = [NSFont fontWithName:fontName size:style.fontSize]; - } + CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + attributes:style.attributes + context:nil]; - CGSize textSize; + CGSize textSize = rect.size; - if ( theFont ) { - CPTDictionary *attributes = @{ - NSFontAttributeName: theFont - }; - - textSize = NSSizeToCGSize([self sizeWithAttributes:attributes]); - } - else { - textSize = CGSizeZero; - } + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); return textSize; } diff --git a/framework/Source/CPTLegendEntry.m b/framework/Source/CPTLegendEntry.m index 5d5d40a15..475f7f9fb 100644 --- a/framework/Source/CPTLegendEntry.m +++ b/framework/Source/CPTLegendEntry.m @@ -219,12 +219,8 @@ -(CGSize)titleSize NSAttributedString *styledTitle = self.attributedTitle; - if ( (styledTitle.length > 0) && [styledTitle respondsToSelector:@selector(size)] ) { -#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE - theTitleSize = styledTitle.size; -#else - theTitleSize = NSSizeToCGSize(styledTitle.size); -#endif + if ( styledTitle.length > 0 ) { + theTitleSize = [styledTitle sizeAsDrawn]; } else { NSString *theTitle = styledTitle.string; diff --git a/framework/Source/CPTTextLayer.m b/framework/Source/CPTTextLayer.m index f220ce7d9..97a475e77 100644 --- a/framework/Source/CPTTextLayer.m +++ b/framework/Source/CPTTextLayer.m @@ -316,12 +316,8 @@ -(CGSize)sizeThatFits if ( myText.length > 0 ) { NSAttributedString *styledText = self.attributedText; - if ( (styledText.length > 0) && [styledText respondsToSelector:@selector(size)] ) { -#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE - textSize = styledText.size; -#else - textSize = NSSizeToCGSize(styledText.size); -#endif + if ( styledText.length > 0 ) { + textSize = [styledText sizeAsDrawn]; } else { textSize = [myText sizeWithTextStyle:self.textStyle]; diff --git a/framework/iPhoneOnly/CPTPlatformSpecificCategories.h b/framework/iPhoneOnly/CPTPlatformSpecificCategories.h index 06cd3ec67..9132da000 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificCategories.h +++ b/framework/iPhoneOnly/CPTPlatformSpecificCategories.h @@ -53,4 +53,9 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context; /// @} +/// @name Measurement +/// @{ +-(CGSize)sizeAsDrawn; +/// @} + @end diff --git a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m index 6af4e8cab..2fbe8775f 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m +++ b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m @@ -114,4 +114,21 @@ -(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context } } +/** + * @brief Computes the size of the styled text when drawn rounded up to the nearest whole number in each dimension. + **/ +-(CGSize)sizeAsDrawn +{ + CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + context:nil]; + + CGSize textSize = rect.size; + + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); + + return textSize; +} + @end diff --git a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h index b6f4e498f..b1e699720 100644 --- a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h +++ b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h @@ -10,18 +10,3 @@ typedef NS_ENUM (NSInteger, CPTTextAlignment) { CPTTextAlignmentJustified = NSTextAlignmentJustified, ///< Justified alignment. CPTTextAlignmentNatural = NSTextAlignmentNatural ///< Natural alignment of the text's script. }; - -// @cond -// for iOS SDK compatibility -#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE -#if __IPHONE_OS_VERSION_MAX_ALLOWED<70000 -@interface NSString(CPTTextStylePlatformSpecificExtensions) - --(CGSize)sizeWithAttributes:(nonnull CPTDictionary *)attrs; - -@end -#else -#endif -#endif - -/// @endcond diff --git a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m index b519d6987..8ecca165a 100644 --- a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m +++ b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m @@ -169,41 +169,15 @@ @implementation NSString(CPTTextStyleExtensions) **/ -(CGSize)sizeWithTextStyle:(nullable CPTTextStyle *)style { - CGSize textSize; - -#if TARGET_OS_SIMULATOR || TARGET_OS_TV CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) options:CPTStringDrawingOptions attributes:style.attributes context:nil]; - textSize = rect.size; - textSize.width = ceil(textSize.width); - textSize.height = ceil(textSize.height); -#else - // -boundingRectWithSize:options:attributes:context: is available in iOS 7.0 and later - if ( [self respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)] ) { - CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine - attributes:style.attributes - context:nil]; - textSize = rect.size; - textSize.width = ceil(textSize.width); - textSize.height = ceil(textSize.height); - } - else { - UIFont *theFont = nil; - NSString *fontName = style.fontName; - if ( fontName ) { - theFont = [UIFont fontWithName:fontName size:style.fontSize]; - } + CGSize textSize = rect.size; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - textSize = [self sizeWithFont:theFont constrainedToSize:CPTSizeMake(10000.0, 10000.0)]; -#pragma clang diagnostic pop - } -#endif + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); return textSize; } From 76465918093cfbcbf5e6b6594be37bce8b9cdec1 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 9 Sep 2016 13:50:12 -0400 Subject: [PATCH 033/212] Updated the DatePlot example app with a Swift 3 naming change. --- examples/DatePlot/Source/DateController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/DatePlot/Source/DateController.swift b/examples/DatePlot/Source/DateController.swift index 406ef3aa0..450d8ab48 100644 --- a/examples/DatePlot/Source/DateController.swift +++ b/examples/DatePlot/Source/DateController.swift @@ -24,7 +24,7 @@ class DateController : NSObject, CPTPlotDataSource { // Create graph let newGraph = CPTXYGraph(frame: .zero) - let theme = CPTTheme(named: kCPTDarkGradientTheme) + let theme = CPTTheme(named: .darkGradientTheme) newGraph.apply(theme) if let host = self.hostView { From 742eb1bcf731c1943661e9e22a65aae8b1dd1bc1 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Fri, 9 Sep 2016 13:50:57 -0400 Subject: [PATCH 034/212] Fixed a compiler warning for 32-bit builds. Fixed issue #301. --- framework/iPhoneOnly/CPTPlatformSpecificCategories.m | 1 + 1 file changed, 1 insertion(+) diff --git a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m index 2fbe8775f..4d22e17da 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m +++ b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m @@ -1,6 +1,7 @@ #import "CPTPlatformSpecificCategories.h" #import "CPTPlatformSpecificFunctions.h" +#import "tgmath.h" #pragma mark CPTColor From 15ee42289d4393052f58993b1b6c8fa1c0e76b93 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 17 Sep 2016 14:17:16 -0400 Subject: [PATCH 035/212] Updated the version number in the podspec. --- CorePlot-latest.podspec | 2 +- CorePlot.podspec | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CorePlot-latest.podspec b/CorePlot-latest.podspec index 6f7f9dfd7..bf65bf04f 100644 --- a/CorePlot-latest.podspec +++ b/CorePlot-latest.podspec @@ -18,7 +18,7 @@ Pod::Spec.new do |s| 'of data, and is tightly integrated with Apple technologies like Core Animation, ' \ 'Core Data, and Cocoa Bindings.' - s.ios.deployment_target = '6.0' + s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.8' s.tvos.deployment_target = '9.0' diff --git a/CorePlot.podspec b/CorePlot.podspec index 084705347..e23d3b6c8 100644 --- a/CorePlot.podspec +++ b/CorePlot.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'CorePlot' - s.version = '2.1' + s.version = '2.2' s.license = 'BSD' s.summary = 'Cocoa plotting framework for Mac OS X, iOS, and tvOS.' s.homepage = 'https://github.com/core-plot' @@ -18,7 +18,7 @@ Pod::Spec.new do |s| 'of data, and is tightly integrated with Apple technologies like Core Animation, ' \ 'Core Data, and Cocoa Bindings.' - s.ios.deployment_target = '6.0' + s.ios.deployment_target = '8.0' s.osx.deployment_target = '10.8' s.tvos.deployment_target = '9.0' From ba749bd490428b3a03e01f3155c3485619e74429 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 17 Sep 2016 14:17:42 -0400 Subject: [PATCH 036/212] Updated the project version. --- framework/CorePlot.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/CorePlot.xcodeproj/project.pbxproj b/framework/CorePlot.xcodeproj/project.pbxproj index 6f0cbf21a..eb9065875 100644 --- a/framework/CorePlot.xcodeproj/project.pbxproj +++ b/framework/CorePlot.xcodeproj/project.pbxproj @@ -3292,7 +3292,7 @@ CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CURRENT_PROJECT_VERSION = 2.1; + CURRENT_PROJECT_VERSION = 2.2; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; GCC_NO_COMMON_BLOCKS = YES; @@ -3319,7 +3319,7 @@ CLANG_WARN_INT_CONVERSION = YES; CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - CURRENT_PROJECT_VERSION = 2.1; + CURRENT_PROJECT_VERSION = 2.2; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; GCC_WARN_64_TO_32_BIT_CONVERSION = YES; From 3ec9c7e8dd8adbc340c5e48652838a53cbfb2432 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 17 Sep 2016 14:18:15 -0400 Subject: [PATCH 037/212] Updated the release instructions to require Xcode 8. --- scripts/README Creating a release package.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/README Creating a release package.md b/scripts/README Creating a release package.md index 3bd752bed..36ce39a83 100644 --- a/scripts/README Creating a release package.md +++ b/scripts/README Creating a release package.md @@ -5,7 +5,7 @@ Follow these steps to create a Core Plot release and post it to GitHub: 1. Ensure the following tools are installed on your development machine:
    -
  • Xcode 7
  • +
  • Xcode 8
  • [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc), version 1.8.11 or later, installed in /Applications
  • [Graphviz](http://www.graphviz.org/Download_macos.php), version 2.36.0 or later
From 485c56240df03ef5f0bbf79bf4cb3489a651ad0c Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 17 Sep 2016 14:18:32 -0400 Subject: [PATCH 038/212] Added release 2.2 information to the change log. --- documentation/changelog.markdown | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/documentation/changelog.markdown b/documentation/changelog.markdown index 4f8f4a975..b1bdad0c4 100644 --- a/documentation/changelog.markdown +++ b/documentation/changelog.markdown @@ -1,8 +1,10 @@ -# Release 2.2 (TBD) +# Release 2.2 (September 17, 2016) ## Release Notes -To be determined. +This release updates Core Plot to be compatible with Xcode 8 and Swift 3. + +The Mac deployment target remains OS X 10.8. The iOS deployment target has changed to iOS 8.0 for both the framework and the static library. The tvOS deployment target remains tvOS 9.0. ## Details - **New**: Increased the iOS deployment target to iOS 8. From df75798589a8cee5d556e35c497f56d87a57c6a7 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 17 Sep 2016 14:45:35 -0400 Subject: [PATCH 039/212] Removed the AppleScript that refreshes the Xcode documentation window. That command is no longer supported in Xcode 8. --- framework/CorePlot.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/framework/CorePlot.xcodeproj/project.pbxproj b/framework/CorePlot.xcodeproj/project.pbxproj index eb9065875..3c2e33ed6 100644 --- a/framework/CorePlot.xcodeproj/project.pbxproj +++ b/framework/CorePlot.xcodeproj/project.pbxproj @@ -2588,7 +2588,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# Graphical class diagrams require Graphviz.\n# Graphviz.app is available free online\n# http://www.graphviz.org/Download_macos.php\n\n# If the config file doesn't exist, run 'doxygen -g \"${SOURCE_ROOT}/../documentation/doxygen/doxygen.config\"' to \n# a get default file.\n\nDOXYGEN_FOLDER=\"${SOURCE_ROOT}/../documentation/doxygen\"\n\nif ! [ -f \"${DOXYGEN_FOLDER}/doxygen.config\" ] \nthen \n echo doxygen config file does not exist\n ${DOXYGEN_PATH} -g \"${DOXYGEN_FOLDER}/doxygen.config\"\nfi\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n${DOXYGEN_PATH} \"${DOXYGEN_FOLDER}/doxygen.config\"\n\n# make a copy of the html docs\nDOCS_FOLDER=\"${SOURCE_ROOT}/../documentation/html/MacOS\"\nmkdir -p \"${DOCS_FOLDER}\"\ncp -R \"${SOURCE_ROOT}/CorePlotDocs.docset/html/\" \"${DOCS_FOLDER}\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\n# fix nodes.xml so the docset gets the correct index page\nsed -i 's|index.html|index.html' \"${SOURCE_ROOT}/CorePlotDocs.docset/html/nodes.xml\"\n\n# make will invoke docsetutil. Take a look at the Makefile to see how this is done.\nmake -C \"${SOURCE_ROOT}/CorePlotDocs.docset/html\" install\n\n# add publisher info to the docset\nDOCSET_FOLDER=\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/com.CorePlot.Framework.docset\"\n\nfind \"${DOCSET_FOLDER}/Contents/\" -type f -name Info.plist | xargs perl -pi -e 's/\\<\\/dict\\>/\\t\\DocSetPublisherIdentifier\\<\\/key\\>\\n\\t\\com.CorePlot.documentation\\<\\/string\\>\\n\\t\\DocSetPublisherName\\<\\/key\\>\\n\\t\\Core Plot\\<\\/string\\>\\n\\t\\NSHumanReadableCopyright\\<\\/key\\>\\n\\t\\Copyright © 2013 Core Plot. All rights reserved.\\<\\/string\\>\\n\\t\\isJavaScriptEnabled\\<\\/key\\>\\n\\t\\\\n\\<\\/dict\\>\\n/g'\n\n# add docset icon\ncp \"${DOXYGEN_FOLDER}/icon.png\" \"${DOCSET_FOLDER}\"\n\n# make a copy of the docset\nrm -Rf \"${SOURCE_ROOT}/CorePlotDocs.docset\"\ncp -R \"${DOCSET_FOLDER}\" \"${SOURCE_ROOT}\"\n\n# Construct a temporary applescript file to tell Xcode to load a docset.\nrm -f \"${TEMP_DIR}/loadDocSet.scpt\"\n\necho \"tell application \\\"Xcode\\\"\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\necho \"load documentation set with path \\\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/\\\"\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\necho \"end tell\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\n\n# Run the load-docset applescript command.\nosascript \"${TEMP_DIR}/loadDocSet.scpt\"\n\nexit 0"; + shellScript = "# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# Graphical class diagrams require Graphviz.\n# Graphviz.app is available free online\n# http://www.graphviz.org/Download_macos.php\n\n# If the config file doesn't exist, run 'doxygen -g \"${SOURCE_ROOT}/../documentation/doxygen/doxygen.config\"' to \n# a get default file.\n\nDOXYGEN_FOLDER=\"${SOURCE_ROOT}/../documentation/doxygen\"\n\nif ! [ -f \"${DOXYGEN_FOLDER}/doxygen.config\" ] \nthen \n echo doxygen config file does not exist\n ${DOXYGEN_PATH} -g \"${DOXYGEN_FOLDER}/doxygen.config\"\nfi\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n${DOXYGEN_PATH} \"${DOXYGEN_FOLDER}/doxygen.config\"\n\n# make a copy of the html docs\nDOCS_FOLDER=\"${SOURCE_ROOT}/../documentation/html/MacOS\"\nmkdir -p \"${DOCS_FOLDER}\"\ncp -R \"${SOURCE_ROOT}/CorePlotDocs.docset/html/\" \"${DOCS_FOLDER}\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\n# fix nodes.xml so the docset gets the correct index page\nsed -i 's|index.html|index.html' \"${SOURCE_ROOT}/CorePlotDocs.docset/html/nodes.xml\"\n\n# make will invoke docsetutil. Take a look at the Makefile to see how this is done.\nmake -C \"${SOURCE_ROOT}/CorePlotDocs.docset/html\" install\n\n# add publisher info to the docset\nDOCSET_FOLDER=\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/com.CorePlot.Framework.docset\"\n\nfind \"${DOCSET_FOLDER}/Contents/\" -type f -name Info.plist | xargs perl -pi -e 's/\\<\\/dict\\>/\\t\\DocSetPublisherIdentifier\\<\\/key\\>\\n\\t\\com.CorePlot.documentation\\<\\/string\\>\\n\\t\\DocSetPublisherName\\<\\/key\\>\\n\\t\\Core Plot\\<\\/string\\>\\n\\t\\NSHumanReadableCopyright\\<\\/key\\>\\n\\t\\Copyright © 2013 Core Plot. All rights reserved.\\<\\/string\\>\\n\\t\\isJavaScriptEnabled\\<\\/key\\>\\n\\t\\\\n\\<\\/dict\\>\\n/g'\n\n# add docset icon\ncp \"${DOXYGEN_FOLDER}/icon.png\" \"${DOCSET_FOLDER}\"\n\n# make a copy of the docset\nrm -Rf \"${SOURCE_ROOT}/CorePlotDocs.docset\"\ncp -R \"${DOCSET_FOLDER}\" \"${SOURCE_ROOT}\"\n\nexit 0"; }; C37EA5C51BC83E900091C8F7 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2614,7 +2614,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# Graphical class diagrams require Graphviz.\n# Graphviz.app is available free online\n# http://www.graphviz.org/Download_macos.php\n\n# If the config file doesn't exist, run 'doxygen -g \"${SOURCE_ROOT}/../documentation/doxygen/doxygen touch.config\"' to\n# a get default file.\n\nDOXYGEN_FOLDER=\"${SOURCE_ROOT}/../documentation/doxygen\"\n\nif ! [ -f \"${DOXYGEN_FOLDER}/doxygen.config\" ]\nthen\necho doxygen config file does not exist\n${DOXYGEN_PATH} -g \"${DOXYGEN_FOLDER}/doxygen.config\"\nfi\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n${DOXYGEN_PATH} \"${SOURCE_ROOT}/../documentation/doxygen/doxygen touch.config\"\n\n# make a copy of the html docs\nDOCS_FOLDER=\"${SOURCE_ROOT}/../documentation/html/iOS\"\nmkdir -p \"${DOCS_FOLDER}\"\ncp -R \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html/\" \"${DOCS_FOLDER}\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\n# fix nodes.xml so the docset gets the correct index page\nsed -i 's|index.html|index.html' \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html/nodes.xml\"\n\n# make will invoke docsetutil. Take a look at the Makefile to see how this is done.\nmake -C \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html\" install\n\n# add publisher info to the docset\nDOCSET_FOLDER=\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/com.CorePlotTouch.Framework.docset\"\n\nfind \"${DOCSET_FOLDER}/Contents/\" -type f -name Info.plist | xargs perl -pi -e 's/\\<\\/dict\\>/\\t\\DocSetPublisherIdentifier\\<\\/key\\>\\n\\t\\com.CorePlot.documentation\\<\\/string\\>\\n\\t\\DocSetPublisherName\\<\\/key\\>\\n\\t\\Core Plot\\<\\/string\\>\\n\\t\\NSHumanReadableCopyright\\<\\/key\\>\\n\\t\\Copyright © 2013 Core Plot. All rights reserved.\\<\\/string\\>\\n\\t\\isJavaScriptEnabled\\<\\/key\\>\\n\\t\\\\n\\<\\/dict\\>\\n/g'\n\n# add docset icon\ncp \"${DOXYGEN_FOLDER}/icon.png\" \"${DOCSET_FOLDER}\"\n\n# make a copy of the docset\nrm -Rf \"${SOURCE_ROOT}/CorePlotTouchDocs.docset\"\ncp -R \"${DOCSET_FOLDER}\" \"${SOURCE_ROOT}\"\n\n# Construct a temporary applescript file to tell Xcode to load a docset.\nrm -f \"${TEMP_DIR}/loadDocSet.scpt\"\n\necho \"tell application \\\"Xcode\\\"\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\necho \"load documentation set with path \\\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/\\\"\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\necho \"end tell\" >> \"${TEMP_DIR}/loadDocSet.scpt\"\n\n# Run the load-docset applescript command.\nosascript \"${TEMP_DIR}/loadDocSet.scpt\"\n\nexit 0"; + shellScript = "# Build the doxygen documentation for the project and load the docset into Xcode.\n\n# Use the following to adjust the value of the $DOXYGEN_PATH User-Defined Setting:\n# Binary install location: /Applications/Doxygen.app/Contents/Resources/doxygen\n# Source build install location: /usr/local/bin/doxygen\n\n# Graphical class diagrams require Graphviz.\n# Graphviz.app is available free online\n# http://www.graphviz.org/Download_macos.php\n\n# If the config file doesn't exist, run 'doxygen -g \"${SOURCE_ROOT}/../documentation/doxygen/doxygen touch.config\"' to\n# a get default file.\n\nDOXYGEN_FOLDER=\"${SOURCE_ROOT}/../documentation/doxygen\"\n\nif ! [ -f \"${DOXYGEN_FOLDER}/doxygen.config\" ]\nthen\necho doxygen config file does not exist\n${DOXYGEN_PATH} -g \"${DOXYGEN_FOLDER}/doxygen.config\"\nfi\n\n# Run doxygen on the updated config file.\n# Note: doxygen creates a Makefile that does most of the heavy lifting.\n${DOXYGEN_PATH} \"${SOURCE_ROOT}/../documentation/doxygen/doxygen touch.config\"\n\n# make a copy of the html docs\nDOCS_FOLDER=\"${SOURCE_ROOT}/../documentation/html/iOS\"\nmkdir -p \"${DOCS_FOLDER}\"\ncp -R \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html/\" \"${DOCS_FOLDER}\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\n# fix nodes.xml so the docset gets the correct index page\nsed -i 's|index.html|index.html' \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html/nodes.xml\"\n\n# make will invoke docsetutil. Take a look at the Makefile to see how this is done.\nmake -C \"${SOURCE_ROOT}/CorePlotTouchDocs.docset/html\" install\n\n# add publisher info to the docset\nDOCSET_FOLDER=\"/Users/${USER}/Library/Developer/Shared/Documentation/DocSets/com.CorePlotTouch.Framework.docset\"\n\nfind \"${DOCSET_FOLDER}/Contents/\" -type f -name Info.plist | xargs perl -pi -e 's/\\<\\/dict\\>/\\t\\DocSetPublisherIdentifier\\<\\/key\\>\\n\\t\\com.CorePlot.documentation\\<\\/string\\>\\n\\t\\DocSetPublisherName\\<\\/key\\>\\n\\t\\Core Plot\\<\\/string\\>\\n\\t\\NSHumanReadableCopyright\\<\\/key\\>\\n\\t\\Copyright © 2013 Core Plot. All rights reserved.\\<\\/string\\>\\n\\t\\isJavaScriptEnabled\\<\\/key\\>\\n\\t\\\\n\\<\\/dict\\>\\n/g'\n\n# add docset icon\ncp \"${DOXYGEN_FOLDER}/icon.png\" \"${DOCSET_FOLDER}\"\n\n# make a copy of the docset\nrm -Rf \"${SOURCE_ROOT}/CorePlotTouchDocs.docset\"\ncp -R \"${DOCSET_FOLDER}\" \"${SOURCE_ROOT}\"\n\nexit 0"; }; C38A09971A46193F00D45436 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; From bc913b2b69095b427ce1d1d7f1bccf3aee8acbc4 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 17 Sep 2016 14:55:29 -0400 Subject: [PATCH 040/212] Updated documentation configuration for Doxygen 1.8.12. --- documentation/doxygen/doxygen touch.config | 15 ++++++++++++--- documentation/doxygen/doxygen.config | 15 ++++++++++++--- scripts/README Creating a release package.md | 2 +- 3 files changed, 25 insertions(+), 7 deletions(-) diff --git a/documentation/doxygen/doxygen touch.config b/documentation/doxygen/doxygen touch.config index d18a23b42..56012d005 100644 --- a/documentation/doxygen/doxygen touch.config +++ b/documentation/doxygen/doxygen touch.config @@ -1,4 +1,4 @@ -# Doxyfile 1.8.11 +# Doxyfile 1.8.12 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -312,6 +312,15 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = NO +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or @@ -814,8 +823,8 @@ INPUT_ENCODING = UTF-8 # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, -# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. FILE_PATTERNS = diff --git a/documentation/doxygen/doxygen.config b/documentation/doxygen/doxygen.config index 942b4ec35..50b8b844c 100644 --- a/documentation/doxygen/doxygen.config +++ b/documentation/doxygen/doxygen.config @@ -1,4 +1,4 @@ -# Doxyfile 1.8.11 +# Doxyfile 1.8.12 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -312,6 +312,15 @@ EXTENSION_MAPPING = MARKDOWN_SUPPORT = NO +# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up +# to that level are automatically included in the table of contents, even if +# they do not have an id attribute. +# Note: This feature currently applies only to Markdown headings. +# Minimum value: 0, maximum value: 99, default value: 0. +# This tag requires that the tag MARKDOWN_SUPPORT is set to YES. + +TOC_INCLUDE_HEADINGS = 0 + # When enabled doxygen tries to link words that correspond to documented # classes, or namespaces to their corresponding documentation. Such a link can # be prevented in individual cases by putting a % sign in front of the word or @@ -814,8 +823,8 @@ INPUT_ENCODING = UTF-8 # If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, # *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, # *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f, *.for, *.tcl, -# *.vhd, *.vhdl, *.ucf, *.qsf, *.as and *.js. +# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08, +# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf. FILE_PATTERNS = diff --git a/scripts/README Creating a release package.md b/scripts/README Creating a release package.md index 36ce39a83..933dfd8f2 100644 --- a/scripts/README Creating a release package.md +++ b/scripts/README Creating a release package.md @@ -6,7 +6,7 @@ Follow these steps to create a Core Plot release and post it to GitHub:
  • Xcode 8
  • -
  • [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc), version 1.8.11 or later, installed in /Applications
  • +
  • [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc), version 1.8.12 or later, installed in /Applications
  • [Graphviz](http://www.graphviz.org/Download_macos.php), version 2.36.0 or later
From d3d52d2248bc3eaab3283202acb160ec372b53d1 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 17 Sep 2016 15:25:49 -0400 Subject: [PATCH 041/212] Fixed missing plot data bugs in some of the Plot Gallery examples. --- examples/CorePlotGallery/src/plots/CandlestickPlot.m | 2 +- examples/CorePlotGallery/src/plots/ColoredBarChart.m | 2 +- examples/CorePlotGallery/src/plots/ControlChart.m | 2 +- examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m | 2 +- examples/CorePlotGallery/src/plots/CurvedScatterPlot.m | 2 +- examples/CorePlotGallery/src/plots/DatePlot.m | 2 +- examples/CorePlotGallery/src/plots/DonutChart.m | 2 +- examples/CorePlotGallery/src/plots/GradientScatterPlot.m | 2 +- examples/CorePlotGallery/src/plots/OHLCPlot.m | 2 +- examples/CorePlotGallery/src/plots/RangePlot.m | 2 +- examples/CorePlotGallery/src/plots/SimplePieChart.m | 2 +- examples/CorePlotGallery/src/plots/SimpleScatterPlot.m | 2 +- examples/CorePlotGallery/src/plots/SteppedScatterPlot.m | 2 +- 13 files changed, 13 insertions(+), 13 deletions(-) diff --git a/examples/CorePlotGallery/src/plots/CandlestickPlot.m b/examples/CorePlotGallery/src/plots/CandlestickPlot.m index ac1898980..d4aa96b91 100644 --- a/examples/CorePlotGallery/src/plots/CandlestickPlot.m +++ b/examples/CorePlotGallery/src/plots/CandlestickPlot.m @@ -39,7 +39,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( !self.plotData ) { + if ( self.plotData.count == 0 ) { NSMutableArray *newData = [NSMutableArray array]; for ( NSUInteger i = 0; i < 8; i++ ) { NSTimeInterval x = oneDay * i; diff --git a/examples/CorePlotGallery/src/plots/ColoredBarChart.m b/examples/CorePlotGallery/src/plots/ColoredBarChart.m index 1b7e4ea1d..b5e7ffa6d 100644 --- a/examples/CorePlotGallery/src/plots/ColoredBarChart.m +++ b/examples/CorePlotGallery/src/plots/ColoredBarChart.m @@ -27,7 +27,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { CPTMutableNumberArray *contentArray = [NSMutableArray array]; for ( NSUInteger i = 0; i < 8; i++ ) { [contentArray addObject:@(10.0 * arc4random() / (double)UINT32_MAX + 5.0)]; diff --git a/examples/CorePlotGallery/src/plots/ControlChart.m b/examples/CorePlotGallery/src/plots/ControlChart.m index 9b8ae15c9..836d26dec 100644 --- a/examples/CorePlotGallery/src/plots/ControlChart.m +++ b/examples/CorePlotGallery/src/plots/ControlChart.m @@ -38,7 +38,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { CPTMutableNumberArray *contentArray = [NSMutableArray array]; double sum = 0.0; diff --git a/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m b/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m index d68848b84..1a49cef92 100644 --- a/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m +++ b/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m @@ -47,7 +47,7 @@ -(instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSArray *const xValues = @[@0, @0.1, @0.2, @0.5, @0.6, @0.7, @1]; NSArray *const yValues = @[@(0.5), @0.5, @(-1), @1, @1, @0, @0.1]; diff --git a/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m b/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m index 9445c7589..94f4e4983 100644 --- a/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m @@ -59,7 +59,7 @@ -(void)killGraph -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *> *contentArray = [NSMutableArray array]; for ( NSUInteger i = 0; i < 11; i++ ) { diff --git a/examples/CorePlotGallery/src/plots/DatePlot.m b/examples/CorePlotGallery/src/plots/DatePlot.m index d11948f08..7179dadb6 100644 --- a/examples/CorePlotGallery/src/plots/DatePlot.m +++ b/examples/CorePlotGallery/src/plots/DatePlot.m @@ -44,7 +44,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( !self.plotData ) { + if ( self.plotData.count == 0 ) { // Add some data CPTMutablePlotDataArray *newData = [NSMutableArray array]; diff --git a/examples/CorePlotGallery/src/plots/DonutChart.m b/examples/CorePlotGallery/src/plots/DonutChart.m index e7ca3a7c4..d889b83ce 100644 --- a/examples/CorePlotGallery/src/plots/DonutChart.m +++ b/examples/CorePlotGallery/src/plots/DonutChart.m @@ -30,7 +30,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { self.plotData = @[@20.0, @30.0, @60.0]; } } diff --git a/examples/CorePlotGallery/src/plots/GradientScatterPlot.m b/examples/CorePlotGallery/src/plots/GradientScatterPlot.m index 056456fdc..ce63d545b 100644 --- a/examples/CorePlotGallery/src/plots/GradientScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/GradientScatterPlot.m @@ -49,7 +49,7 @@ -(void)killGraph -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *contentArray = [NSMutableArray arrayWithCapacity:100]; for ( NSUInteger i = 0; i < 10; i++ ) { NSNumber *x = @(1.0 + i * 0.05); diff --git a/examples/CorePlotGallery/src/plots/OHLCPlot.m b/examples/CorePlotGallery/src/plots/OHLCPlot.m index 86cfca07f..a2ce2ac9a 100644 --- a/examples/CorePlotGallery/src/plots/OHLCPlot.m +++ b/examples/CorePlotGallery/src/plots/OHLCPlot.m @@ -39,7 +39,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( !self.plotData ) { + if ( self.plotData.count == 0 ) { NSMutableArray *newData = [NSMutableArray array]; for ( NSUInteger i = 0; i < 8; i++ ) { NSTimeInterval x = oneDay * i; diff --git a/examples/CorePlotGallery/src/plots/RangePlot.m b/examples/CorePlotGallery/src/plots/RangePlot.m index 31bb76cdd..5fa05060e 100644 --- a/examples/CorePlotGallery/src/plots/RangePlot.m +++ b/examples/CorePlotGallery/src/plots/RangePlot.m @@ -43,7 +43,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *newData = [NSMutableArray array]; for ( NSUInteger i = 0; i < 5; i++ ) { NSTimeInterval x = oneDay * (i + 1.0); diff --git a/examples/CorePlotGallery/src/plots/SimplePieChart.m b/examples/CorePlotGallery/src/plots/SimplePieChart.m index 95b855094..375b4f8e5 100644 --- a/examples/CorePlotGallery/src/plots/SimplePieChart.m +++ b/examples/CorePlotGallery/src/plots/SimplePieChart.m @@ -38,7 +38,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { self.plotData = @[@20.0, @30.0, @60.0]; } } diff --git a/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m b/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m index 7e9bbed4f..78a7995ee 100644 --- a/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m @@ -53,7 +53,7 @@ -(void)killGraph -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *contentArray = [NSMutableArray array]; for ( NSUInteger i = 0; i < 10; i++ ) { NSNumber *x = @(1.0 + i * 0.05); diff --git a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m index cc48d7746..fe26395d3 100644 --- a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m @@ -32,7 +32,7 @@ -(nonnull instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { NSMutableArray *contentArray = [NSMutableArray array]; for ( NSUInteger i = 0; i < 10; i++ ) { NSNumber *x = @(1.0 + i * 0.05); From 4d5cee9a3cf170401bd36f622e69a143dde3af73 Mon Sep 17 00:00:00 2001 From: Eric Skroch Date: Sat, 17 Sep 2016 15:37:58 -0400 Subject: [PATCH 042/212] Added a check for the tvOS framework to the release instructions. --- scripts/README Creating a release package.md | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/README Creating a release package.md b/scripts/README Creating a release package.md index 933dfd8f2..1305b5d51 100644 --- a/scripts/README Creating a release package.md +++ b/scripts/README Creating a release package.md @@ -39,6 +39,7 @@ Follow these steps to create a Core Plot release and post it to GitHub: