diff --git a/documentation/Coding Style.markdown b/.github/CONTRIBUTING.md similarity index 100% rename from documentation/Coding Style.markdown rename to .github/CONTRIBUTING.md diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 000000000..4e7381cd7 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,6 @@ +Please consider the following issues before submitting a pull request: + +-[] Support all platforms (Mac, iOS, and tvOS) +-[] Pass Travis build validation +-[] Include unit tests where appropriate +-[] If adding a new feature, consider including a demo in the *Plot Gallery* example app \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 455a6ef7e..1df945ce3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,16 +1,25 @@ language: objective-c -osx_image: xcode7 +osx_image: xcode11 -env: +ios_env: SDK:iphonesimulator SDK:iphoneos +tvos_env: + TVSDK:appletvsimulator + TVSDK:appletvos + # Framework builds -script: xcodebuild -project framework/CorePlot.xcodeproj -target CorePlot -configuration Release -script: xcodebuild -project framework/CorePlot-CocoaTouch.xcodeproj -target CorePlot-CocoaTouch -sdk ${SDK} -configuration Release +script: xcodebuild -project framework/CorePlot.xcodeproj -target "CorePlot Mac" -configuration Release +script: xcodebuild -project framework/CorePlot.xcodeproj -target "CorePlot iOS" -sdk ${SDK} -configuration Release +script: xcodebuild -project framework/CorePlot.xcodeproj -target "CorePlot tvOS" -sdk ${TVSDK} -configuration Release +script: xcodebuild -project framework/CorePlot.xcodeproj -target "CorePlot-CocoaTouch" -sdk ${SDK} -configuration Release # Unit tests -script: xcodebuild -project framework/CorePlot.xcodeproj -target UnitTests -configuration Release +script: xcodebuild -project framework/CorePlot.xcodeproj -target "UnitTests Mac" -configuration Release +script: xcodebuild -project framework/CorePlot.xcodeproj -target "UnitTests iOS" -sdk ${SDK} -configuration Release +script: xcodebuild -project framework/CorePlot.xcodeproj -target "UnitTests tvOS" -sdk ${TVSDK} -configuration Release +script: xcodebuild -project framework/CorePlot.xcodeproj -target "CorePlot-CocoaTouchTests" -sdk ${SDK} -configuration Release # Mac examples script: xcodebuild -project examples/CorePlotGallery/Plot_Gallery.xcodeproj -target "Plot Gallery-Mac" -configuration Release @@ -28,5 +37,8 @@ script: xcodebuild -project examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodepr script: xcodebuild -project examples/CPTTestApp-iPhone-SpeedTest/CPTTestApp-iPhone.xcodeproj -CPTTestApp-iPhone AAPLot -sdk ${SDK} -configuration Release script: xcodebuild -project examples/StockPlot/StockPlot.xcodeproj -target StockPlot -sdk ${SDK} -configuration Release +# tvOS examples +script: xcodebuild -project examples/CorePlotGallery/Plot_Gallery.xcodeproj -target "Plot Gallery-tvOS" -sdk ${TVSDK} -configuration Release + # Quartz Composer plugin script: xcodebuild -project QCPlugin/CorePlotQCPlugin.xcodeproj -target CorePlotQCPlugin -configuration Release diff --git a/CorePlot-latest.podspec b/CorePlot-latest.podspec index 2fbbabe37..3b958f7e4 100644 --- a/CorePlot-latest.podspec +++ b/CorePlot-latest.podspec @@ -2,7 +2,7 @@ Pod::Spec.new do |s| s.name = 'CorePlot' s.version = '99.99.99' s.license = 'BSD' - s.summary = 'Cocoa plotting framework for Mac OS X and iOS.' + s.summary = 'Cocoa plotting framework for macOS, iOS, and tvOS.' s.homepage = 'https://github.com/core-plot' s.social_media_url = 'https://twitter.com/CorePlot' s.documentation_url = 'http://core-plot.github.io' @@ -14,27 +14,32 @@ Pod::Spec.new do |s| s.source = { :git => 'https://github.com/core-plot/core-plot.git' } - s.description = 'Core Plot is a plotting framework for OS X and iOS. It provides 2D visualization ' \ + s.description = 'Core Plot is a plotting framework for macOS, iOS, and tvOS. It provides 2D visualization ' \ 'of data, and is tightly integrated with Apple technologies like Core Animation, ' \ 'Core Data, and Cocoa Bindings.' - s.ios.deployment_target = '6.0' - s.osx.deployment_target = '10.7' + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.8' + s.tvos.deployment_target = '9.0' s.ios.header_dir = 'ios' s.osx.header_dir = 'osx' + s.tvos.header_dir = 'tvos' - s.source_files = 'framework/Source/*.{h,m}', 'framework/CocoaPods/*.h', 'framework/TestResources/CorePlotProbes.d' + s.source_files = 'framework/Source/*.{h,m}', 'framework/CocoaPods/*.h' s.exclude_files = '**/*{TestCase,Tests}.{h,m}', '**/mainpage.h' s.ios.source_files = 'framework/CorePlot-CocoaTouch.h', 'framework/iPhoneOnly/*.{h,m}' + s.tvos.source_files = 'framework/iPhoneOnly/*.{h,m}' s.osx.source_files = 'framework/MacOnly/*.{h,m}' - s.private_header_files = '**/_*.h', '**/CorePlotProbes.h' + s.private_header_files = '**/_*.h' - s.requires_arc = true - s.ios.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Public/CorePlot/ios"' } - s.osx.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Public/CorePlot/osx"' } + s.requires_arc = true + s.ios.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/ios"' } + s.osx.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/osx"' } + s.tvos.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/tvos"' } - s.frameworks = 'QuartzCore', 'Accelerate' + s.frameworks = 'QuartzCore' s.ios.frameworks = 'UIKit', 'Foundation' + s.tvos.frameworks = 'UIKit', 'Foundation' s.osx.frameworks = 'Cocoa' end \ No newline at end of file diff --git a/CorePlot.podspec b/CorePlot.podspec index e6a9ec56b..d6906a089 100644 --- a/CorePlot.podspec +++ b/CorePlot.podspec @@ -1,8 +1,8 @@ Pod::Spec.new do |s| s.name = 'CorePlot' - s.version = '2.0' + s.version = '2.3' s.license = 'BSD' - s.summary = 'Cocoa plotting framework for Mac OS X and iOS.' + s.summary = 'Cocoa plotting framework for macOS, iOS, and tvOS.' s.homepage = 'https://github.com/core-plot' s.social_media_url = 'https://twitter.com/CorePlot' s.documentation_url = 'http://core-plot.github.io' @@ -12,29 +12,34 @@ Pod::Spec.new do |s| 'Eric Skroch' => 'eskroch@mac.com', 'Barry Wark' => 'barrywark@gmail.com' } - s.source = { :git => 'https://github.com/core-plot/core-plot.git', :tag => 'release_2.0'} + s.source = { :git => 'https://github.com/core-plot/core-plot.git', :tag => 'release_2.3'} - s.description = 'Core Plot is a plotting framework for OS X and iOS. It provides 2D visualization ' \ + s.description = 'Core Plot is a plotting framework for macOS, iOS, and tvOS. It provides 2D visualization ' \ 'of data, and is tightly integrated with Apple technologies like Core Animation, ' \ 'Core Data, and Cocoa Bindings.' - s.ios.deployment_target = '6.0' - s.osx.deployment_target = '10.7' + s.ios.deployment_target = '8.0' + s.osx.deployment_target = '10.8' + s.tvos.deployment_target = '9.0' s.ios.header_dir = 'ios' s.osx.header_dir = 'osx' + s.tvos.header_dir = 'tvos' - s.source_files = 'framework/Source/*.{h,m}', 'framework/CocoaPods/*.h', 'framework/TestResources/CorePlotProbes.d' + s.source_files = 'framework/Source/*.{h,m}', 'framework/CocoaPods/*.h' s.exclude_files = '**/*{TestCase,Tests}.{h,m}', '**/mainpage.h' s.ios.source_files = 'framework/CorePlot-CocoaTouch.h', 'framework/iPhoneOnly/*.{h,m}' + s.tvos.source_files = 'framework/iPhoneOnly/*.{h,m}' s.osx.source_files = 'framework/MacOnly/*.{h,m}' - s.private_header_files = '**/_*.h', '**/CorePlotProbes.h' + s.private_header_files = '**/_*.h' - s.requires_arc = true - s.ios.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Public/CorePlot/ios"' } - s.osx.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Public/CorePlot/osx"' } + s.requires_arc = true + s.ios.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/ios"' } + s.osx.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/osx"' } + s.tvos.xcconfig = { 'HEADER_SEARCH_PATHS' => '"${PODS_ROOT}/Headers/Private/CorePlot/tvos"' } - s.frameworks = 'QuartzCore', 'Accelerate' + s.frameworks = 'QuartzCore' s.ios.frameworks = 'UIKit', 'Foundation' + s.tvos.frameworks = 'UIKit', 'Foundation' s.osx.frameworks = 'Cocoa' end \ No newline at end of file diff --git a/License.txt b/License.txt index 53ba4f2a8..fbd7853fe 100644 --- a/License.txt +++ b/License.txt @@ -1,9 +1,13 @@ -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) 2020, 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, Tim Monzures, Kirill Yakimovich, Tom Izaks, Pascal Freiburghaus, Fred Potter, and Aurélien Hugelé. + All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. + Neither the name of the Core Plot Project nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/QCPlugin/Info.plist b/QCPlugin/Base.lproj/Info.plist similarity index 100% rename from QCPlugin/Info.plist rename to QCPlugin/Base.lproj/Info.plist diff --git a/QCPlugin/English.lproj/Settings.xib b/QCPlugin/Base.lproj/Settings.xib similarity index 100% rename from QCPlugin/English.lproj/Settings.xib rename to QCPlugin/Base.lproj/Settings.xib diff --git a/QCPlugin/CPTBarPlotPlugin.h b/QCPlugin/CPTBarPlotPlugin.h index e8ecf371d..e5fbb2bce 100644 --- a/QCPlugin/CPTBarPlotPlugin.h +++ b/QCPlugin/CPTBarPlotPlugin.h @@ -1,4 +1,4 @@ -#import "CorePlotQCPlugIn.h" +#import "CorePlotQCPlugin.h" #import @interface CPTBarPlotPlugIn : CorePlotQCPlugIn diff --git a/QCPlugin/CPTBarPlotPlugin.m b/QCPlugin/CPTBarPlotPlugin.m index 6ae8ae6be..77d6fc9fc 100644 --- a/QCPlugin/CPTBarPlotPlugin.m +++ b/QCPlugin/CPTBarPlotPlugin.m @@ -1,4 +1,4 @@ -#import "CPTBarPlotPlugIn.h" +#import "CPTBarPlotPlugin.h" @implementation CPTBarPlotPlugIn @@ -27,72 +27,72 @@ @implementation CPTBarPlotPlugIn */ @dynamic inputBaseValue, inputBarOffset, inputBarWidth, inputHorizontalBars; -+(NSDictionary *)attributes ++(nonnull NSDictionary *)attributes { return @{ - QCPlugInAttributeNameKey: @"Core Plot Bar Chart", - QCPlugInAttributeDescriptionKey: @"Bar chart" + QCPlugInAttributeNameKey: @"Core Plot Bar Chart", + QCPlugInAttributeDescriptionKey: @"Bar chart" }; } -+(CPTDictionary)attributesForPropertyPortWithKey:(NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { // A few additional ports for the bar plot chart type ... if ( [key isEqualToString:@"inputBarWidth"] ) { return @{ - QCPortAttributeNameKey: @"Bar Width", - QCPortAttributeDefaultValueKey: @1.0, - QCPortAttributeMinimumValueKey: @0.0 + QCPortAttributeNameKey: @"Bar Width", + QCPortAttributeDefaultValueKey: @1.0, + QCPortAttributeMinimumValueKey: @0.0 }; } if ( [key isEqualToString:@"inputBarOffset"] ) { return @{ - QCPortAttributeNameKey: @"Bar Offset", - QCPortAttributeDefaultValueKey: @0.5 + QCPortAttributeNameKey: @"Bar Offset", + QCPortAttributeDefaultValueKey: @0.5 }; } if ( [key isEqualToString:@"inputBaseValue"] ) { return @{ - QCPortAttributeNameKey: @"Base Value", - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"Base Value", + QCPortAttributeDefaultValueKey: @0.0 }; } if ( [key isEqualToString:@"inputHorizontalBars"] ) { return @{ - QCPortAttributeNameKey: @"Horizontal Bars", - QCPortAttributeDefaultValueKey: @NO + QCPortAttributeNameKey: @"Horizontal Bars", + QCPortAttributeDefaultValueKey: @NO }; } if ( [key isEqualToString:@"inputXMin"] ) { return @{ - QCPortAttributeNameKey: @"X Range Min", - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"X Range Min", + QCPortAttributeDefaultValueKey: @0.0 }; } if ( [key isEqualToString:@"inputXMax"] ) { return @{ - QCPortAttributeNameKey: @"X Range Max", - QCPortAttributeDefaultValueKey: @5.0 + QCPortAttributeNameKey: @"X Range Max", + QCPortAttributeDefaultValueKey: @5.0 }; } if ( [key isEqualToString:@"inputYMin"] ) { return @{ - QCPortAttributeNameKey: @"Y Range Min", - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"Y Range Min", + QCPortAttributeDefaultValueKey: @0.0 }; } if ( [key isEqualToString:@"inputYMax"] ) { return @{ - QCPortAttributeNameKey: @"Y Range Max", - QCPortAttributeDefaultValueKey: @5.0 + QCPortAttributeNameKey: @"Y Range Max", + QCPortAttributeDefaultValueKey: @5.0 }; } @@ -114,7 +114,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotDataLineColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Plot Line Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(lineColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(lineColor) } ]; CGColorRef fillColor = [self newDefaultColorForPlot:index alpha:0.25]; @@ -122,7 +122,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Plot Fill Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(fillColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(fillColor) } ]; [self addInputPortWithType:QCPortTypeNumber @@ -153,7 +153,7 @@ -(void)removePlots:(NSUInteger)count [self removeInputPortForKey:[NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)(i - 1)]]; [self removeInputPortForKey:[NSString stringWithFormat:@"plotDataLineWidth%lu", (unsigned long)(i - 1)]]; - [theGraph removePlot:[[theGraph allPlots] lastObject]]; + [theGraph removePlot:[theGraph allPlots].lastObject]; } } @@ -162,7 +162,7 @@ -(BOOL)configurePlots CPTGraph *theGraph = self.graph; // The pixel width of a single plot unit (1..2) along the x axis of the plot - double count = (double)[[theGraph allPlots] count]; + double count = (double)[theGraph allPlots].count; double unitWidth = theGraph.plotAreaFrame.bounds.size.width / (self.inputXMax - self.inputXMin); double barWidth = self.inputBarWidth * unitWidth / count; @@ -177,7 +177,10 @@ -(BOOL)configurePlots plot.barWidth = @(barWidth); plot.barOffset = @(self.inputBarOffset); plot.barsAreHorizontal = self.inputHorizontalBars; - plot.fill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:(CGColorRef)[self areaFillColor : index]]]; + CGColorRef fillColor = [self areaFillColor:index]; + if ( fillColor ) { + plot.fill = [CPTFill fillWithColor:[CPTColor colorWithCGColor:fillColor]]; + } [plot reloadData]; } @@ -188,7 +191,7 @@ -(BOOL)configurePlots #pragma mark - #pragma mark Data source methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:plot]; NSString *key = [NSString stringWithFormat:@"plotNumbers%lu", (unsigned long)plotIndex]; @@ -196,28 +199,28 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot return [[self valueForInputKey:key] count]; } --(NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange +-(nullable NSArray *)numbersForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange __unused)indexRange { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:plot]; NSString *key = [NSString stringWithFormat:@"plotNumbers%lu", (unsigned long)plotIndex]; - CPTDictionary dict = [self valueForInputKey:key]; + CPTDictionary *dict = [self valueForInputKey:key]; if ( !dict ) { return nil; } - NSUInteger keyCount = [[dict allKeys] count]; - CPTMutableNumberArray array = [NSMutableArray array]; + NSUInteger keyCount = dict.allKeys.count; + CPTMutableNumberArray *array = [NSMutableArray array]; if ( fieldEnum == CPTBarPlotFieldBarLocation ) { // Calculate horizontal position of bar - nth bar index + barWidth*plotIndex + 0.5 float xpos; - float plotCount = [[self.graph allPlots] count]; + float plotCount = [self.graph allPlots].count; for ( NSUInteger i = 0; i < keyCount; i++ ) { xpos = (float)i + (float)plotIndex / (plotCount); - [array addObject:[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%f", xpos]]]; + [array addObject:[NSDecimalNumber decimalNumberWithString:[NSString stringWithFormat:@"%f", (double)xpos]]]; } } else { diff --git a/QCPlugin/CPTPieChartPlugin.h b/QCPlugin/CPTPieChartPlugin.h index fbe9781eb..844715ba9 100644 --- a/QCPlugin/CPTPieChartPlugin.h +++ b/QCPlugin/CPTPieChartPlugin.h @@ -1,4 +1,4 @@ -#import "CorePlotQCPlugIn.h" +#import "CorePlotQCPlugin.h" #import @interface CPTPieChartPlugIn : CorePlotQCPlugIn @@ -8,7 +8,7 @@ @property (readwrite, assign) double inputStartAngle; @property (readwrite, assign) NSUInteger inputSliceDirection; @property (readwrite, assign) double inputBorderWidth; -@property (readwrite, assign) CGColorRef inputBorderColor; -@property (readwrite, assign) CGColorRef inputLabelColor; +@property (readwrite, assign, nonnull) CGColorRef inputBorderColor; +@property (readwrite, assign, nonnull) CGColorRef inputLabelColor; @end diff --git a/QCPlugin/CPTPieChartPlugin.m b/QCPlugin/CPTPieChartPlugin.m index c38afa8f7..99aeb2ede 100644 --- a/QCPlugin/CPTPieChartPlugin.m +++ b/QCPlugin/CPTPieChartPlugin.m @@ -25,11 +25,11 @@ @implementation CPTPieChartPlugIn */ @dynamic inputPieRadius, inputSliceLabelOffset, inputStartAngle, inputSliceDirection; -+(NSDictionary *)attributes ++(nonnull NSDictionary *)attributes { return @{ - QCPlugInAttributeNameKey: @"Core Plot Pie Chart", - QCPlugInAttributeDescriptionKey: @"Pie chart" + QCPlugInAttributeNameKey: @"Core Plot Pie Chart", + QCPlugInAttributeDescriptionKey: @"Pie chart" }; } @@ -55,68 +55,68 @@ -(double)inputYMin // Pie charts only support one layer so we override the createViewController method (to hide the number of charts button) --(QCPlugInViewController *)createViewController +-(nullable QCPlugInViewController *)createViewController { return nil; } -+(CPTStringArray)sortedPropertyPortKeys ++(nonnull CPTStringArray *)sortedPropertyPortKeys { - CPTStringArray pieChartPropertyPortKeys = @[@"inputPieRadius", @"inputSliceLabelOffset", @"inputStartAngle", @"inputSliceDirection", @"inputBorderColor", @"inputBorderWidth"]; + CPTStringArray *pieChartPropertyPortKeys = @[@"inputPieRadius", @"inputSliceLabelOffset", @"inputStartAngle", @"inputSliceDirection", @"inputBorderColor", @"inputBorderWidth"]; return [[super sortedPropertyPortKeys] arrayByAddingObjectsFromArray:pieChartPropertyPortKeys]; } -+(CPTDictionary)attributesForPropertyPortWithKey:(NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { // A few additional ports for the pie chart type ... if ( [key isEqualToString:@"inputPieRadius"] ) { return @{ - QCPortAttributeNameKey: @"Pie Radius", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @0.75 + QCPortAttributeNameKey: @"Pie Radius", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @0.75 }; } else if ( [key isEqualToString:@"inputSliceLabelOffset"] ) { return @{ - QCPortAttributeNameKey: @"Label Offset", - QCPortAttributeDefaultValueKey: @20.0 + QCPortAttributeNameKey: @"Label Offset", + QCPortAttributeDefaultValueKey: @20.0 }; } else if ( [key isEqualToString:@"inputStartAngle"] ) { return @{ - QCPortAttributeNameKey: @"Start Angle", - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"Start Angle", + QCPortAttributeDefaultValueKey: @0.0 }; } else if ( [key isEqualToString:@"inputSliceDirection"] ) { return @{ - QCPortAttributeNameKey: @"Slice Direction", - QCPortAttributeMaximumValueKey: @1, - QCPortAttributeMenuItemsKey: @[@"Clockwise", @"Counter-Clockwise"], - QCPortAttributeDefaultValueKey: @0 + QCPortAttributeNameKey: @"Slice Direction", + QCPortAttributeMaximumValueKey: @1, + QCPortAttributeMenuItemsKey: @[@"Clockwise", @"Counter-Clockwise"], + QCPortAttributeDefaultValueKey: @0 }; } else if ( [key isEqualToString:@"inputBorderWidth"] ) { return @{ - QCPortAttributeNameKey: @"Border Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Border Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @1.0 }; } else if ( [key isEqualToString:@"inputBorderColor"] ) { - CGColorRef grayColor = CGColorCreateGenericGray(0.0, 1.0); - CPTDictionary result = @{ - QCPortAttributeNameKey: @"Border Color", - QCPortAttributeDefaultValueKey: CFBridgingRelease(grayColor) + CGColorRef grayColor = CGColorCreateGenericGray(0.0, 1.0); + CPTDictionary *result = @{ + QCPortAttributeNameKey: @"Border Color", + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(grayColor) }; return result; } else if ( [key isEqualToString:@"inputLabelColor"] ) { - CGColorRef grayColor = CGColorCreateGenericGray(1.0, 1.0); - CPTDictionary result = @{ - QCPortAttributeNameKey: @"Label Color", - QCPortAttributeDefaultValueKey: CFBridgingRelease(grayColor) + CGColorRef grayColor = CGColorCreateGenericGray(1.0, 1.0); + CPTDictionary *result = @{ + QCPortAttributeNameKey: @"Label Color", + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(grayColor) }; return result; } @@ -147,7 +147,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Primary Fill Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(grayColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(grayColor) } ]; // Add the new plot to the graph @@ -216,7 +216,7 @@ -(BOOL)configurePlots #pragma mark - #pragma mark Data source methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:plot]; NSString *key = [NSString stringWithFormat:@"plotNumbers%lu", (unsigned long)plotIndex]; @@ -224,12 +224,12 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot return [[self valueForInputKey:key] count]; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger __unused)fieldEnum recordIndex:(NSUInteger)index { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:plot]; NSString *key = [NSString stringWithFormat:@"plotNumbers%lu", (unsigned long)plotIndex]; - CPTDictionary dict = [self valueForInputKey:key]; + CPTDictionary *dict = [self valueForInputKey:key]; if ( dict ) { return [NSDecimalNumber decimalNumberWithString:[dict[[NSString stringWithFormat:@"%lu", (unsigned long)index]] stringValue]]; @@ -239,10 +239,10 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI } } --(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index +-(nullable CPTFill *)sliceFillForPieChart:(nonnull CPTPieChart *__unused)pieChart recordIndex:(NSUInteger)index { - CGColorRef plotFillColor = [[CPTPieChart defaultPieSliceColorForIndex:index] cgColor]; - CGColorRef inputFillColor = (CGColorRef)[self areaFillColor : 0]; + CGColorRef plotFillColor = [CPTPieChart defaultPieSliceColorForIndex:index].cgColor; + CGColorRef inputFillColor = (CGColorRef)[self areaFillColor:0]; const CGFloat *plotColorComponents = CGColorGetComponents(plotFillColor); const CGFloat *inputColorComponents = CGColorGetComponents(inputFillColor); @@ -259,12 +259,12 @@ -(CPTFill *)sliceFillForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger return [[CPTFill alloc] initWithColor:fillCPColor]; } --(CPTTextLayer *)sliceLabelForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index +-(nullable CPTTextLayer *)sliceLabelForPieChart:(nonnull CPTPieChart *)pieChart recordIndex:(NSUInteger)index { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:pieChart]; NSString *key = [NSString stringWithFormat:@"plotLabels%lu", (unsigned long)plotIndex]; - CPTDictionary dict = [self valueForInputKey:key]; + CPTDictionary *dict = [self valueForInputKey:key]; if ( !dict ) { return nil; diff --git a/QCPlugin/CPTScatterPlotPlugin.h b/QCPlugin/CPTScatterPlotPlugin.h index 0ea178c1d..aaad42138 100644 --- a/QCPlugin/CPTScatterPlotPlugin.h +++ b/QCPlugin/CPTScatterPlotPlugin.h @@ -1,4 +1,4 @@ -#import "CorePlotQCPlugIn.h" +#import "CorePlotQCPlugin.h" #import @interface CPTScatterPlotPlugIn : CorePlotQCPlugIn diff --git a/QCPlugin/CPTScatterPlotPlugin.m b/QCPlugin/CPTScatterPlotPlugin.m index 9dd7acb06..023a890db 100644 --- a/QCPlugin/CPTScatterPlotPlugin.m +++ b/QCPlugin/CPTScatterPlotPlugin.m @@ -1,4 +1,4 @@ -#import "CPTScatterPlotPlugIn.h" +#import "CPTScatterPlotPlugin.h" @implementation CPTScatterPlotPlugIn @@ -22,11 +22,11 @@ @implementation CPTScatterPlotPlugIn @dynamic inputXMin, inputXMax, inputYMin, inputYMax; @dynamic inputXMajorIntervals, inputYMajorIntervals, inputXMinorIntervals, inputYMinorIntervals; -+(NSDictionary *)attributes ++(nonnull NSDictionary *)attributes { return @{ - QCPlugInAttributeNameKey: @"Core Plot Scatter Plot", - QCPlugInAttributeDescriptionKey: @"Scatter plot" + QCPlugInAttributeNameKey: @"Core Plot Scatter Plot", + QCPlugInAttributeDescriptionKey: @"Scatter plot" }; } @@ -51,7 +51,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotDataLineColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Plot Line Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(lineColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(lineColor) } ]; CGColorRef fillColor = [self newDefaultColorForPlot:index alpha:0.25]; @@ -59,7 +59,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Plot Fill Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(fillColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(fillColor) } ]; [self addInputPortWithType:QCPortTypeNumber @@ -85,7 +85,7 @@ -(void)addPlotWithIndex:(NSUInteger)index forKey:[NSString stringWithFormat:@"plotDataSymbolColor%lu", (unsigned long)index] withAttributes:@{ QCPortAttributeNameKey: [NSString stringWithFormat:@"Data Symbol Color %lu", (unsigned long)(index + 1)], QCPortAttributeTypeKey: QCPortTypeColor, - QCPortAttributeDefaultValueKey: CFBridgingRelease(symbolColor) } + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(symbolColor) } ]; // Add the new plot to the graph @@ -123,11 +123,11 @@ -(void)removePlots:(NSUInteger)count [self removeInputPortForKey:[NSString stringWithFormat:@"plotDataSymbols%lu", (unsigned long)(i - 1)]]; [self removeInputPortForKey:[NSString stringWithFormat:@"plotDataSymbolColor%lu", (unsigned long)(i - 1)]]; - [theGraph removePlot:[[theGraph allPlots] lastObject]]; + [theGraph removePlot:[theGraph allPlots].lastObject]; } } --(CPTPlotSymbol *)plotSymbol:(NSUInteger)index +-(nullable CPTPlotSymbol *)plotSymbol:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotDataSymbols%lu", (unsigned long)index]; NSUInteger value = [[self valueForInputKey:key] unsignedIntegerValue]; @@ -168,7 +168,7 @@ -(CPTPlotSymbol *)plotSymbol:(NSUInteger)index } } --(CGColorRef)dataSymbolColor:(NSUInteger)index +-(nonnull CGColorRef)dataSymbolColor:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotDataSymbolColor%lu", (unsigned long)index]; @@ -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]; } @@ -204,14 +207,14 @@ -(BOOL)configurePlots #pragma mark - #pragma mark Data source methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:plot]; NSString *xKey = [NSString stringWithFormat:@"plotXNumbers%lu", (unsigned long)plotIndex]; NSString *yKey = [NSString stringWithFormat:@"plotYNumbers%lu", (unsigned long)plotIndex]; - CPTDictionary xVals = [self valueForInputKey:xKey]; - CPTDictionary yVals = [self valueForInputKey:yKey]; + CPTDictionary *xVals = [self valueForInputKey:xKey]; + CPTDictionary *yVals = [self valueForInputKey:yKey]; if ( !xVals || !yVals ) { return 0; @@ -223,14 +226,14 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot return xVals.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSUInteger plotIndex = [[self.graph allPlots] indexOfObject:plot]; NSString *xKey = [NSString stringWithFormat:@"plotXNumbers%lu", (unsigned long)plotIndex]; NSString *yKey = [NSString stringWithFormat:@"plotYNumbers%lu", (unsigned long)plotIndex]; - CPTDictionary xVals = [self valueForInputKey:xKey]; - CPTDictionary yVals = [self valueForInputKey:yKey]; + CPTDictionary *xVals = [self valueForInputKey:xKey]; + CPTDictionary *yVals = [self valueForInputKey:yKey]; if ( !xVals || !yVals ) { return nil; @@ -239,7 +242,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI return nil; } - CPTDictionary dict = (fieldEnum == CPTScatterPlotFieldX) ? xVals : yVals; + CPTDictionary *dict = (fieldEnum == CPTScatterPlotFieldX) ? xVals : yVals; NSString *dictionaryKey = [NSString stringWithFormat:@"%lu", (unsigned long)index]; diff --git a/QCPlugin/CorePlotQCPlugin.h b/QCPlugin/CorePlotQCPlugin.h index c5359b7ca..99354c2d5 100644 --- a/QCPlugin/CorePlotQCPlugin.h +++ b/QCPlugin/CorePlotQCPlugin.h @@ -3,18 +3,18 @@ @interface CorePlotQCPlugIn : QCPlugIn -@property (readwrite, strong) CPTGraph *graph; +@property (readwrite, strong, nullable) CPTGraph *graph; -@property (readwrite, assign) id outputImage; +@property (readwrite, strong, nonnull) id outputImage; @property (readwrite, assign) NSUInteger numberOfPlots; @property (readwrite, assign) NSUInteger inputPixelsWide; @property (readwrite, assign) NSUInteger inputPixelsHigh; -@property (readwrite, assign) CGColorRef inputPlotAreaColor; +@property (readwrite, assign, nonnull) CGColorRef inputPlotAreaColor; -@property (readwrite, assign) CGColorRef inputAxisColor; +@property (readwrite, assign, nonnull) CGColorRef inputAxisColor; @property (readwrite, assign) double inputAxisLineWidth; @property (readwrite, assign) double inputAxisMajorTickWidth; @property (readwrite, assign) double inputAxisMinorTickWidth; @@ -41,14 +41,14 @@ -(BOOL)configurePlots; -(BOOL)configureAxis; --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot; --(CGColorRef)newDefaultColorForPlot:(NSUInteger)index alpha:(CGFloat)alpha; +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot; +-(nonnull CGColorRef)newDefaultColorForPlot:(NSUInteger)index alpha:(CGFloat)alpha; -(void)freeResources; --(CGColorRef)dataLineColor:(NSUInteger)index; +-(nonnull CGColorRef)dataLineColor:(NSUInteger)index; -(CGFloat)dataLineWidth:(NSUInteger)index; --(CGColorRef)areaFillColor:(NSUInteger)index; --(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 043e6b292..3aa3ef332 100644 --- a/QCPlugin/CorePlotQCPlugin.m +++ b/QCPlugin/CorePlotQCPlugin.m @@ -1,4 +1,4 @@ -#import "CorePlotQCPlugIn.h" +#import "CorePlotQCPlugin.h" #import #define kQCPlugIn_Name @"CorePlotQCPlugIn" @@ -8,18 +8,18 @@ @interface CorePlotQCPlugIn() -@property (nonatomic, readwrite, strong) NSMutableData *imageData; -@property (nonatomic, readwrite, assign) CGContextRef bitmapContext; -@property (nonatomic, readwrite, strong) id imageProvider; +@property (nonatomic, readwrite, strong, nullable) NSMutableData *imageData; +@property (nonatomic, readwrite, assign, nullable) CGContextRef bitmapContext; +@property (nonatomic, readwrite, strong, nullable) id imageProvider; -void drawErrorText(CGContextRef context, CGRect rect); +void drawErrorText(CGContextRef __nonnull context, CGRect rect); @end #pragma mark - // Draws the string "ERROR" in the given context in big red letters -void drawErrorText(CGContextRef context, CGRect rect) +void drawErrorText(CGContextRef __nonnull context, CGRect rect) { CGContextSaveGState(context); @@ -83,15 +83,15 @@ @implementation CorePlotQCPlugIn */ @synthesize numberOfPlots; -+(NSDictionary *)attributes ++(nonnull NSDictionary *)attributes { /* * Return a dictionary of attributes describing the plug-in (QCPlugInAttributeNameKey, QCPlugInAttributeDescriptionKey...). */ return @{ - QCPlugInAttributeNameKey: kQCPlugIn_Name, - QCPlugInAttributeDescriptionKey: kQCPlugIn_Description + QCPlugInAttributeNameKey: kQCPlugIn_Name, + QCPlugInAttributeDescriptionKey: kQCPlugIn_Description }; } @@ -113,9 +113,9 @@ +(QCPlugInTimeMode)timeMode return kQCPlugInTimeModeNone; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { /* * Allocate any permanent resource required by the plug-in. */ @@ -149,7 +149,7 @@ -(void)freeResources self.graph = nil; } --(QCPlugInViewController *)createViewController +-(nullable QCPlugInViewController *)createViewController { /* * Return a new QCPlugInViewController to edit the internal settings of this plug-in instance. @@ -162,7 +162,7 @@ -(QCPlugInViewController *)createViewController #pragma mark - #pragma mark Input and output port configuration -+(CPTStringArray)sortedPropertyPortKeys ++(nonnull CPTStringArray *)sortedPropertyPortKeys { return @[@"inputPixelsWide", @"inputPixelsHigh", @@ -186,7 +186,7 @@ +(CPTStringArray)sortedPropertyPortKeys @"inputAxisMinorTickWidth"]; } -+(CPTDictionary)attributesForPropertyPortWithKey:(NSString *)key ++(nullable CPTDictionary *)attributesForPropertyPortWithKey:(nullable NSString *)key { /* * Specify the optional attributes for property based ports (QCPortAttributeNameKey, QCPortAttributeDefaultValueKey...). @@ -194,157 +194,157 @@ +(CPTDictionary)attributesForPropertyPortWithKey:(NSString *)key if ( [key isEqualToString:@"inputXMin"] ) { return @{ - QCPortAttributeNameKey: @"X Range Min", - QCPortAttributeDefaultValueKey: @(-1.0) + QCPortAttributeNameKey: @"X Range Min", + QCPortAttributeDefaultValueKey: @(-1.0) }; } if ( [key isEqualToString:@"inputXMax"] ) { return @{ - QCPortAttributeNameKey: @"X Range Max", - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"X Range Max", + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputYMin"] ) { return @{ - QCPortAttributeNameKey: @"Y Range Min", - QCPortAttributeDefaultValueKey: @(-1.0) + QCPortAttributeNameKey: @"Y Range Min", + QCPortAttributeDefaultValueKey: @(-1.0) }; } if ( [key isEqualToString:@"inputYMax"] ) { return @{ - QCPortAttributeNameKey: @"Y Range Max", - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Y Range Max", + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputXMajorIntervals"] ) { return @{ - QCPortAttributeNameKey: @"X Major Intervals", - QCPortAttributeDefaultValueKey: @4.0, - QCPortAttributeMinimumValueKey: @0.0 + QCPortAttributeNameKey: @"X Major Intervals", + QCPortAttributeDefaultValueKey: @4.0, + QCPortAttributeMinimumValueKey: @0.0 }; } if ( [key isEqualToString:@"inputYMajorIntervals"] ) { return @{ - QCPortAttributeNameKey: @"Y Major Intervals", - QCPortAttributeDefaultValueKey: @4.0, - QCPortAttributeMinimumValueKey: @0.0 + QCPortAttributeNameKey: @"Y Major Intervals", + QCPortAttributeDefaultValueKey: @4.0, + QCPortAttributeMinimumValueKey: @0.0 }; } if ( [key isEqualToString:@"inputXMinorIntervals"] ) { return @{ - QCPortAttributeNameKey: @"X Minor Intervals", - QCPortAttributeDefaultValueKey: @1, - QCPortAttributeMinimumValueKey: @0 + QCPortAttributeNameKey: @"X Minor Intervals", + QCPortAttributeDefaultValueKey: @1, + QCPortAttributeMinimumValueKey: @0 }; } if ( [key isEqualToString:@"inputYMinorIntervals"] ) { return @{ - QCPortAttributeNameKey: @"Y Minor Intervals", - QCPortAttributeDefaultValueKey: @1, - QCPortAttributeMinimumValueKey: @0 + QCPortAttributeNameKey: @"Y Minor Intervals", + QCPortAttributeDefaultValueKey: @1, + QCPortAttributeMinimumValueKey: @0 }; } if ( [key isEqualToString:@"inputAxisColor"] ) { - CGColorRef axisColor = CGColorCreateGenericRGB(1.0, 1.0, 1.0, 1.0); - CPTDictionary result = @{ - QCPortAttributeNameKey: @"Axis Color", - QCPortAttributeDefaultValueKey: CFBridgingRelease(axisColor) + CGColorRef axisColor = CGColorCreateGenericRGB(1.0, 1.0, 1.0, 1.0); + CPTDictionary *result = @{ + QCPortAttributeNameKey: @"Axis Color", + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(axisColor) }; return result; } if ( [key isEqualToString:@"inputAxisLineWidth"] ) { return @{ - QCPortAttributeNameKey: @"Axis Line Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Axis Line Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputAxisMajorTickWidth"] ) { return @{ - QCPortAttributeNameKey: @"Major Tick Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @2.0 + QCPortAttributeNameKey: @"Major Tick Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @2.0 }; } if ( [key isEqualToString:@"inputAxisMinorTickWidth"] ) { return @{ - QCPortAttributeNameKey: @"Minor Tick Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Minor Tick Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputAxisMajorTickLength"] ) { return @{ - QCPortAttributeNameKey: @"Major Tick Length", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @10.0 + QCPortAttributeNameKey: @"Major Tick Length", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @10.0 }; } if ( [key isEqualToString:@"inputAxisMinorTickLength"] ) { return @{ - QCPortAttributeNameKey: @"Minor Tick Length", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @3.0 + QCPortAttributeNameKey: @"Minor Tick Length", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @3.0 }; } if ( [key isEqualToString:@"inputMajorGridLineWidth"] ) { return @{ - QCPortAttributeNameKey: @"Major Grid Line Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @1.0 + QCPortAttributeNameKey: @"Major Grid Line Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @1.0 }; } if ( [key isEqualToString:@"inputMinorGridLineWidth"] ) { return @{ - QCPortAttributeNameKey: @"Minor Grid Line Width", - QCPortAttributeMinimumValueKey: @0.0, - QCPortAttributeDefaultValueKey: @0.0 + QCPortAttributeNameKey: @"Minor Grid Line Width", + QCPortAttributeMinimumValueKey: @0.0, + QCPortAttributeDefaultValueKey: @0.0 }; } if ( [key isEqualToString:@"inputPlotAreaColor"] ) { CGColorRef plotAreaColor = CGColorCreateGenericRGB(0.0, 0.0, 0.0, 0.4); - CPTDictionary result = @{ - QCPortAttributeNameKey: @"Plot Area Color", - QCPortAttributeDefaultValueKey: CFBridgingRelease(plotAreaColor) + CPTDictionary *result = @{ + QCPortAttributeNameKey: @"Plot Area Color", + QCPortAttributeDefaultValueKey: (id)CFBridgingRelease(plotAreaColor) }; return result; } if ( [key isEqualToString:@"inputPixelsWide"] ) { return @{ - QCPortAttributeNameKey: @"Pixels Wide", - QCPortAttributeMinimumValueKey: @1, - QCPortAttributeDefaultValueKey: @512 + QCPortAttributeNameKey: @"Pixels Wide", + QCPortAttributeMinimumValueKey: @1, + QCPortAttributeDefaultValueKey: @512 }; } if ( [key isEqualToString:@"inputPixelsHigh"] ) { return @{ - QCPortAttributeNameKey: @"Pixels High", - QCPortAttributeMinimumValueKey: @1, - QCPortAttributeDefaultValueKey: @512 + QCPortAttributeNameKey: @"Pixels High", + QCPortAttributeMinimumValueKey: @1, + QCPortAttributeDefaultValueKey: @512 }; } if ( [key isEqualToString:@"outputImage"] ) { return @{ - QCPortAttributeNameKey: @"Image" + QCPortAttributeNameKey: @"Image" }; } @@ -380,7 +380,7 @@ -(void)createGraph } } --(CGColorRef)newDefaultColorForPlot:(NSUInteger)index alpha:(CGFloat)alpha +-(nonnull CGColorRef)newDefaultColorForPlot:(NSUInteger)index alpha:(CGFloat)alpha { CGColorRef color; @@ -451,11 +451,11 @@ -(BOOL)configureAxis set.xAxis.labelTextStyle = textStyle; double xrange = self.inputXMax - self.inputXMin; - set.xAxis.majorIntervalLength = @( xrange / (self.inputXMajorIntervals) ); + set.xAxis.majorIntervalLength = @(xrange / (self.inputXMajorIntervals)); set.xAxis.minorTicksPerInterval = self.inputXMinorIntervals; double yrange = self.inputYMax - self.inputYMin; - set.yAxis.majorIntervalLength = @( yrange / (self.inputYMajorIntervals) ); + set.yAxis.majorIntervalLength = @(yrange / (self.inputYMajorIntervals)); set.yAxis.minorTicksPerInterval = self.inputYMinorIntervals; set.xAxis.minorTickLength = self.inputAxisMinorTickLength; @@ -497,7 +497,7 @@ -(BOOL)configureAxis return YES; } --(CGColorRef)dataLineColor:(NSUInteger)index +-(nonnull CGColorRef)dataLineColor:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotDataLineColor%lu", (unsigned long)index]; @@ -513,18 +513,19 @@ -(CGFloat)dataLineWidth:(NSUInteger)index return inputValue.doubleValue; } --(CGColorRef)areaFillColor:(NSUInteger)index +-(nullable CGColorRef)areaFillColor:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotFillColor%lu", (unsigned long)index]; return (__bridge CGColorRef)([self valueForInputKey:key]); } --(CGImageRef)newAreaFillImage:(NSUInteger)index +-(nullable CGImageRef)newAreaFillImage:(NSUInteger)index { NSString *key = [NSString stringWithFormat:@"plotFillImage%lu", (unsigned long)index]; id img = [self valueForInputKey:key]; + if ( !img ) { return nil; } @@ -546,6 +547,9 @@ -(CGImageRef)newAreaFillImage:(NSUInteger)index NSUInteger bytesPerRow = [img bufferBytesPerRow]; CGColorSpaceRef colorSpace = [img bufferColorSpace]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wincompatible-pointer-types-discards-qualifiers" + CGContextRef imgContext = CGBitmapContextCreate(baseAddress, pixelsWide, pixelsHigh, @@ -554,6 +558,8 @@ -(CGImageRef)newAreaFillImage:(NSUInteger)index colorSpace, (CGBitmapInfo)kCGImageAlphaNoneSkipLast); +#pragma clang diagnostic pop + CGImageRef imageRef = CGBitmapContextCreateImage(imgContext); [img unlockBufferRepresentation]; @@ -563,12 +569,12 @@ -(CGImageRef)newAreaFillImage:(NSUInteger)index return imageRef; } -static void _BufferReleaseCallback(const void *address, void *context) +static void _BufferReleaseCallback(const void *__nonnull __unused address, void *__nonnull __unused context) { // Don't do anything. We release the buffer manually when it's recreated or during dealloc } --(void)createImageResourcesWithContext:(id)context +-(void)createImageResourcesWithContext:(nonnull id)context { // Create a CG bitmap for drawing. The image data is released when QC calls _BufferReleaseCallback CGSize boundsSize = self.graph.bounds.size; @@ -576,7 +582,7 @@ -(void)createImageResourcesWithContext:(id)context size_t rowBytes = (size_t)boundsSize.width * 4; if ( rowBytes % 16 ) { - rowBytes = ( (rowBytes / 16) + 1 ) * 16; + rowBytes = ((rowBytes / 16) + 1) * 16; } if ( !self.imageData ) { @@ -609,7 +615,7 @@ -(void)createImageResourcesWithContext:(id)context CGContextRelease(newContext); if ( rowBytes % 16 ) { - rowBytes = ( (rowBytes / 16) + 1 ) * 16; + rowBytes = ((rowBytes / 16) + 1) * 16; } // Note: I don't have a PPC to test on so this may or may not cause some color issues @@ -639,12 +645,12 @@ -(void)createImageResourcesWithContext:(id)context #pragma mark - #pragma mark Data source methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return 0; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger __unused)fieldEnum recordIndex:(NSUInteger __unused)index { return @0; } @@ -671,12 +677,12 @@ -(void)setNumberOfPlots:(NSUInteger)number numberOfPlots = number; } -+(CPTStringArray)plugInKeys ++(nonnull CPTStringArray *)plugInKeys { return @[@"numberOfPlots"]; } --(id)serializedValueForKey:(NSString *)key +-(nonnull id)serializedValueForKey:(nonnull NSString *)key { /* * Provide custom serialization for the plug-in internal settings that are not values complying to the protocol. @@ -691,7 +697,7 @@ -(id)serializedValueForKey:(NSString *)key } } --(void)setSerializedValue:(id)serializedValue forKey:(NSString *)key +-(void)setSerializedValue:(nonnull id)serializedValue forKey:(nonnull NSString *)key { /* * Provide deserialization for the plug-in internal settings that were custom serialized in -serializedValueForKey. @@ -699,7 +705,7 @@ -(void)setSerializedValue:(id)serializedValue forKey:(NSString *)key */ if ( [key isEqualToString:@"numberOfPlots"] ) { - [self setNumberOfPlots:MAX(1, [(NSNumber *)serializedValue unsignedIntegerValue])]; + [self setNumberOfPlots:MAX(1, [(NSNumber *) serializedValue unsignedIntegerValue])]; } else { [super setSerializedValue:serializedValue forKey:key]; @@ -709,7 +715,7 @@ -(void)setSerializedValue:(id)serializedValue forKey:(NSString *)key #pragma mark - #pragma mark Accessors --(void)setBitmapContext:(CGContextRef)newContext +-(void)setBitmapContext:(nullable CGContextRef)newContext { if ( newContext != bitmapContext ) { CGContextRelease(bitmapContext); @@ -720,14 +726,14 @@ -(void)setBitmapContext:(CGContextRef)newContext #pragma mark - #pragma mark Subclass methods --(void)addPlotWithIndex:(NSUInteger)index +-(void)addPlotWithIndex:(NSUInteger __unused)index { /* * Subclasses should override this method to create their own ports, plots, and add the plots to the graph */ } --(void)removePlots:(NSUInteger)count +-(void)removePlots:(NSUInteger __unused)count { /* * Subclasses should override this method to remove plots and their ports @@ -750,7 +756,7 @@ -(BOOL)configureGraph */ // Configure the graph area - CGRect frame = CPTRectMake( 0.0, 0.0, MAX(1, self.inputPixelsWide), MAX(1, self.inputPixelsHigh) ); + CGRect frame = CPTRectMake(0.0, 0.0, MAX(1, self.inputPixelsWide), MAX(1, self.inputPixelsHigh)); self.graph.bounds = frame; @@ -760,7 +766,7 @@ -(BOOL)configureGraph self.graph.paddingBottom = 0.0; // Perform some sanity checks. If there is a configuration error set the error flag so that a message is displayed - if ( (self.inputXMax <= self.inputXMin) || (self.inputYMax <= self.inputYMin) ) { + if ((self.inputXMax <= self.inputXMin) || (self.inputYMax <= self.inputYMin)) { return NO; } @@ -795,7 +801,7 @@ -(BOOL)configureGraph @implementation CorePlotQCPlugIn(Execution) --(BOOL)execute:(id)context atTime:(NSTimeInterval)time withArguments:(CPTDictionary)arguments +-(BOOL)execute:(nonnull id)context atTime:(NSTimeInterval __unused)time withArguments:(nullable CPTDictionary *__unused)arguments { // Configure the plot for drawing BOOL configurationCheck = [self configureGraph]; @@ -811,9 +817,9 @@ -(BOOL)execute:(id)context atTime:(NSTimeInterval)time withArgu // Draw the plot ... CGSize boundsSize = self.graph.bounds.size; CGContextRef bmContext = self.bitmapContext; - CGContextClearRect( bmContext, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); + CGContextClearRect(bmContext, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height)); CGContextSetRGBFillColor(bmContext, 0.0, 0.0, 0.0, 0.0); - CGContextFillRect( bmContext, CPTRectMake(0, 0, boundsSize.width, boundsSize.height) ); + CGContextFillRect(bmContext, CPTRectMake(0, 0, boundsSize.width, boundsSize.height)); CGContextSetAllowsAntialiasing(bmContext, true); if ( configurationCheck ) { @@ -821,16 +827,21 @@ -(BOOL)execute:(id)context atTime:(NSTimeInterval)time withArgu [self.graph recursivelyRenderInContext:bmContext]; } else { - drawErrorText( bmContext, CPTRectMake(0, 0, self.inputPixelsWide, self.inputPixelsHigh) ); + drawErrorText(bmContext, CPTRectMake(0, 0, self.inputPixelsWide, self.inputPixelsHigh)); } - //CGContextSetAllowsAntialiasing(bitmapContext, false); + // CGContextSetAllowsAntialiasing(bitmapContext, false); 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/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj b/QCPlugin/CorePlotQCPlugin.xcodeproj/project.pbxproj index 4f7d5cf2e..e07788d06 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 */; @@ -111,9 +125,7 @@ 16BA95400A7EB2EB001E4983 /* CorePlotQCPlugin.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CorePlotQCPlugin.h; sourceTree = ""; }; 16BA95410A7EB2EB001E4983 /* CorePlotQCPlugin.m */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CorePlotQCPlugin.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 16BA96300A7EB9AC001E4983 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = /System/Library/Frameworks/Quartz.framework; sourceTree = ""; }; - 7238D5510DB6988600E9A42D /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Settings.xib; sourceTree = ""; }; 8D5B49B6048680CD000E48DA /* CorePlotQCPlugin.plugin */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CorePlotQCPlugin.plugin; sourceTree = BUILT_PRODUCTS_DIR; }; - 8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; A819AA0311FD3F23006D1C2D /* CPTPieChartPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPieChartPlugin.h; sourceTree = ""; }; A819AA0411FD3F23006D1C2D /* CPTPieChartPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTPieChartPlugin.m; sourceTree = ""; }; A89BAB3B1027EFBD004B2FE1 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../framework/CorePlot.xcodeproj; sourceTree = SOURCE_ROOT; }; @@ -121,7 +133,9 @@ A8FC1815102CBADE00CF2266 /* CPTScatterPlotPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTScatterPlotPlugin.m; sourceTree = ""; }; A8FC1817102CBAEA00CF2266 /* CPTBarPlotPlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTBarPlotPlugin.h; sourceTree = ""; }; A8FC1818102CBAEA00CF2266 /* CPTBarPlotPlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTBarPlotPlugin.m; sourceTree = ""; }; + C37A410E20E0326C00C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C3C8CFF619E9504C007E0BCB /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3DA083820E00C7700F73704 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/Settings.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -167,7 +181,7 @@ isa = PBXGroup; children = ( 7238D5500DB6988600E9A42D /* Settings.xib */, - 8D5B49B7048680CD000E48DA /* Info.plist */, + C37A410F20E0326C00C4FF48 /* Info.plist */, ); name = Resources; sourceTree = ""; @@ -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,17 +262,18 @@ 089C1669FE841209C02AAC07 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0930; }; buildConfigurationList = 1DEB913E08733D840010E9CD /* Build configuration list for PBXProject "CorePlotQCPlugin" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + en, + ja, + fr, + de, ); mainGroup = 089C166AFE841209C02AAC07 /* Quartz Composer Plug In */; projectDirPath = ""; @@ -289,6 +306,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; @@ -377,11 +408,19 @@ 7238D5500DB6988600E9A42D /* Settings.xib */ = { isa = PBXVariantGroup; children = ( - 7238D5510DB6988600E9A42D /* English */, + C3DA083820E00C7700F73704 /* Base */, ); name = Settings.xib; sourceTree = ""; }; + C37A410F20E0326C00C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A410E20E0326C00C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -395,10 +434,9 @@ COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CorePlotQCPlugin_Prefix.pch; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Library/Graphics/Quartz Composer Plug-Ins"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; OTHER_LDFLAGS = ""; @@ -421,7 +459,7 @@ GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CorePlotQCPlugin_Prefix.pch; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Library/Graphics/Quartz Composer Plug-Ins"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; OTHER_LDFLAGS = ""; @@ -435,10 +473,15 @@ }; 1DEB913F08733D840010E9CD /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C8CFF619E9504C007E0BCB /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SYMROOT = "$(PROJECT_DIR)/../build"; @@ -447,9 +490,14 @@ }; 1DEB914008733D840010E9CD /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C8CFF619E9504C007E0BCB /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; + GCC_WARN_ABOUT_RETURN_TYPE = YES; MACOSX_DEPLOYMENT_TARGET = 10.8; OTHER_LDFLAGS = ""; SYMROOT = "$(PROJECT_DIR)/../build"; @@ -459,6 +507,7 @@ 233E2D8A0A83C7AC005A62DF /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; PRODUCT_NAME = "Build & Install"; }; @@ -467,6 +516,7 @@ 233E2D8B0A83C7AC005A62DF /* Release */ = { isa = XCBuildConfiguration; buildSettings = { + CLANG_ENABLE_OBJC_WEAK = YES; COMBINE_HIDPI_IMAGES = YES; PRODUCT_NAME = "Build & Install"; }; diff --git a/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme b/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme new file mode 100644 index 000000000..7afa5ea4a --- /dev/null +++ b/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/Build & Copy.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/CorePlotQCPlugin.xcscheme b/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/CorePlotQCPlugin.xcscheme new file mode 100644 index 000000000..d1baaa5f3 --- /dev/null +++ b/QCPlugin/CorePlotQCPlugin.xcodeproj/xcshareddata/xcschemes/CorePlotQCPlugin.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index e3e3703ef..b0b803087 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,16 @@ +Core Plot logo + # Core Plot -*Cocoa plotting framework for Mac OS X and iOS.* +*Cocoa plotting framework for macOS, iOS, and tvOS.* -[![Build Status](https://secure.travis-ci.org/core-plot/core-plot.svg)](http://travis-ci.org/core-plot/core-plot) [![Version Status](https://img.shields.io/cocoapods/v/CorePlot.svg)](https://cocoapods.org/pods/CorePlot) [![license MIT](https://img.shields.io/cocoapods/l/CorePlot.svg)](http://opensource.org/licenses/BSD-3-Clause) [![Platform](https://img.shields.io/cocoapods/p/CorePlot.svg)](http://core-plot.github.io) +[![Cocoapods platforms](https://img.shields.io/cocoapods/p/CorePlot?color=bright-green)](https://core-plot.github.io) [![core-plot CI](https://github.com/core-plot/core-plot/actions/workflows/ci.yml/badge.svg)](https://github.com/core-plot/core-plot/actions/workflows/ci.yml) +[![Cocoapods](https://img.shields.io/cocoapods/v/CorePlot?color=bright-green)](https://cocoapods.org/pods/CorePlot) [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen?style=flat)](https://github.com/Carthage/Carthage) [![Swift Package Manager compatible](https://img.shields.io/badge/SPM-compatible-brightgreen)](https://github.com/apple/swift-package-manager) +[![GitHub license](https://img.shields.io/github/license/core-plot/core-plot?color=bright-green)](https://opensource.org/licenses/BSD-3-Clause) # Introduction -Core Plot is a 2D plotting framework for Mac OS X and iOS. It is highly customizable and capable of drawing many types of plots. See the [Example Graphs](https://github.com/core-plot/core-plot/wiki/Example-Graphs) wiki page and the [example applications](https://github.com/core-plot/core-plot/tree/master/examples) for examples of some of its capabilities. +Core Plot is a 2D plotting framework for macOS, iOS, and tvOS. It is highly customizable and capable of drawing many types of plots. See the [Example Graphs](https://github.com/core-plot/core-plot/wiki/Example-Graphs) wiki page and the [example applications](https://github.com/core-plot/core-plot/tree/master/examples) for examples of some of its capabilities. # Getting Started @@ -17,9 +21,9 @@ See the [High Level Design Overview](https://github.com/core-plot/core-plot/wiki Documentation of the Core Plot API and high-level architecture can be found in the following places: * [Change log](https://github.com/core-plot/core-plot/blob/master/documentation/changelog.markdown) - * [API documentation](http://core-plot.github.io/MacOS/index.html) for Mac - * [API documentation](http://core-plot.github.io/iOS/index.html) for iOS - * API documentation built with [Doxygen](http://www.doxygen.org/) and installed locally in Xcode (see the [instructions](https://github.com/core-plot/core-plot/blob/master/READMEs/README%20for%20Docs%20Install.md) in the **READMEs** folder for details) + * [API documentation](https://core-plot.github.io/MacOS/index.html) for Mac + * [API documentation](https://core-plot.github.io/iOS/index.html) for iOS and tvOS + * API documentation built with [Doxygen](https://www.doxygen.nl/) and installed locally in Xcode (see the [instructions](https://github.com/core-plot/core-plot/blob/master/READMEs/README%20for%20Docs%20Install.md) in the **READMEs** folder for details) * [Project Wiki](https://github.com/core-plot/core-plot/wiki) on GitHub * [Documentation](https://github.com/core-plot/core-plot/tree/master/documentation) folder in the code repository @@ -27,13 +31,12 @@ Documentation of the Core Plot API and high-level architecture can be found in t ## Q&A Sites - * [Core Plot](http://groups.google.com/group/coreplot-discuss) Google Group - * Stackoverflow.com [core-plot tag](http://stackoverflow.com/questions/tagged/core-plot) + * [Core Plot](https://groups.google.com/group/coreplot-discuss) Google Group + * Stackoverflow.com [core-plot tag](https://stackoverflow.com/questions/tagged/core-plot) ## Social Networks * [Twitter](https://twitter.com/CorePlot) - * [App.net](https://alpha.app.net/coreplot); Subscribe to the [Announcements](https://app.net/c/2rw2) broadcast. # Contributing to Core Plot @@ -41,16 +44,12 @@ Core Plot is an open source project hosted on [GitHub](https://github.com/core-p * [core-plot](https://github.com/core-plot/core-plot): This is main code repository with the framework and all examples. This is where you will find the release packages, wiki pages, and issue tracker. - * [core-plot.github.io](https://github.com/core-plot/core-plot.github.io): This is the HTML API documentation. You can view the pages online at [http://core-plot.github.io](http://core-plot.github.io). + * [core-plot.github.io](https://github.com/core-plot/core-plot.github.io): This is the HTML API documentation. You can view the pages online at [https://core-plot.github.io](https://core-plot.github.io). ## Coding Standards -Everyone has a their own preferred coding style, and no one way can be considered right. Nonetheless, in a project like Core Plot, with many developers contributing, it is worthwhile defining a set of basic coding standards to prevent a mishmash of different styles which can become frustrating when navigating the code base. See the file [Coding Style.markdown](https://github.com/core-plot/core-plot/blob/master/documentation/Coding%20Style.markdown) found in the [documentation](https://github.com/core-plot/core-plot/tree/master/documentation) directory of the project source for specific guidelines. +Everyone has a their own preferred coding style, and no one way can be considered right. Nonetheless, in a project like Core Plot, with many developers contributing, it is worthwhile defining a set of basic coding standards to prevent a mishmash of different styles which can become frustrating when navigating the code base. See the file [CONTRIBUTING.md](https://github.com/core-plot/core-plot/blob/master/.github/CONTRIBUTING.md) found in the [.github](https://github.com/core-plot/core-plot/tree/master/.github) directory of the project source for specific guidelines. -Core Plot includes a [script](https://github.com/core-plot/core-plot/blob/master/scripts/format_core_plot.sh) to run [Uncrustify](http://uncrustify.sourceforge.net) on the source code to standardize the formatting. All source code will be formatted with this tool before being committed to the Core Plot repository. +Core Plot includes a [script](https://github.com/core-plot/core-plot/blob/master/scripts/format_core_plot.sh) to run [Uncrustify](https://github.com/uncrustify/uncrustify) on the source code to standardize the formatting. All source code will be formatted with this tool before being committed to the Core Plot repository. ## Testing -Because Core Plot is intended to be used in scientific, financial, and other domains where correctness is paramount, unit testing is integrated into the framework. Good test coverage protects developers from introducing accidental regressions and frees them to experiment and refactor without fear of breaking things. See the [unit testing](https://github.com/core-plot/core-plot/wiki/Unit-Testing) wiki page for instructions on how to build unit tests for any new code you add to the project. - -# Support Core Plot - -Flattr this +Core Plot is intended to be applied in scientific, financial, and other domains where correctness is paramount. In order to assure the quality of the framework, unit testing is integrated. Good test coverage protects developers from introducing accidental regressions, and helps them to experiment and refactor without breaking existing code. See the [unit testing](https://github.com/core-plot/core-plot/wiki/Unit-Testing) wiki page for instructions on how to build unit tests for any new code you add to the project. diff --git a/READMEs/README for Docs Install.md b/READMEs/README for Docs Install.md index 01cf04a82..57c19c0bd 100644 --- a/READMEs/README for Docs Install.md +++ b/READMEs/README for Docs Install.md @@ -8,10 +8,10 @@ # To Build the Documentation From Source -1. Install [Doxygen]([http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc) in **/Applications**. Core Plot requires Doxygen 1.8.6 or later. +1. Install [Doxygen]([http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc) in **/Applications**. Core Plot requires Doxygen 1.8.11 or later. -2. Install [Graphviz](http://www.graphviz.org/Download_macos.php). Core Plot requires Graphviz 2.34.0 or later. +2. Install [Graphviz](http://www.graphviz.org/Download_macos.php). Core Plot requires Graphviz 2.36.0 or later. -3. Open the **CorePlot** or **CorePlot-CocoaTouch** project in Xcode. +3. Open the **CorePlot** project in Xcode. -4. Build the "Documentation" target. \ No newline at end of file +4. Build the "Documentation-Mac" and/or "Documentation-iOS" targets. \ No newline at end of file diff --git a/READMEs/README for Static Library Install.md b/READMEs/README for Static Library Install.md index 286d1e38a..ece0cccd7 100644 --- a/READMEs/README for Static Library Install.md +++ b/READMEs/README for Static Library Install.md @@ -5,8 +5,8 @@ 2. Copy **libCorePlotCocoaTouch.a** to your Xcode project 3. Add the following flags to "Other Linker Flags" in your target build settings: - `-ObjC -all_load` + `-ObjC` -4. Add the **QuartzCore** framework to the project. +4. Add the **QuartzCore** and **Accelerate** frameworks to the project. 5. Add a `CPTGraph` to your application. See the example apps in Source Code to see how, or read the documentation. \ No newline at end of file diff --git a/documentation/changelog.markdown b/documentation/changelog.markdown index 48b9f5b5f..ed231ffeb 100644 --- a/documentation/changelog.markdown +++ b/documentation/changelog.markdown @@ -1,3 +1,68 @@ +# Release 2.3 (January 10, 2020) + +## Release Notes + +This release updates Core Plot to be compatible with Xcode 11 and Swift 5. It adds support for platform-native fonts and colors, including dynamic system colors. + +The Mac deployment target remains OS X 10.8. The iOS deployment target remains iOS 8.0 for both the framework and the static library. The tvOS deployment target remains tvOS 9.0. + +## Details +- **New**: Added support for platform native fonts (`NSFont` and `UIFont`). +- **New**: Added support for platform native colors (`NSColor` and `UIColor`), including dynamic system colors. +- **New**: Added support for variable bar widths in bar, range, and trading range plots. +- **Changed**: Updated the Core Plot project to prefer the new Xcode build system introduced with Xcode 9. +- **Changed**: Updated all framework and example code to be compatible with Xcode 11 and the latest SDKs on all platforms. +- **Changed**: Updated all Swift example apps to Swift 5. +- **Changed**: Added arm64e as a valid build architecture on iOS. +- **Changed**: Miscellaneous bug fixes and cleanup. +- **Removed**: Removed DTrace probing to support Xcode's New Build System. +- **Removed**: Removed docset generation. Docsets are no longer supported under Xcode 9.3. +- **Removed**: Removed the AAPLot and StockPlot example apps because the Yahoo finance API that both relied for data is no longer available. + + + +# Release 2.2 (September 18, 2016) + +## Release Notes + +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. Core Plot no longer requires the Accelerate framework. + +## 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. +- **Removed**: Removed the dependency on the Accelerate framework. + + + +# Release 2.1 (April 16, 2016) + +## Release Notes + +This release adds a tvOS framework and removes the deprecated `CorePlot-CocoaTouch.xcodeproj` project file. All Core Plot build targets for Mac, iOS, tvOS, and the documentation are in the `CorePlot.xcodeproj` project file. Annotated type definitions (e.g., `CPTNumberArray`) were changed to exclude the pointer star ("*") so they can be used interchangeably with class names. + +Curved scatter plots received several improvements. This release adds options to use Catmull-Rom and Hermite cubic splines to draw curved scatter plot lines. When a Hermite spline is used to draw a monotonic data series, the curved line will be monotonic as well. Plot spaces have new methods to scale the plot space to fit entire plots. + +The Mac deployment target has increased to OS X 10.8. The iOS deployment target remains iOS 6.0 for the static library and iOS 8.0 for the framework. The tvOS deployment target is tvOS 9.0. + +## Details +- **New**: Increased the Mac deployment target to OS X 10.8. +- **New**: Added a tvOS framework. +- **New**: Added an option to anchor alternating band fills to a specific starting value. +- **New**: Added support for animating `NSNumber` properties with `CPTAnimation`. +- **New**: Added support for `NSSecureCoding`. +- **New**: Added an option to draw legend swatches to the left or right side of the title. +- **New**: Added options to use Catmull-Rom and Hermite cubic splines to draw curved scatter plot lines. +- **New**: Added a method to automatically scale the plot space to fit the entire plot. +- **Changed**: Changed the annotated type definitions to exclude the pointer star ("*"). +- **Changed**: Miscellaneous bug fixes and cleanup. +- **Removed**: Removed the deprecated `CorePlot-CocoaTouch.xcodeproj` project file. + + + # Release 2.0 (October 4, 2015) ## Release Notes diff --git a/documentation/doxygen/doxygen touch.config b/documentation/doxygen/doxygen touch.config index a510a9239..01d4c0b2d 100644 --- a/documentation/doxygen/doxygen touch.config +++ b/documentation/doxygen/doxygen touch.config @@ -1,4 +1,4 @@ -# Doxyfile 1.8.10 +# Doxyfile 1.8.14 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -20,8 +20,8 @@ # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -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 macOS, 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 @@ -226,7 +226,8 @@ TAB_SIZE = 4 # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. ALIASES = "YES=@ref YES" \ "NO=@ref NO" \ @@ -312,6 +313,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 @@ -337,7 +347,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -708,7 +718,7 @@ LAYOUT_FILE = "$(SOURCE_ROOT)/../documentation/doxygen/DoxygenLayout. # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -758,6 +768,12 @@ WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = YES +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated @@ -791,7 +807,7 @@ INPUT = "$(SOURCE_ROOT)/CorePlot-CocoaTouch.h" \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. @@ -808,8 +824,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, *.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 = @@ -899,6 +915,10 @@ IMAGE_PATH = "$(SOURCE_ROOT)/../documentation/" # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. INPUT_FILTER = @@ -908,6 +928,10 @@ INPUT_FILTER = # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. FILTER_PATTERNS = @@ -992,7 +1016,7 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: @@ -1025,7 +1049,7 @@ VERBATIM_HEADERS = YES # rich C++ code for which doxygen's built-in parser lacks the necessary type # information. # Note: The availability of this option depends on whether or not doxygen was -# compiled with the --with-libclang option. +# generated with the -Duse-libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO @@ -1038,6 +1062,17 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files +# were built. This is equivalent to specifying the "-p" option to a clang tool, +# such as clang-check. These options will then be passed to the parser. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: 0. + +CLANG_COMPILATION_DATABASE_PATH = 0 + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1157,7 +1192,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1193,6 +1228,17 @@ HTML_COLORSTYLE_GAMMA = 80 HTML_TIMESTAMP = NO +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1216,12 +1262,12 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1337,7 +1383,7 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1345,8 +1391,7 @@ QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1354,23 +1399,21 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = @@ -1463,7 +1506,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1475,7 +1518,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1502,8 +1545,8 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://www.mathjax.org/mathjax @@ -1564,7 +1607,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1577,7 +1620,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1764,12 +1807,20 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BIB_STYLE = plain +# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_TIMESTAMP = NO + #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -1939,9 +1990,9 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO @@ -2042,9 +2093,17 @@ INCLUDE_FILE_PATTERNS = # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. PREDEFINED = TARGET_OS_IPHONE, \ - TARGET_IPHONE_SIMULATOR, \ - "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type" \ - "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type" + 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_CLOSED_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 @@ -2366,6 +2425,11 @@ DIAFILE_DIRS = PLANTUML_JAR_PATH = +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. diff --git a/documentation/doxygen/doxygen-cocoa-tags.xml b/documentation/doxygen/doxygen-cocoa-tags.xml index e34cb8fe6..1578dd526 100644 --- a/documentation/doxygen/doxygen-cocoa-tags.xml +++ b/documentation/doxygen/doxygen-cocoa-tags.xml @@ -529,6 +529,15 @@ NSFastEnumeration-p NSMutableCopying-p + + NSSecureCoding + https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSSecureCoding_Protocol_Ref/ + + BOOL + supportsSecureCoding: + //apple_ref/occ/intfcm/NSSecureCoding/supportsSecureCoding + + NSString https://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html @@ -749,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 @@ -851,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 46faf7b7d..1de3c13d3 100644 --- a/documentation/doxygen/doxygen-cocoa-touch-tags.xml +++ b/documentation/doxygen/doxygen-cocoa-touch-tags.xml @@ -463,6 +463,15 @@ https://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIResponder_Class/Reference/Reference.html#//apple_ref/occ/cl/UIResponder NSObject + + NSSecureCoding + https://developer.apple.com/library/ios/documentation/Foundation/Reference/NSSecureCoding_Protocol_Ref/ + + BOOL + supportsSecureCoding: + //apple_ref/occ/intfcm/NSSecureCoding/supportsSecureCoding + + NSString https://developer.apple.com/library/ios/#documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html @@ -678,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 @@ -779,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 @@ -945,4 +999,4 @@ //apple_ref/c/tdef/NSZone - \ No newline at end of file + diff --git a/documentation/doxygen/doxygen.config b/documentation/doxygen/doxygen.config index 297937e81..46ed09de4 100644 --- a/documentation/doxygen/doxygen.config +++ b/documentation/doxygen/doxygen.config @@ -1,4 +1,4 @@ -# Doxyfile 1.8.10 +# Doxyfile 1.8.14 # This file describes the settings to be used by the documentation system # doxygen (www.doxygen.org) for a project. @@ -20,8 +20,8 @@ # This tag specifies the encoding used for all characters in the config file # that follow. The default is UTF-8 which is also the encoding used for all text # before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. +# built into libc) for the transcoding. See +# https://www.gnu.org/software/libiconv/ for the list of possible encodings. # The default value is: UTF-8. DOXYFILE_ENCODING = UTF-8 @@ -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 (Mac OS)" +PROJECT_NAME = "Core Plot (macOS)" # 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 macOS, 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 @@ -226,7 +226,8 @@ TAB_SIZE = 4 # will allow you to put the command \sideeffect (or @sideeffect) in the # documentation, which will result in a user-defined paragraph with heading # "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. +# newlines (in the resulting output). You can put ^^ in the value part of an +# alias to insert a newline as if a physical newline was in the original file. ALIASES = "YES=@ref YES" \ "NO=@ref NO" \ @@ -312,6 +313,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 @@ -337,7 +347,7 @@ BUILTIN_STL_SUPPORT = NO CPP_CLI_SUPPORT = NO # Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen +# https://www.riverbankcomputing.com/software/sip/intro) sources only. Doxygen # will parse them like normal C++ but will assume all classes use public instead # of private inheritance when no explicit protection keyword is present. # The default value is: NO. @@ -708,7 +718,7 @@ LAYOUT_FILE = "$(SOURCE_ROOT)/../documentation/doxygen/DoxygenLayout. # The CITE_BIB_FILES tag can be used to specify one or more bib files containing # the reference definitions. This must be a list of .bib files. The .bib # extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. +# to be installed. See also https://en.wikipedia.org/wiki/BibTeX for more info. # For LaTeX the style of the bibliography can be controlled using # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. @@ -758,6 +768,12 @@ WARN_IF_DOC_ERROR = YES WARN_NO_PARAMDOC = YES +# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when +# a warning is encountered. +# The default value is: NO. + +WARN_AS_ERROR = NO + # The WARN_FORMAT tag determines the format of the warning messages that doxygen # can produce. The string should contain the $file, $line, and $text tags, which # will be replaced by the file and line number from which the warning originated @@ -791,7 +807,7 @@ INPUT = "$(SOURCE_ROOT)/CorePlot.h" \ # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of +# documentation (see: https://www.gnu.org/software/libiconv/) for the list of # possible encodings. # The default value is: UTF-8. @@ -808,8 +824,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, *.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 = @@ -899,6 +915,10 @@ IMAGE_PATH = "$(SOURCE_ROOT)/../documentation/" # Note that the filter must not add or remove lines; it is applied before the # code is scanned, but not when the output code is generated. If lines are added # or removed, the anchors will not be placed correctly. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. INPUT_FILTER = @@ -908,6 +928,10 @@ INPUT_FILTER = # (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how # filters are used. If the FILTER_PATTERNS tag is empty or if none of the # patterns match the file name, INPUT_FILTER is applied. +# +# Note that for custom extensions or not directly supported extensions you also +# need to set EXTENSION_MAPPING for the extension otherwise the files are not +# properly processed by doxygen. FILTER_PATTERNS = @@ -992,7 +1016,7 @@ SOURCE_TOOLTIPS = YES # If the USE_HTAGS tag is set to YES then the references to source code will # point to the HTML generated by the htags(1) tool instead of doxygen built-in # source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version +# (see https://www.gnu.org/software/global/global.html). You will need version # 4.8.6 or higher. # # To use it do the following: @@ -1025,7 +1049,7 @@ VERBATIM_HEADERS = YES # rich C++ code for which doxygen's built-in parser lacks the necessary type # information. # Note: The availability of this option depends on whether or not doxygen was -# compiled with the --with-libclang option. +# generated with the -Duse-libclang=ON option for CMake. # The default value is: NO. CLANG_ASSISTED_PARSING = NO @@ -1038,6 +1062,17 @@ CLANG_ASSISTED_PARSING = NO CLANG_OPTIONS = +# If clang assisted parsing is enabled you can provide the clang parser with the +# path to the compilation database (see: +# http://clang.llvm.org/docs/HowToSetupToolingForLLVM.html) used when the files +# were built. This is equivalent to specifying the "-p" option to a clang tool, +# such as clang-check. These options will then be passed to the parser. +# Note: The availability of this option depends on whether or not doxygen was +# generated with the -Duse-libclang=ON option for CMake. +# The default value is: 0. + +CLANG_COMPILATION_DATABASE_PATH = 0 + #--------------------------------------------------------------------------- # Configuration options related to the alphabetical class index #--------------------------------------------------------------------------- @@ -1157,7 +1192,7 @@ HTML_EXTRA_FILES = # The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen # will adjust the colors in the style sheet and background images according to # this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value +# https://en.wikipedia.org/wiki/Hue for more information. For instance the value # 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 # purple, and 360 is red again. # Minimum value: 0, maximum value: 359, default value: 220. @@ -1193,6 +1228,17 @@ HTML_COLORSTYLE_GAMMA = 80 HTML_TIMESTAMP = NO +# If the HTML_DYNAMIC_MENUS tag is set to YES then the generated HTML +# documentation will contain a main index with vertical navigation menus that +# are dynamically created via Javascript. If disabled, the navigation index will +# consists of multiple levels of tabs that are statically embedded in every HTML +# page. Disable this option to support browsers that do not have Javascript, +# like the Qt help browser. +# The default value is: YES. +# This tag requires that the tag GENERATE_HTML is set to YES. + +HTML_DYNAMIC_MENUS = YES + # If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML # documentation will contain sections that can be hidden and shown after the # page has loaded. @@ -1216,12 +1262,12 @@ HTML_INDEX_NUM_ENTRIES = 100 # If the GENERATE_DOCSET tag is set to YES, additional index files will be # generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with +# environment (see: https://developer.apple.com/tools/xcode/), introduced with # OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a # Makefile in the HTML output directory. Running make will produce the docset in # that directory and running make install will install the docset in # ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html +# startup. See https://developer.apple.com/tools/creatingdocsetswithdoxygen.html # for more information. # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. @@ -1337,7 +1383,7 @@ QCH_FILE = # The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help # Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). +# (see: http://doc.qt.io/qt-4.8/qthelpproject.html#namespace). # The default value is: org.doxygen.Project. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1345,8 +1391,7 @@ QHP_NAMESPACE = # The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt # Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). +# Folders (see: http://doc.qt.io/qt-4.8/qthelpproject.html#virtual-folders). # The default value is: doc. # This tag requires that the tag GENERATE_QHP is set to YES. @@ -1354,23 +1399,21 @@ QHP_VIRTUAL_FOLDER = doc # If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom # filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_NAME = # The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the # custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). +# Filters (see: http://doc.qt.io/qt-4.8/qthelpproject.html#custom-filters). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_CUST_FILTER_ATTRS = # The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this # project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). +# http://doc.qt.io/qt-4.8/qthelpproject.html#filter-attributes). # This tag requires that the tag GENERATE_QHP is set to YES. QHP_SECT_FILTER_ATTRS = @@ -1463,7 +1506,7 @@ EXT_LINKS_IN_WINDOW = NO FORMULA_FONTSIZE = 10 -# Use the FORMULA_TRANPARENT tag to determine whether or not the images +# Use the FORMULA_TRANSPARENT tag to determine whether or not the images # generated for formulas are transparent PNGs. Transparent PNGs are not # supported properly for IE 6.0, but are supported on all modern browsers. # @@ -1475,7 +1518,7 @@ FORMULA_FONTSIZE = 10 FORMULA_TRANSPARENT = YES # Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering +# https://www.mathjax.org) which uses client side Javascript for the rendering # instead of using pre-rendered bitmaps. Use this if you do not have LaTeX # installed or if you want to formulas look prettier in the HTML output. When # enabled you may also need to install MathJax separately and configure the path @@ -1502,8 +1545,8 @@ MATHJAX_FORMAT = HTML-CSS # MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax # Content Delivery Network so you can quickly see the result without installing # MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. +# MathJax from https://www.mathjax.org before deployment. +# The default value is: https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/. # This tag requires that the tag USE_MATHJAX is set to YES. MATHJAX_RELPATH = http://www.mathjax.org/mathjax @@ -1564,7 +1607,7 @@ SERVER_BASED_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). +# Xapian (see: https://xapian.org/). # # See the section "External Indexing and Searching" for details. # The default value is: NO. @@ -1577,7 +1620,7 @@ EXTERNAL_SEARCH = NO # # Doxygen ships with an example indexer (doxyindexer) and search engine # (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and +# Xapian (see: https://xapian.org/). See the section "External Indexing and # Searching" for details. # This tag requires that the tag SEARCHENGINE is set to YES. @@ -1764,12 +1807,20 @@ LATEX_SOURCE_CODE = NO # The LATEX_BIB_STYLE tag can be used to specify the style to use for the # bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. +# https://en.wikipedia.org/wiki/BibTeX and \cite for more info. # The default value is: plain. # This tag requires that the tag GENERATE_LATEX is set to YES. LATEX_BIB_STYLE = plain +# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated +# page will contain the date and time when the page was generated. Setting this +# to NO can help when comparing the output of multiple runs. +# The default value is: NO. +# This tag requires that the tag GENERATE_LATEX is set to YES. + +LATEX_TIMESTAMP = NO + #--------------------------------------------------------------------------- # Configuration options related to the RTF output #--------------------------------------------------------------------------- @@ -1939,9 +1990,9 @@ DOCBOOK_PROGRAMLISTING = NO #--------------------------------------------------------------------------- # If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. +# AutoGen Definitions (see http://autogen.sourceforge.net/) file that captures +# the structure of the code including all documentation. Note that this feature +# is still experimental and incomplete at the moment. # The default value is: NO. GENERATE_AUTOGEN_DEF = NO @@ -2041,8 +2092,15 @@ 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_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type" \ - "NS_OPTIONS(_type,_name):=enum _name : _type _name; enum _name : _type" +PREDEFINED = "NS_DESIGNATED_INITIALIZER:= " \ + "NS_RETURNS_INNER_POINTER:= " \ + "NS_ENUM(_type,_name):=enum _name : _type _name; enum _name : _type " \ + "NS_CLOSED_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 @@ -2364,6 +2422,11 @@ DIAFILE_DIRS = PLANTUML_JAR_PATH = +# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a +# configuration file for plantuml. + +PLANTUML_CFG_FILE = + # When using plantuml, the specified paths are searched for files specified by # the !include statement in a plantuml block. diff --git a/examples/AAPLot/AAPL.plist b/examples/AAPLot/AAPL.plist deleted file mode 100644 index 482c91dc4..000000000 --- a/examples/AAPLot/AAPL.plist +++ /dev/null @@ -1,963 +0,0 @@ - - - - - endDate - 2009-06-19T02:55:22Z - financialData - - - adjClose - 144.67 - close - 144.67 - date - 2009-06-05T04:00:00Z - high - 146.4 - low - 143.21 - open - 145.31 - volume - 22585700 - - - adjClose - 143.74 - close - 143.74 - date - 2009-06-04T04:00:00Z - high - 144.18 - low - 140.04 - open - 140.13 - volume - 19537200 - - - adjClose - 140.95 - close - 140.95 - date - 2009-06-03T04:00:00Z - high - 141.11 - low - 139.07 - open - 140 - volume - 20171800 - - - adjClose - 139.49 - close - 139.49 - date - 2009-06-02T04:00:00Z - high - 141.34 - low - 138.35 - open - 138.99 - volume - 16199500 - - - adjClose - 139.35 - close - 139.35 - date - 2009-06-01T04:00:00Z - high - 139.99 - low - 136 - open - 136.47 - volume - 16160700 - - - adjClose - 135.81 - close - 135.81 - date - 2009-05-29T04:00:00Z - high - 135.9 - low - 133.85 - open - 135.39 - volume - 16304800 - - - adjClose - 135.07 - close - 135.07 - date - 2009-05-28T04:00:00Z - high - 135.39 - low - 132.03 - open - 133.45 - volume - 17397200 - - - adjClose - 133.05 - close - 133.05 - date - 2009-05-27T04:00:00Z - high - 134.98 - low - 130.91 - open - 131.78 - volume - 23086500 - - - adjClose - 130.78 - close - 130.78 - date - 2009-05-26T04:00:00Z - high - 130.83 - low - 124.55 - open - 124.76 - volume - 22692300 - - - adjClose - 122.5 - close - 122.5 - date - 2009-05-22T04:00:00Z - high - 124.18 - low - 121.75 - open - 124.05 - volume - 10642800 - - - adjClose - 124.18 - close - 124.18 - date - 2009-05-21T04:00:00Z - high - 126.78 - low - 122.89 - open - 125.15 - volume - 14569500 - - - adjClose - 125.87 - close - 125.87 - date - 2009-05-20T04:00:00Z - high - 129.21 - low - 125.3 - open - 127.63 - volume - 13878000 - - - adjClose - 127.45 - close - 127.45 - date - 2009-05-19T04:00:00Z - high - 129.31 - low - 125.74 - open - 126.82 - volume - 13300800 - - - adjClose - 126.65 - close - 126.65 - date - 2009-05-18T04:00:00Z - high - 126.7 - low - 121.57 - open - 123.73 - volume - 16387200 - - - adjClose - 122.42 - close - 122.42 - date - 2009-05-15T04:00:00Z - high - 124.62 - low - 121.61 - open - 122.32 - volume - 13127400 - - - adjClose - 122.95 - close - 122.95 - date - 2009-05-14T04:00:00Z - high - 123.53 - low - 119.7 - open - 119.78 - volume - 15993800 - - - adjClose - 119.49 - close - 119.49 - date - 2009-05-13T04:00:00Z - high - 124.02 - low - 119.38 - open - 123.21 - volume - 21284700 - - - adjClose - 124.42 - close - 124.42 - date - 2009-05-12T04:00:00Z - high - 129.71 - low - 123.25 - open - 129.56 - volume - 21767200 - - - adjClose - 129.57 - close - 129.57 - date - 2009-05-11T04:00:00Z - high - 130.96 - low - 127.12 - open - 127.37 - volume - 14452100 - - - adjClose - 129.19 - close - 129.19 - date - 2009-05-08T04:00:00Z - high - 131.23 - low - 126.26 - open - 129.04 - volume - 16713000 - - - adjClose - 129.06 - close - 129.06 - date - 2009-05-07T04:00:00Z - high - 132.39 - low - 127.9 - open - 132.33 - volume - 18992000 - - - adjClose - 132.5 - close - 132.5 - date - 2009-05-06T04:00:00Z - high - 133.5 - low - 130.22 - open - 133.33 - volume - 16912100 - - - adjClose - 132.71 - close - 132.71 - date - 2009-05-05T04:00:00Z - high - 132.86 - low - 131.12 - open - 131.75 - volume - 14223400 - - - adjClose - 132.07 - close - 132.07 - date - 2009-05-04T04:00:00Z - high - 132.25 - low - 127.68 - open - 128.24 - volume - 21762800 - - - adjClose - 127.24 - close - 127.24 - date - 2009-05-01T04:00:00Z - high - 127.95 - low - 125.8 - open - 125.8 - volume - 14197000 - - - adjClose - 125.83 - close - 125.83 - date - 2009-04-30T04:00:00Z - high - 127 - low - 124.92 - open - 126.22 - volume - 17803200 - - - adjClose - 125.14 - close - 125.14 - date - 2009-04-29T04:00:00Z - high - 126.85 - low - 123.83 - open - 124.85 - volume - 16361100 - - - adjClose - 123.9 - close - 123.9 - date - 2009-04-28T04:00:00Z - high - 126.21 - low - 123.26 - open - 123.35 - volume - 16280600 - - - adjClose - 124.73 - close - 124.73 - date - 2009-04-27T04:00:00Z - high - 125 - low - 122.66 - open - 122.9 - volume - 17167500 - - - adjClose - 123.9 - close - 123.9 - date - 2009-04-24T04:00:00Z - high - 125.14 - low - 122.97 - open - 124.64 - volume - 19313000 - - - adjClose - 125.4 - close - 125.4 - date - 2009-04-23T04:00:00Z - high - 127.2 - low - 123.51 - open - 126.62 - volume - 33755600 - - - adjClose - 121.51 - close - 121.51 - date - 2009-04-22T04:00:00Z - high - 125.35 - low - 121.2 - open - 122.63 - volume - 33527400 - - - adjClose - 121.76 - close - 121.76 - date - 2009-04-21T04:00:00Z - high - 122.14 - low - 118.6 - open - 118.89 - volume - 16810200 - - - adjClose - 120.5 - close - 120.5 - date - 2009-04-20T04:00:00Z - high - 122.99 - low - 119.16 - open - 121.73 - volume - 16659500 - - - adjClose - 123.42 - close - 123.42 - date - 2009-04-17T04:00:00Z - high - 124.25 - low - 120.25 - open - 121.18 - volume - 17767700 - - - adjClose - 121.45 - close - 121.45 - date - 2009-04-16T04:00:00Z - high - 123.15 - low - 118.79 - open - 119.19 - volume - 21194500 - - - adjClose - 117.64 - close - 117.64 - date - 2009-04-15T04:00:00Z - high - 118.25 - low - 115.76 - open - 117.2 - volume - 14745800 - - - adjClose - 118.31 - close - 118.31 - date - 2009-04-14T04:00:00Z - high - 120.17 - low - 117.25 - open - 119.57 - volume - 16236500 - - - adjClose - 120.22 - close - 120.22 - date - 2009-04-13T04:00:00Z - high - 120.98 - low - 119 - open - 120.01 - volume - 13901300 - - - adjClose - 119.57 - close - 119.57 - date - 2009-04-09T04:00:00Z - high - 120 - low - 117.96 - open - 118.42 - volume - 18955600 - - - adjClose - 116.32 - close - 116.32 - date - 2009-04-08T04:00:00Z - high - 116.79 - low - 114.58 - open - 115.43 - volume - 16272500 - - - adjClose - 115 - close - 115 - date - 2009-04-07T04:00:00Z - high - 116.67 - low - 114.19 - open - 116.53 - volume - 19163600 - - - adjClose - 118.45 - close - 118.45 - date - 2009-04-06T04:00:00Z - high - 118.75 - low - 113.28 - open - 114.94 - volume - 23502300 - - - adjClose - 115.99 - close - 115.99 - date - 2009-04-03T04:00:00Z - high - 116.13 - low - 113.52 - open - 114.19 - volume - 22722900 - - - adjClose - 112.71 - close - 112.71 - date - 2009-04-02T04:00:00Z - high - 114.75 - low - 109.78 - open - 110.14 - volume - 29013100 - - - adjClose - 108.69 - close - 108.69 - date - 2009-04-01T04:00:00Z - high - 109 - low - 103.89 - open - 104.09 - volume - 21049000 - - - adjClose - 105.12 - close - 105.12 - date - 2009-03-31T04:00:00Z - high - 107.45 - low - 105 - open - 105.45 - volume - 20338500 - - - adjClose - 104.49 - close - 104.49 - date - 2009-03-30T04:00:00Z - high - 105.01 - low - 102.61 - open - 104.51 - volume - 17957000 - - - adjClose - 106.85 - close - 106.85 - date - 2009-03-27T04:00:00Z - high - 108.53 - low - 106.4 - open - 108.23 - volume - 17602600 - - - adjClose - 109.87 - close - 109.87 - date - 2009-03-26T04:00:00Z - high - 109.98 - low - 107.58 - open - 107.83 - volume - 22009000 - - - adjClose - 106.49 - close - 106.49 - date - 2009-03-25T04:00:00Z - high - 108.36 - low - 103.86 - open - 107.58 - volume - 23093500 - - - adjClose - 106.5 - close - 106.5 - date - 2009-03-24T04:00:00Z - high - 109.44 - low - 105.39 - open - 106.36 - volume - 22879000 - - - adjClose - 107.66 - close - 107.66 - date - 2009-03-23T04:00:00Z - high - 108.16 - low - 101.75 - open - 102.71 - volume - 23799900 - - - adjClose - 101.59 - close - 101.59 - date - 2009-03-20T04:00:00Z - high - 103.11 - low - 100.57 - open - 102.09 - volume - 24842400 - - - adjClose - 101.62 - close - 101.62 - date - 2009-03-19T04:00:00Z - high - 103.2 - low - 100.25 - open - 101.85 - volume - 17863600 - - - adjClose - 101.52 - close - 101.52 - date - 2009-03-18T04:00:00Z - high - 103.48 - low - 99.72 - open - 99.91 - volume - 28429900 - - - adjClose - 99.66 - close - 99.66 - date - 2009-03-17T04:00:00Z - high - 99.69 - low - 95.07000000000001 - open - 95.23999999999999 - volume - 28094500 - - - adjClose - 95.42 - close - 95.42 - date - 2009-03-16T04:00:00Z - high - 97.39 - low - 94.17999999999999 - open - 96.53 - volume - 28473000 - - - adjClose - 95.92999999999999 - close - 95.92999999999999 - date - 2009-03-13T04:00:00Z - high - 97.2 - low - 95.01000000000001 - open - 96.3 - volume - 21470300 - - - overallHigh - 146.4 - overallLow - 94.17999999999999 - startDate - 2009-03-27T02:55:22Z - symbol - AAPL - - diff --git a/examples/AAPLot/AAPLot.png b/examples/AAPLot/AAPLot.png deleted file mode 100644 index c218d2598..000000000 Binary files a/examples/AAPLot/AAPLot.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot.xcodeproj/project.pbxproj b/examples/AAPLot/AAPLot.xcodeproj/project.pbxproj deleted file mode 100644 index c1936d1b5..000000000 --- a/examples/AAPLot/AAPLot.xcodeproj/project.pbxproj +++ /dev/null @@ -1,497 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 47; - objects = { - -/* Begin PBXBuildFile section */ - 073703570FE5193C006D46AD /* APFinancialData.m in Sources */ = {isa = PBXBuildFile; fileRef = 073703560FE5193C006D46AD /* APFinancialData.m */; }; - 073703B10FE51E6C006D46AD /* NSDateFormatterExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 073703B00FE51E6C006D46AD /* NSDateFormatterExtensions.m */; }; - 1D3623260D0F684500981E51 /* AAPLotAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AAPLotAppDelegate.m */; }; - 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 280E754D0DD40C5E005A515E /* FlipsideView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754A0DD40C5E005A515E /* FlipsideView.xib */; }; - 280E754E0DD40C5E005A515E /* MainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754B0DD40C5E005A515E /* MainView.xib */; }; - 280E754F0DD40C5E005A515E /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 280E754C0DD40C5E005A515E /* MainWindow.xib */; }; - 288765590DF743DE002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765580DF743DE002DB57D /* CoreGraphics.framework */; }; - 289233A60DB2D0840083E9F9 /* FlipsideView.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233A30DB2D0840083E9F9 /* FlipsideView.m */; }; - 289233AE0DB2D0DB0083E9F9 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233A90DB2D0DB0083E9F9 /* MainViewController.m */; }; - 289233AF0DB2D0DB0083E9F9 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233AB0DB2D0DB0083E9F9 /* RootViewController.m */; }; - 289233B00DB2D0DB0083E9F9 /* FlipsideViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 289233AD0DB2D0DB0083E9F9 /* FlipsideViewController.m */; }; - AB8989470FE0309E00FDC37F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB8989460FE0309E00FDC37F /* QuartzCore.framework */; }; - AB8F94580FDEFA1500E61485 /* APYahooDataPuller.m in Sources */ = {isa = PBXBuildFile; fileRef = AB8F94570FDEFA1500E61485 /* APYahooDataPuller.m */; }; - ABA5345E0FEB40CE0046A8DA /* AAPL.plist in Resources */ = {isa = PBXBuildFile; fileRef = ABA5345D0FEB40CE0046A8DA /* AAPL.plist */; }; - C3CD283017DE9B9C008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD282F17DE9B9C008EED1E /* Accelerate.framework */; }; - C3D3936C19FD6B1D00148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3936B19FD6B1D00148319 /* Images.xcassets */; }; - C3D414941A7D838200B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D414911A7D836300B6F5D6 /* libCorePlot-CocoaTouch.a */; }; - C3F0BA3919EC9F6300F7CB47 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3F0BA3819EC9F6300F7CB47 /* Launch Screen.xib */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - C3D414881A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = CorePlot; - }; - C3D4148A1A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0730F600109492D800E95162; - remoteInfo = UnitTests; - }; - C3D4148C1A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09781A46185200D45436; - remoteInfo = CorePlot_iOS; - }; - C3D4148E1A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09821A46185300D45436; - remoteInfo = CorePlot_iOSTests; - }; - C3D414901A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09BA1A4619A900D45436; - remoteInfo = "CorePlot-CocoaTouch"; - }; - C3D414921A7D836300B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09C41A4619A900D45436; - remoteInfo = "CorePlot-CocoaTouchTests"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 073703550FE5193C006D46AD /* APFinancialData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APFinancialData.h; sourceTree = ""; }; - 073703560FE5193C006D46AD /* APFinancialData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = APFinancialData.m; sourceTree = ""; }; - 073703AF0FE51E6C006D46AD /* NSDateFormatterExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSDateFormatterExtensions.h; sourceTree = ""; }; - 073703B00FE51E6C006D46AD /* NSDateFormatterExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSDateFormatterExtensions.m; sourceTree = ""; }; - 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D3623240D0F684500981E51 /* AAPLotAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AAPLotAppDelegate.h; sourceTree = ""; }; - 1D3623250D0F684500981E51 /* AAPLotAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AAPLotAppDelegate.m; sourceTree = ""; }; - 1D6058910D05DD3D006BFB54 /* AAPLot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = AAPLot.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 280E754A0DD40C5E005A515E /* FlipsideView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = FlipsideView.xib; sourceTree = ""; }; - 280E754B0DD40C5E005A515E /* MainView.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainView.xib; sourceTree = ""; }; - 280E754C0DD40C5E005A515E /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = MainWindow.xib; path = ../MainWindow.xib; sourceTree = ""; }; - 288765580DF743DE002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 289233A20DB2D0840083E9F9 /* FlipsideView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlipsideView.h; path = Classes/FlipsideView.h; sourceTree = ""; }; - 289233A30DB2D0840083E9F9 /* FlipsideView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlipsideView.m; path = Classes/FlipsideView.m; sourceTree = ""; }; - 289233A80DB2D0DB0083E9F9 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = MainViewController.h; path = Classes/MainViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 289233A90DB2D0DB0083E9F9 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = MainViewController.m; path = Classes/MainViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - 289233AA0DB2D0DB0083E9F9 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; - 289233AB0DB2D0DB0083E9F9 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; - 289233AC0DB2D0DB0083E9F9 /* FlipsideViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FlipsideViewController.h; path = Classes/FlipsideViewController.h; sourceTree = ""; }; - 289233AD0DB2D0DB0083E9F9 /* FlipsideViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = FlipsideViewController.m; path = Classes/FlipsideViewController.m; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 32CA4F630368D1EE00C91783 /* AAPLot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AAPLot_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - AB8989460FE0309E00FDC37F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - AB8F94560FDEFA1500E61485 /* APYahooDataPuller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = APYahooDataPuller.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - AB8F94570FDEFA1500E61485 /* APYahooDataPuller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = APYahooDataPuller.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - ABA5345D0FEB40CE0046A8DA /* AAPL.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = AAPL.plist; sourceTree = ""; }; - C3CA9B5819E1F79B008DF7A3 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; - C3CD282F17DE9B9C008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; - C3D3936B19FD6B1D00148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = AAPLot/Images.xcassets; sourceTree = ""; }; - C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = ""; }; - C3F0BA3819EC9F6300F7CB47 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, - 288765590DF743DE002DB57D /* CoreGraphics.framework in Frameworks */, - AB8989470FE0309E00FDC37F /* QuartzCore.framework in Frameworks */, - C3CD283017DE9B9C008EED1E /* Accelerate.framework in Frameworks */, - C3D414941A7D838200B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 0737034D0FE518E7006D46AD /* Data Acquisition */ = { - isa = PBXGroup; - children = ( - AB8F94560FDEFA1500E61485 /* APYahooDataPuller.h */, - AB8F94570FDEFA1500E61485 /* APYahooDataPuller.m */, - 073703550FE5193C006D46AD /* APFinancialData.h */, - 073703560FE5193C006D46AD /* APFinancialData.m */, - 073703AF0FE51E6C006D46AD /* NSDateFormatterExtensions.h */, - 073703B00FE51E6C006D46AD /* NSDateFormatterExtensions.m */, - ); - name = "Data Acquisition"; - sourceTree = ""; - }; - 080E96DDFE201D6D7F000001 /* Application Controllers */ = { - isa = PBXGroup; - children = ( - 280E754C0DD40C5E005A515E /* MainWindow.xib */, - 1D3623240D0F684500981E51 /* AAPLotAppDelegate.h */, - 1D3623250D0F684500981E51 /* AAPLotAppDelegate.m */, - 289233AA0DB2D0DB0083E9F9 /* RootViewController.h */, - 289233AB0DB2D0DB0083E9F9 /* RootViewController.m */, - ); - name = "Application Controllers"; - path = Classes; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 1D6058910D05DD3D006BFB54 /* AAPLot.app */, - ); - name = Products; - sourceTree = ""; - }; - 281C6CD70DB2D82200F60ACC /* Flipside View */ = { - isa = PBXGroup; - children = ( - 280E754A0DD40C5E005A515E /* FlipsideView.xib */, - 289233A20DB2D0840083E9F9 /* FlipsideView.h */, - 289233A30DB2D0840083E9F9 /* FlipsideView.m */, - 289233AC0DB2D0DB0083E9F9 /* FlipsideViewController.h */, - 289233AD0DB2D0DB0083E9F9 /* FlipsideViewController.m */, - ); - name = "Flipside View"; - sourceTree = ""; - }; - 289233A00DB2D0730083E9F9 /* Main View */ = { - isa = PBXGroup; - children = ( - 280E754B0DD40C5E005A515E /* MainView.xib */, - 289233A80DB2D0DB0083E9F9 /* MainViewController.h */, - 289233A90DB2D0DB0083E9F9 /* MainViewController.m */, - C3F0BA3819EC9F6300F7CB47 /* Launch Screen.xib */, - ); - name = "Main View"; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { - isa = PBXGroup; - children = ( - C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */, - 289233A00DB2D0730083E9F9 /* Main View */, - 0737034D0FE518E7006D46AD /* Data Acquisition */, - 281C6CD70DB2D82200F60ACC /* Flipside View */, - 080E96DDFE201D6D7F000001 /* Application Controllers */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - ); - indentWidth = 4; - name = CustomTemplate; - sourceTree = ""; - tabWidth = 4; - usesTabs = 0; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32CA4F630368D1EE00C91783 /* AAPLot_Prefix.pch */, - 29B97316FDCFA39411CA2CEA /* main.m */, - C3CA9B5819E1F79B008DF7A3 /* CorePlotWarnings.xcconfig */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - C3D3936B19FD6B1D00148319 /* Images.xcassets */, - ABA5345D0FEB40CE0046A8DA /* AAPL.plist */, - 8D1107310486CEB800E47090 /* Info.plist */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - AB8989460FE0309E00FDC37F /* QuartzCore.framework */, - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, - 1D30AB110D05D00D00671497 /* Foundation.framework */, - 288765580DF743DE002DB57D /* CoreGraphics.framework */, - C3CD282F17DE9B9C008EED1E /* Accelerate.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - C3D4147D1A7D836300B6F5D6 /* Products */ = { - isa = PBXGroup; - children = ( - C3D414891A7D836300B6F5D6 /* CorePlot.framework */, - C3D4148B1A7D836300B6F5D6 /* UnitTests.xctest */, - C3D4148D1A7D836300B6F5D6 /* CorePlot.framework */, - C3D4148F1A7D836300B6F5D6 /* UnitTests iOS.xctest */, - C3D414911A7D836300B6F5D6 /* libCorePlot-CocoaTouch.a */, - C3D414931A7D836300B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* AAPLot */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "AAPLot" */; - buildPhases = ( - 1D60588D0D05DD3D006BFB54 /* Resources */, - 1D60588E0D05DD3D006BFB54 /* Sources */, - 1D60588F0D05DD3D006BFB54 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = AAPLot; - productName = AAPLot; - productReference = 1D6058910D05DD3D006BFB54 /* AAPLot.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0700; - TargetAttributes = { - 1D6058900D05DD3D006BFB54 = { - DevelopmentTeam = 28ZA45DE7D; - }; - }; - }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "AAPLot" */; - compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - en, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = C3D4147D1A7D836300B6F5D6 /* Products */; - ProjectRef = C3D4147C1A7D836300B6F5D6 /* CorePlot.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 1D6058900D05DD3D006BFB54 /* AAPLot */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - C3D414891A7D836300B6F5D6 /* CorePlot.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CorePlot.framework; - remoteRef = C3D414881A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D4148B1A7D836300B6F5D6 /* UnitTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = UnitTests.xctest; - remoteRef = C3D4148A1A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D4148D1A7D836300B6F5D6 /* CorePlot.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CorePlot.framework; - remoteRef = C3D4148C1A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D4148F1A7D836300B6F5D6 /* UnitTests iOS.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "UnitTests iOS.xctest"; - remoteRef = C3D4148E1A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414911A7D836300B6F5D6 /* libCorePlot-CocoaTouch.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libCorePlot-CocoaTouch.a"; - remoteRef = C3D414901A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414931A7D836300B6F5D6 /* CorePlot-CocoaTouchTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "CorePlot-CocoaTouchTests.xctest"; - remoteRef = C3D414921A7D836300B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 1D60588D0D05DD3D006BFB54 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 280E754D0DD40C5E005A515E /* FlipsideView.xib in Resources */, - 280E754E0DD40C5E005A515E /* MainView.xib in Resources */, - C3D3936C19FD6B1D00148319 /* Images.xcassets in Resources */, - 280E754F0DD40C5E005A515E /* MainWindow.xib in Resources */, - ABA5345E0FEB40CE0046A8DA /* AAPL.plist in Resources */, - C3F0BA3919EC9F6300F7CB47 /* Launch Screen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 1D60588E0D05DD3D006BFB54 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589B0D05DD56006BFB54 /* main.m in Sources */, - 1D3623260D0F684500981E51 /* AAPLotAppDelegate.m in Sources */, - 289233A60DB2D0840083E9F9 /* FlipsideView.m in Sources */, - 289233AE0DB2D0DB0083E9F9 /* MainViewController.m in Sources */, - 289233AF0DB2D0DB0083E9F9 /* RootViewController.m in Sources */, - 289233B00DB2D0DB0083E9F9 /* FlipsideViewController.m in Sources */, - AB8F94580FDEFA1500E61485 /* APYahooDataPuller.m in Sources */, - 073703570FE5193C006D46AD /* APFinancialData.m in Sources */, - 073703B10FE51E6C006D46AD /* NSDateFormatterExtensions.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1D6058940D05DD3E006BFB54 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C3CA9B5819E1F79B008DF7A3 /* CorePlotWarnings.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = AAPLot_Prefix.pch; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - OTHER_LDFLAGS = ( - "-ObjC", - "-all_load", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = AAPLot; - }; - name = Debug; - }; - 1D6058950D05DD3E006BFB54 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C3CA9B5819E1F79B008DF7A3 /* CorePlotWarnings.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - COPY_PHASE_STRIP = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = AAPLot_Prefix.pch; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; - OTHER_LDFLAGS = ( - "-ObjC", - "-all_load", - ); - PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = AAPLot; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = iphoneos; - SYMROOT = "$(SRCROOT)/../../build"; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "AAPLot" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1D6058940D05DD3E006BFB54 /* Debug */, - 1D6058950D05DD3E006BFB54 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "AAPLot" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/examples/AAPLot/AAPLot.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/AAPLot/AAPLot.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 0044da799..000000000 --- a/examples/AAPLot/AAPLot.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 340f2376e..000000000 --- a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "images" : [ - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-Small.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-Small@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-Spotlight-40@2x.png", - "scale" : "2x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon.png", - "scale" : "1x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png deleted file mode 100644 index 489d32b6c..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png deleted file mode 100644 index e732a791c..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small.png deleted file mode 100644 index 0310c42a8..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png deleted file mode 100644 index 8170f07ca..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png deleted file mode 100644 index c7fba2304..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon.png deleted file mode 100644 index ca3d9f35b..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon@2x.png b/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon@2x.png deleted file mode 100644 index d67508c07..000000000 Binary files a/examples/AAPLot/AAPLot/Images.xcassets/AppIcon.appiconset/Icon@2x.png and /dev/null differ diff --git a/examples/AAPLot/AAPLot_Prefix.pch b/examples/AAPLot/AAPLot_Prefix.pch deleted file mode 100644 index dc5f28052..000000000 --- a/examples/AAPLot/AAPLot_Prefix.pch +++ /dev/null @@ -1,10 +0,0 @@ -// -// Prefix header for all source files of the 'AAPLot' target in the 'AAPLot' project -// - -#define DEBUG (1) - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/examples/AAPLot/APFinancialData.h b/examples/AAPLot/APFinancialData.h deleted file mode 100644 index 6ede21860..000000000 --- a/examples/AAPLot/APFinancialData.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "CorePlot-CocoaTouch.h" - -@interface NSDictionary(APFinancialData) - -+(CPTDictionary)dictionaryWithCSVLine:(NSString *)csvLine; - -@end diff --git a/examples/AAPLot/APFinancialData.m b/examples/AAPLot/APFinancialData.m deleted file mode 100644 index 9598755e5..000000000 --- a/examples/AAPLot/APFinancialData.m +++ /dev/null @@ -1,34 +0,0 @@ -#import "APFinancialData.h" -#import "NSDateFormatterExtensions.h" - -@implementation NSDictionary(APFinancialData) - -+(CPTDictionary)dictionaryWithCSVLine:(NSString *)csvLine -{ - CPTStringArray csvChunks = [csvLine componentsSeparatedByString:@","]; - - CPTMutableDictionary csvDict = [NSMutableDictionary dictionaryWithCapacity:7]; - - // Date,Open,High,Low,Close,Volume,Adj Close - // 2009-06-08,143.82,144.23,139.43,143.85,33255400,143.85 - NSDate *theDate = [[NSDateFormatter csvDateFormatter] dateFromString:csvChunks[0]]; - - csvDict[@"date"] = theDate; - NSDecimalNumber *theOpen = [NSDecimalNumber decimalNumberWithString:csvChunks[1]]; - csvDict[@"open"] = theOpen; - NSDecimalNumber *theHigh = [NSDecimalNumber decimalNumberWithString:csvChunks[2]]; - csvDict[@"high"] = theHigh; - NSDecimalNumber *theLow = [NSDecimalNumber decimalNumberWithString:csvChunks[3]]; - csvDict[@"low"] = theLow; - NSDecimalNumber *theClose = [NSDecimalNumber decimalNumberWithString:csvChunks[4]]; - csvDict[@"close"] = theClose; - NSDecimalNumber *theVolume = [NSDecimalNumber decimalNumberWithString:csvChunks[5]]; - csvDict[@"volume"] = theVolume; - NSDecimalNumber *theAdjClose = [NSDecimalNumber decimalNumberWithString:csvChunks[6]]; - csvDict[@"adjClose"] = theAdjClose; - - //non-mutable autoreleased dict - return [NSDictionary dictionaryWithDictionary:csvDict]; -} - -@end diff --git a/examples/AAPLot/APYahooDataPuller.h b/examples/AAPLot/APYahooDataPuller.h deleted file mode 100644 index 123d6e07c..000000000 --- a/examples/AAPLot/APYahooDataPuller.h +++ /dev/null @@ -1,33 +0,0 @@ -#import "APFinancialData.h" - -@class APYahooDataPuller; - -typedef NSArray *CPTFinancialDataArray; - -@protocol APYahooDataPullerDelegate - -@optional - --(void)dataPullerDidFinishFetch:(APYahooDataPuller *)dp; - -@end - -@interface APYahooDataPuller : NSObject - -@property (nonatomic, readwrite, weak) id delegate; -@property (nonatomic, readwrite, copy) NSString *symbol; -@property (nonatomic, readwrite, strong) NSDate *startDate; -@property (nonatomic, readwrite, strong) NSDate *endDate; -@property (nonatomic, readwrite, copy) NSString *targetSymbol; -@property (nonatomic, readwrite, strong) NSDate *targetStartDate; -@property (nonatomic, readwrite, strong) NSDate *targetEndDate; -@property (nonatomic, readonly, strong) CPTFinancialDataArray financialData; -@property (nonatomic, readonly, strong) NSDecimalNumber *overallHigh; -@property (nonatomic, readonly, strong) NSDecimalNumber *overallLow; -@property (nonatomic, readonly, strong) NSDecimalNumber *overallVolumeHigh; -@property (nonatomic, readonly, strong) NSDecimalNumber *overallVolumeLow; -@property (nonatomic, readonly, assign) BOOL loadingData; - --(instancetype)initWithTargetSymbol:(NSString *)aSymbol targetStartDate:(NSDate *)aStartDate targetEndDate:(NSDate *)anEndDate; - -@end diff --git a/examples/AAPLot/APYahooDataPuller.m b/examples/AAPLot/APYahooDataPuller.m deleted file mode 100644 index 4f6c5d3c2..000000000 --- a/examples/AAPLot/APYahooDataPuller.m +++ /dev/null @@ -1,384 +0,0 @@ -#import "APFinancialData.h" -#import "APYahooDataPuller.h" - -@interface APYahooDataPuller() - -@property (nonatomic, readwrite, copy) NSString *csvString; - -@property (nonatomic, readwrite, strong) NSDecimalNumber *overallHigh; -@property (nonatomic, readwrite, strong) NSDecimalNumber *overallLow; -@property (nonatomic, readwrite, strong) NSDecimalNumber *overallVolumeHigh; -@property (nonatomic, readwrite, strong) NSDecimalNumber *overallVolumeLow; -@property (nonatomic, readwrite, strong) CPTFinancialDataArray financialData; - -@property (nonatomic, readwrite, assign) BOOL loadingData; -@property (nonatomic, readwrite, strong) NSMutableData *receivedData; -@property (nonatomic, readwrite, strong) NSURLConnection *connection; - --(void)fetch; --(NSString *)URL; --(void)notifyPulledData; --(void)parseCSVAndPopulate; - -NSTimeInterval timeIntervalForNumberOfWeeks(double numberOfWeeks); - -@end - -#pragma mark - - -NSTimeInterval timeIntervalForNumberOfWeeks(double numberOfWeeks) -{ - NSTimeInterval seconds = fabs(60.0 * 60.0 * 24.0 * 7.0 * numberOfWeeks); - - return seconds; -} - -@implementation APYahooDataPuller - -@synthesize symbol; -@synthesize startDate; -@synthesize endDate; -@synthesize targetStartDate; -@synthesize targetEndDate; -@synthesize targetSymbol; -@synthesize overallLow; -@synthesize overallHigh; -@synthesize overallVolumeHigh; -@synthesize overallVolumeLow; -@synthesize csvString; -@synthesize financialData; - -@synthesize receivedData; -@synthesize connection; -@synthesize loadingData; - -@synthesize delegate; - --(void)setDelegate:(id)aDelegate -{ - if ( delegate != aDelegate ) { - delegate = aDelegate; - if ( self.financialData.count > 0 ) { - [self notifyPulledData]; //loads cached data onto UI - } - } -} - --(CPTDictionary)plistRep -{ - CPTMutableDictionary rep = [NSMutableDictionary dictionaryWithCapacity:7]; - - rep[@"symbol"] = [self symbol]; - rep[@"startDate"] = [self startDate]; - rep[@"endDate"] = [self endDate]; - rep[@"overallHigh"] = [self overallHigh]; - rep[@"overallLow"] = [self overallLow]; - rep[@"overallVolumeHigh"] = [self overallVolumeHigh]; - rep[@"overallVolumeLow"] = [self overallVolumeLow]; - rep[@"financialData"] = [self financialData]; - - return [NSDictionary dictionaryWithDictionary:rep]; -} - --(BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag -{ - NSLog(@"writeToFile:%@", path); - BOOL success = [[self plistRep] writeToFile:path atomically:flag]; - return success; -} - --(instancetype)initWithDictionary:(CPTDictionary)aDict targetSymbol:(NSString *)aSymbol targetStartDate:(NSDate *)aStartDate targetEndDate:(NSDate *)anEndDate -{ - self = [super init]; - if ( self != nil ) { - self.symbol = aDict[@"symbol"]; - self.startDate = aDict[@"startDate"]; - self.overallLow = [NSDecimalNumber decimalNumberWithDecimal:[aDict[@"overallLow"] decimalValue]]; - self.overallHigh = [NSDecimalNumber decimalNumberWithDecimal:[aDict[@"overallHigh"] decimalValue]]; - self.endDate = aDict[@"endDate"]; - self.financialData = aDict[@"financialData"]; - - self.targetSymbol = aSymbol; - self.targetStartDate = aStartDate; - self.targetEndDate = anEndDate; - self.csvString = @""; - [self performSelector:@selector(fetch) withObject:nil afterDelay:0.01]; - } - return self; -} - --(NSString *)pathForSymbol:(NSString *)aSymbol -{ - CPTStringArray paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = paths[0]; - NSString *docPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", aSymbol]]; - - return docPath; -} - --(NSString *)faultTolerantPathForSymbol:(NSString *)aSymbol -{ - NSString *docPath = [self pathForSymbol:aSymbol]; - - if ( ![[NSFileManager defaultManager] fileExistsAtPath:docPath] ) { - //if there isn't one in the user's documents directory, see if we ship with this data - docPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", aSymbol]]; - } - return docPath; -} - -//Always returns *something* --(CPTDictionary)dictionaryForSymbol:(NSString *)aSymbol -{ - NSString *path = [self faultTolerantPathForSymbol:aSymbol]; - - CPTMutableDictionary localPlistDict = [NSMutableDictionary dictionaryWithContentsOfFile:path]; - - return localPlistDict; -} - --(instancetype)initWithTargetSymbol:(NSString *)aSymbol targetStartDate:(NSDate *)aStartDate targetEndDate:(NSDate *)anEndDate -{ - CPTDictionary cachedDictionary = [self dictionaryForSymbol:aSymbol]; - - if ( nil != cachedDictionary ) { - return [self initWithDictionary:cachedDictionary targetSymbol:aSymbol targetStartDate:aStartDate targetEndDate:anEndDate]; - } - - CPTMutableDictionary rep = [NSMutableDictionary dictionaryWithCapacity:7]; - rep[@"symbol"] = aSymbol; - rep[@"startDate"] = aStartDate; - rep[@"endDate"] = anEndDate; - rep[@"overallHigh"] = [NSDecimalNumber notANumber]; - rep[@"overallLow"] = [NSDecimalNumber notANumber]; - rep[@"financialData"] = @[]; - - return [self initWithDictionary:rep targetSymbol:aSymbol targetStartDate:aStartDate targetEndDate:anEndDate]; -} - --(instancetype)init -{ - NSTimeInterval secondsAgo = -timeIntervalForNumberOfWeeks(14.0); //12 weeks ago - NSDate *start = [NSDate dateWithTimeIntervalSinceNow:secondsAgo]; - - NSDate *end = [NSDate date]; - - return [self initWithTargetSymbol:@"GOOG" targetStartDate:start targetEndDate:end]; -} - --(void)dealloc -{ - delegate = nil; -} - -// http://www.goldb.org/ystockquote.html --(NSString *)URL -{ - unsigned int unitFlags = NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitYear; - - NSCalendar *gregorian = [[NSCalendar alloc] - initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - - NSDateComponents *compsStart = [gregorian components:unitFlags fromDate:self.targetStartDate]; - NSDateComponents *compsEnd = [gregorian components:unitFlags fromDate:self.targetEndDate]; - - NSString *url = [NSString stringWithFormat:@"http://ichart.yahoo.com/table.csv?s=%@&", [self targetSymbol]]; - - url = [url stringByAppendingFormat:@"a=%ld&", (long)[compsStart month] - 1]; - url = [url stringByAppendingFormat:@"b=%ld&", (long)[compsStart day]]; - url = [url stringByAppendingFormat:@"c=%ld&", (long)[compsStart year]]; - - url = [url stringByAppendingFormat:@"d=%ld&", (long)[compsEnd month] - 1]; - url = [url stringByAppendingFormat:@"e=%ld&", (long)[compsEnd day]]; - url = [url stringByAppendingFormat:@"f=%ld&", (long)[compsEnd year]]; - url = [url stringByAppendingString:@"g=d&"]; - - url = [url stringByAppendingString:@"ignore=.csv"]; - url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - return url; -} - --(void)notifyPulledData -{ - id theDelegate = self.delegate; - - if ( [theDelegate respondsToSelector:@selector(dataPullerDidFinishFetch:)] ) { - [theDelegate performSelector:@selector(dataPullerDidFinishFetch:) withObject:self]; - } -} - -#pragma mark - -#pragma mark Downloading of data - --(BOOL)shouldDownload -{ - BOOL shouldDownload = YES; - - return shouldDownload; -} - --(void)fetch -{ - if ( self.loadingData ) { - return; - } - - if ( [self shouldDownload] ) { - self.loadingData = YES; - NSString *urlString = [self URL]; - NSLog(@"URL = %@", urlString); - NSURL *url = [NSURL URLWithString:urlString]; - NSURLRequest *theRequest = [NSURLRequest requestWithURL:url - cachePolicy:NSURLRequestUseProtocolCachePolicy - timeoutInterval:60.0]; - - // create the connection with the request - // and start loading the data - self.connection = [NSURLConnection connectionWithRequest:theRequest delegate:self]; - if ( self.connection ) { - self.receivedData = [NSMutableData data]; - } - else { - //TODO: Inform the user that the download could not be started - self.loadingData = NO; - } - } -} - --(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data -{ - // append the new data to the receivedData - [self.receivedData appendData:data]; -} - --(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response -{ - // this method is called when the server has determined that it - // has enough information to create the NSURLResponse - // it can be called multiple times, for example in the case of a - // redirect, so each time we reset the data. - [self.receivedData setLength:0]; -} - --(void)cancelDownload -{ - if ( self.loadingData ) { - [self.connection cancel]; - self.loadingData = NO; - - self.receivedData = nil; - self.connection = nil; - } -} - --(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error -{ - self.loadingData = NO; - self.receivedData = nil; - self.connection = nil; - NSLog(@"err = %@", [error localizedDescription]); - //TODO:report err -} - --(void)connectionDidFinishLoading:(NSURLConnection *)connection -{ - self.loadingData = NO; - self.connection = nil; - - NSString *csv = [[NSString alloc] initWithData:self.receivedData encoding:NSUTF8StringEncoding]; - self.csvString = csv; - - self.receivedData = nil; - [self parseCSVAndPopulate]; - - //see if we need to write to file - CPTDictionary dictionaryForSymbol = [self dictionaryForSymbol:self.symbol]; - - BOOL sameSymbol = NO; - NSString *dictSymbol = dictionaryForSymbol[@"symbol"]; - if ( dictSymbol ) { - sameSymbol = [[self symbol] isEqualToString:dictSymbol]; - } - - BOOL sameStart = NO; - NSDate *dictStart = dictionaryForSymbol[@"startDate"]; - if ( dictStart ) { - sameStart = ([[self startDate] compare:dictStart] != NSOrderedSame); - } - - BOOL sameEnd = NO; - NSDate *dictEnd = dictionaryForSymbol[@"endDate"]; - if ( dictEnd ) { - sameEnd = ([[self startDate] compare:dictEnd] != NSOrderedSame); - } - - if ( !sameSymbol || !sameStart || !sameEnd ) { - [self writeToFile:[self pathForSymbol:self.symbol] atomically:YES]; - } - else { - NSLog(@"Not writing to file -- No Need, its data is fresh."); - } -} - --(void)parseCSVAndPopulate -{ - CPTStringArray csvLines = [self.csvString componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - - NSMutableArray *newFinancials = [NSMutableArray arrayWithCapacity:[csvLines count]]; - CPTDictionary currentFinancial = nil; - NSString *line = nil; - - self.overallHigh = [NSDecimalNumber notANumber]; - self.overallLow = [NSDecimalNumber notANumber]; - self.overallVolumeHigh = [NSDecimalNumber notANumber]; - self.overallVolumeLow = [NSDecimalNumber notANumber]; - - for ( NSUInteger i = 1; i < [csvLines count] - 1; i++ ) { - line = csvLines[i]; - currentFinancial = [NSDictionary dictionaryWithCSVLine:line]; - [newFinancials addObject:currentFinancial]; - - NSDecimalNumber *high = currentFinancial[@"high"]; - NSDecimalNumber *low = currentFinancial[@"low"]; - NSDecimalNumber *volume = currentFinancial[@"volume"]; - - if ( [self.overallHigh isEqual:[NSDecimalNumber notANumber]] ) { - self.overallHigh = high; - } - - if ( [self.overallLow isEqual:[NSDecimalNumber notANumber]] ) { - self.overallLow = low; - } - - if ( [low compare:self.overallLow] == NSOrderedAscending ) { - self.overallLow = low; - } - if ( [high compare:self.overallHigh] == NSOrderedDescending ) { - self.overallHigh = high; - } - - if ( [self.overallVolumeHigh isEqual:[NSDecimalNumber notANumber]] ) { - self.overallVolumeHigh = volume; - } - - if ( [self.overallVolumeLow isEqual:[NSDecimalNumber notANumber]] ) { - self.overallVolumeLow = volume; - } - - if ( [volume compare:self.overallVolumeLow] == NSOrderedAscending ) { - self.overallVolumeLow = volume; - } - - if ( [volume compare:self.overallVolumeHigh] == NSOrderedDescending ) { - self.overallVolumeHigh = volume; - } - } - self.startDate = self.targetStartDate; - self.endDate = self.targetEndDate; - self.symbol = self.targetSymbol; - - [self setFinancialData:[NSArray arrayWithArray:newFinancials]]; - [self notifyPulledData]; -} - -@end diff --git a/examples/AAPLot/Classes/AAPLotAppDelegate.h b/examples/AAPLot/Classes/AAPLotAppDelegate.h deleted file mode 100644 index c55b9f096..000000000 --- a/examples/AAPLot/Classes/AAPLotAppDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// AAPLotAppDelegate.h -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import - -@class RootViewController; - -@interface AAPLotAppDelegate : NSObject - -@property (nonatomic, strong) IBOutlet UIWindow *window; -@property (nonatomic, strong) IBOutlet RootViewController *rootViewController; - -@end diff --git a/examples/AAPLot/Classes/AAPLotAppDelegate.m b/examples/AAPLot/Classes/AAPLotAppDelegate.m deleted file mode 100644 index bc20eff63..000000000 --- a/examples/AAPLot/Classes/AAPLotAppDelegate.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// AAPLotAppDelegate.m -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import "AAPLotAppDelegate.h" -#import "RootViewController.h" - -@implementation AAPLotAppDelegate - -@synthesize window; -@synthesize rootViewController; - --(void)applicationDidFinishLaunching:(UIApplication *)application -{ - self.window.rootViewController = self.rootViewController; - [self.window makeKeyAndVisible]; -} - -@end diff --git a/examples/AAPLot/Classes/FlipsideView.h b/examples/AAPLot/Classes/FlipsideView.h deleted file mode 100644 index 9a407b402..000000000 --- a/examples/AAPLot/Classes/FlipsideView.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// FlipsideView.h -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import - -@interface FlipsideView : UIView { -} - -@end diff --git a/examples/AAPLot/Classes/FlipsideView.m b/examples/AAPLot/Classes/FlipsideView.m deleted file mode 100644 index 21d8c4f55..000000000 --- a/examples/AAPLot/Classes/FlipsideView.m +++ /dev/null @@ -1,26 +0,0 @@ -// -// FlipsideView.m -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import "FlipsideView.h" - -@implementation FlipsideView - --(instancetype)initWithFrame:(CGRect)frame -{ - if ( (self = [super initWithFrame:frame]) ) { - // Initialization code - } - return self; -} - --(void)drawRect:(CGRect)rect -{ - // Drawing code -} - -@end diff --git a/examples/AAPLot/Classes/FlipsideViewController.h b/examples/AAPLot/Classes/FlipsideViewController.h deleted file mode 100644 index ed84c2d55..000000000 --- a/examples/AAPLot/Classes/FlipsideViewController.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// FlipsideViewController.h -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import - -@interface FlipsideViewController : UIViewController { -} - -@end diff --git a/examples/AAPLot/Classes/FlipsideViewController.m b/examples/AAPLot/Classes/FlipsideViewController.m deleted file mode 100644 index 727f8548e..000000000 --- a/examples/AAPLot/Classes/FlipsideViewController.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// FlipsideViewController.m -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import "FlipsideViewController.h" - -@implementation FlipsideViewController - --(void)viewDidLoad -{ - [super viewDidLoad]; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if ( [UIColor respondsToSelector:@selector(viewFlipsideBackgroundColor)] ) { - self.view.backgroundColor = [UIColor viewFlipsideBackgroundColor]; - } -#pragma clang diagnostic pop -} - -/* - * // Override to allow orientations other than the default portrait orientation. - * - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - * // Return YES for supported orientations - * return (interfaceOrientation == UIInterfaceOrientationPortrait); - * } - */ - --(void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview - // Release anything that's not essential, such as cached data -} - -@end diff --git a/examples/AAPLot/Classes/MainViewController.h b/examples/AAPLot/Classes/MainViewController.h deleted file mode 100644 index f907b8530..000000000 --- a/examples/AAPLot/Classes/MainViewController.h +++ /dev/null @@ -1,13 +0,0 @@ -#import "APYahooDataPuller.h" -#import "CorePlot-CocoaTouch.h" -#import - -@class CPTGraphHostingView; -@class APYahooDataPuller; -@class CPTXYGraph; - -@interface MainViewController : UIViewController - -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *graphHost; - -@end diff --git a/examples/AAPLot/Classes/MainViewController.m b/examples/AAPLot/Classes/MainViewController.m deleted file mode 100644 index 0a648c6ab..000000000 --- a/examples/AAPLot/Classes/MainViewController.m +++ /dev/null @@ -1,672 +0,0 @@ -#import "APFinancialData.h" -#import "APYahooDataPuller.h" -#import "MainViewController.h" - -#define ROWS_FIRST_DATA_ORDER 1 - -@interface MainViewController() - -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; -@property (nonatomic, readwrite, strong) APYahooDataPuller *datapuller; - -@end - -@implementation MainViewController - -@synthesize graph; -@synthesize datapuller; -@synthesize graphHost; - --(void)setView:(UIView *)aView -{ - [super setView:aView]; - if ( nil == aView ) { - self.graph = nil; - self.graphHost = nil; - } -} - --(void)viewDidLoad -{ - CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:self.view.bounds]; - CPTTheme *theme = [CPTTheme themeNamed:kCPTStocksTheme]; - - [newGraph applyTheme:theme]; - self.graph = newGraph; - - newGraph.paddingRight = 50.0; - newGraph.paddingLeft = 50.0; - newGraph.plotAreaFrame.masksToBorder = NO; - newGraph.plotAreaFrame.cornerRadius = 0.0; - - CPTMutableLineStyle *borderLineStyle = [CPTMutableLineStyle lineStyle]; - borderLineStyle.lineColor = [CPTColor whiteColor]; - borderLineStyle.lineWidth = 2.0; - newGraph.plotAreaFrame.borderLineStyle = borderLineStyle; - self.graphHost.hostedGraph = newGraph; - - // Axes - CPTXYAxisSet *xyAxisSet = (CPTXYAxisSet *)newGraph.axisSet; - CPTXYAxis *xAxis = xyAxisSet.xAxis; - CPTMutableLineStyle *lineStyle = [xAxis.axisLineStyle mutableCopy]; - lineStyle.lineCap = kCGLineCapButt; - xAxis.axisLineStyle = lineStyle; - xAxis.labelingPolicy = CPTAxisLabelingPolicyNone; - - CPTXYAxis *yAxis = xyAxisSet.yAxis; - yAxis.axisLineStyle = nil; - - // Line plot with gradient fill - CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] initWithFrame:newGraph.bounds]; - dataSourceLinePlot.identifier = @"Data Source Plot"; - dataSourceLinePlot.dataLineStyle = nil; - dataSourceLinePlot.dataSource = self; - dataSourceLinePlot.cachePrecision = CPTPlotCachePrecisionDouble; - [newGraph addPlot:dataSourceLinePlot]; - - CPTColor *areaColor = [CPTColor colorWithComponentRed:CPTFloat(1.0) green:CPTFloat(1.0) blue:CPTFloat(1.0) alpha:CPTFloat(0.6)]; - CPTGradient *areaGradient = [CPTGradient gradientWithBeginningColor:areaColor endingColor:[CPTColor clearColor]]; - areaGradient.angle = -90.0; - CPTFill *areaGradientFill = [CPTFill fillWithGradient:areaGradient]; - dataSourceLinePlot.areaFill = areaGradientFill; - dataSourceLinePlot.areaBaseValue = @200.0; - - areaColor = [CPTColor colorWithComponentRed:CPTFloat(0.0) green:CPTFloat(1.0) blue:CPTFloat(0.0) alpha:CPTFloat(0.6)]; - areaGradient = [CPTGradient gradientWithBeginningColor:[CPTColor clearColor] endingColor:areaColor]; - areaGradient.angle = -90.0; - areaGradientFill = [CPTFill fillWithGradient:areaGradient]; - dataSourceLinePlot.areaFill2 = areaGradientFill; - dataSourceLinePlot.areaBaseValue2 = @400.0; - - // OHLC plot - CPTMutableLineStyle *whiteLineStyle = [CPTMutableLineStyle lineStyle]; - whiteLineStyle.lineColor = [CPTColor whiteColor]; - whiteLineStyle.lineWidth = 1.0; - CPTTradingRangePlot *ohlcPlot = [[CPTTradingRangePlot alloc] initWithFrame:newGraph.bounds]; - ohlcPlot.identifier = @"OHLC"; - ohlcPlot.lineStyle = whiteLineStyle; - CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle]; - whiteTextStyle.color = [CPTColor whiteColor]; - whiteTextStyle.fontSize = 8.0; - ohlcPlot.labelTextStyle = whiteTextStyle; - ohlcPlot.labelOffset = 5.0; - ohlcPlot.stickLength = 2.0; - ohlcPlot.dataSource = self; - ohlcPlot.plotStyle = CPTTradingRangePlotStyleOHLC; - ohlcPlot.cachePrecision = CPTPlotCachePrecisionDecimal; - [newGraph addPlot:ohlcPlot]; - - // Add plot space for bar chart - CPTXYPlotSpace *volumePlotSpace = [[CPTXYPlotSpace alloc] init]; - volumePlotSpace.identifier = @"Volume Plot Space"; - [newGraph addPlotSpace:volumePlotSpace]; - - // Volume plot - CPTBarPlot *volumePlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor blackColor] horizontalBars:NO]; - volumePlot.dataSource = self; - - lineStyle = [volumePlot.lineStyle mutableCopy]; - lineStyle.lineColor = [CPTColor whiteColor]; - volumePlot.lineStyle = lineStyle; - - volumePlot.fill = nil; - volumePlot.barWidth = @1.0; - volumePlot.identifier = @"Volume Plot"; - volumePlot.cachePrecision = CPTPlotCachePrecisionDouble; - [newGraph addPlot:volumePlot toPlotSpace:volumePlotSpace]; - - // Data puller - NSDate *start = [NSDate dateWithTimeIntervalSinceNow:-60.0 * 60.0 * 24.0 * 7.0 * 12.0]; // 12 weeks ago - NSDate *end = [NSDate date]; - APYahooDataPuller *dp = [[APYahooDataPuller alloc] initWithTargetSymbol:@"AAPL" targetStartDate:start targetEndDate:end]; - [self setDatapuller:dp]; - [dp setDelegate:self]; - - [super viewDidLoad]; -} - --(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - if ( (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) ) { - } - return self; -} - -#pragma mark - -#pragma mark Plot Data Source Methods - --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot -{ - return self.datapuller.financialData.count; -} - -#if ROWS_FIRST_DATA_ORDER - --(CPTNumericData *)dataForPlot:(CPTPlot *)plot recordIndexRange:(NSRange)indexRange -{ - CPTFinancialDataArray financialData = self.datapuller.financialData; - const NSUInteger financialDataCount = financialData.count; - - const BOOL useDoubles = plot.doublePrecisionCache; - - NSUInteger numFields = plot.numberOfFields; - - if ( [plot.identifier isEqual:@"Volume Plot"] ) { - numFields = 2; - } - - NSMutableData *data = [[NSMutableData alloc] initWithLength:indexRange.length * numFields * ( useDoubles ? sizeof(double) : sizeof(NSDecimal) )]; - - const NSUInteger maxIndex = NSMaxRange(indexRange); - - if ( [plot.identifier isEqual:@"Data Source Plot"] ) { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTScatterPlotFieldX: - *nextValue++ = (double)(i + 1); - break; - - case CPTScatterPlotFieldY: - value = fData[@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTScatterPlotFieldX: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTScatterPlotFieldY: - value = fData[@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - else if ( [plot.identifier isEqual:@"Volume Plot"] ) { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTBarPlotFieldBarLocation: - *nextValue++ = (double)(i + 1); - break; - - case CPTBarPlotFieldBarTip: - value = fData[@"volume"]; - NSAssert(value, @"Volume value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTBarPlotFieldBarLocation: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTBarPlotFieldBarTip: - value = fData[@"volume"]; - NSAssert(value, @"Volume value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - else { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTTradingRangePlotFieldX: - *nextValue++ = (double)(i + 1); - break; - - case CPTTradingRangePlotFieldOpen: - value = fData[@"open"]; - NSAssert(value, @"Open value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldHigh: - value = fData[@"high"]; - NSAssert(value, @"High value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldLow: - value = fData[@"low"]; - NSAssert(value, @"Low value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldClose: - value = fData[@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = financialData[financialDataCount - i - 1]; - NSNumber *value; - - for ( NSUInteger fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - switch ( fieldEnum ) { - case CPTTradingRangePlotFieldX: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTTradingRangePlotFieldOpen: - value = fData[@"open"]; - NSAssert(value, @"Open value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldHigh: - value = fData[@"high"]; - NSAssert(value, @"High value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldLow: - value = fData[@"low"]; - NSAssert(value, @"Low value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldClose: - value = fData[@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - - CPTMutableNumericData *numericData = [CPTMutableNumericData numericDataWithData:data - dataType:(useDoubles ? plot.doubleDataType : plot.decimalDataType) - shape:@[@(indexRange.length), - @(numFields)] - dataOrder:CPTDataOrderRowsFirst]; - - return numericData; -} - -#else - --(CPTNumericData *)dataForPlot:(CPTPlot *)plot recordIndexRange:(NSRange)indexRange -{ - CPTFinancialDataArray financialData = self.datapuller.financialData; - const NSUInteger financialDataCount = financialData.count; - - const BOOL useDoubles = plot.doublePrecisionCache; - - NSUInteger numFields = plot.numberOfFields; - - if ( [plot.identifier isEqual:@"Volume Plot"] ) { - numFields = 2; - } - - NSMutableData *data = [[NSMutableData alloc] initWithLength:indexRange.length * numFields * ( useDoubles ? sizeof(double) : sizeof(NSDecimal) )]; - - const NSUInteger maxIndex = NSMaxRange(indexRange); - - if ( [plot.identifier isEqual:@"Data Source Plot"] ) { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = (CPTDictionary)[financialData objectAtIndex : financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTScatterPlotFieldX: - *nextValue++ = (double)(i + 1); - break; - - case CPTScatterPlotFieldY: - value = [fData objectForKey:@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = (CPTDictionary)[financialData objectAtIndex : financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTScatterPlotFieldX: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTScatterPlotFieldY: - value = [fData objectForKey:@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - else if ( [plot.identifier isEqual:@"Volume Plot"] ) { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = (CPTDictionary)[financialData objectAtIndex : financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTBarPlotFieldBarLocation: - *nextValue++ = (double)(i + 1); - break; - - case CPTBarPlotFieldBarTip: - value = [fData objectForKey:@"volume"]; - NSAssert(value, @"Volume value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = (CPTDictionary)[financialData objectAtIndex : financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTBarPlotFieldBarLocation: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTBarPlotFieldBarTip: - value = [fData objectForKey:@"volume"]; - NSAssert(value, @"Volume value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - else { - if ( useDoubles ) { - double *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = (CPTDictionary)[financialData objectAtIndex : financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTTradingRangePlotFieldX: - *nextValue++ = (double)(i + 1); - break; - - case CPTTradingRangePlotFieldOpen: - value = [fData objectForKey:@"open"]; - NSAssert(value, @"Open value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldHigh: - value = [fData objectForKey:@"high"]; - NSAssert(value, @"High value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldLow: - value = [fData objectForKey:@"low"]; - NSAssert(value, @"Low value was nil"); - *nextValue++ = [value doubleValue]; - break; - - case CPTTradingRangePlotFieldClose: - value = [fData objectForKey:@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value doubleValue]; - break; - - default: - break; - } - } - } - } - else { - NSDecimal *nextValue = data.mutableBytes; - - for ( int fieldEnum = 0; fieldEnum < numFields; fieldEnum++ ) { - for ( NSUInteger i = indexRange.location; i < maxIndex; i++ ) { - CPTDictionary fData = (CPTDictionary)[financialData objectAtIndex : financialDataCount - i - 1]; - NSNumber *value; - - switch ( fieldEnum ) { - case CPTTradingRangePlotFieldX: - *nextValue++ = CPTDecimalFromUnsignedInteger(i + 1); - break; - - case CPTTradingRangePlotFieldOpen: - value = [fData objectForKey:@"open"]; - NSAssert(value, @"Open value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldHigh: - value = [fData objectForKey:@"high"]; - NSAssert(value, @"High value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldLow: - value = [fData objectForKey:@"low"]; - NSAssert(value, @"Low value was nil"); - *nextValue++ = [value decimalValue]; - break; - - case CPTTradingRangePlotFieldClose: - value = [fData objectForKey:@"close"]; - NSAssert(value, @"Close value was nil"); - *nextValue++ = [value decimalValue]; - break; - - default: - break; - } - } - } - } - } - - CPTMutableNumericData *numericData = [CPTMutableNumericData numericDataWithData:data - dataType:(useDoubles ? plot.doubleDataType : plot.decimalDataType) - shape:@[@(indexRange.length), @(numFields)] - dataOrder:CPTDataOrderColumnsFirst]; - [data release]; - - return numericData; -} -#endif - --(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index -{ - if ( ![(NSString *)plot.identifier isEqualToString : @"OHLC"] ) { - return (id)[NSNull null]; // Don't show any label - } - else if ( index % 5 ) { - return (id)[NSNull null]; - } - else { - return nil; // Use default label style - } -} - --(void)dataPullerDidFinishFetch:(APYahooDataPuller *)dp -{ - static CPTAnimationOperation *animationOperation = nil; - - CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace; - CPTXYPlotSpace *volumePlotSpace = (CPTXYPlotSpace *)[self.graph plotSpaceWithIdentifier:@"Volume Plot Space"]; - - APYahooDataPuller *thePuller = self.datapuller; - - NSDecimalNumber *high = thePuller.overallHigh; - NSDecimalNumber *low = thePuller.overallLow; - NSDecimalNumber *length = [high decimalNumberBySubtracting:low]; - - NSLog(@"high = %@, low = %@, length = %@", high, low, length); - NSDecimalNumber *pricePlotSpaceDisplacementPercent = [NSDecimalNumber decimalNumberWithMantissa:33 - exponent:-2 - isNegative:NO]; - - NSDecimalNumber *lengthDisplacementValue = [length decimalNumberByMultiplyingBy:pricePlotSpaceDisplacementPercent]; - NSDecimalNumber *lowDisplayLocation = [low decimalNumberBySubtracting:lengthDisplacementValue]; - NSDecimalNumber *lengthDisplayLocation = [length decimalNumberByAdding:lengthDisplacementValue]; - - plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(thePuller.financialData.count + 1)]; - plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:lowDisplayLocation length:lengthDisplayLocation]; - - CPTScatterPlot *linePlot = (CPTScatterPlot *)[self.graph plotWithIdentifier:@"Data Source Plot"]; - linePlot.areaBaseValue = high; - linePlot.areaBaseValue2 = low; - - // Axes - CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet; - - NSDecimalNumber *overallVolumeHigh = thePuller.overallVolumeHigh; - NSDecimalNumber *overallVolumeLow = thePuller.overallVolumeLow; - NSDecimalNumber *volumeLength = [overallVolumeHigh decimalNumberBySubtracting:overallVolumeLow]; - - // make the length aka height for y 3 times more so that we get a 1/3 area covered by volume - NSDecimalNumber *volumePlotSpaceDisplacementPercent = [NSDecimalNumber decimalNumberWithMantissa:3 - exponent:0 - isNegative:NO]; - - NSDecimalNumber *volumeLengthDisplacementValue = [volumeLength decimalNumberByMultiplyingBy:volumePlotSpaceDisplacementPercent]; - NSDecimalNumber *volumeLowDisplayLocation = overallVolumeLow; - NSDecimalNumber *volumeLengthDisplayLocation = [volumeLength decimalNumberByAdding:volumeLengthDisplacementValue]; - - volumePlotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(thePuller.financialData.count + 1)]; -// volumePlotSpace.yRange = [CPTPlotRange plotRangeWithLocation:volumeLowDisplayLocation length:volumeLengthDisplayLocation]; - - if ( animationOperation ) { - [[CPTAnimation sharedInstance] removeAnimationOperation:animationOperation]; - } - - if ( volumeLowDisplayLocation && volumeLengthDisplayLocation ) { - animationOperation = [CPTAnimation animate:volumePlotSpace - property:@"yRange" - fromPlotRange:[CPTPlotRange plotRangeWithLocationDecimal:[volumeLowDisplayLocation decimalValue] - lengthDecimal:CPTDecimalMultiply( [volumeLengthDisplayLocation decimalValue], CPTDecimalFromInteger(10) )] - toPlotRange:[CPTPlotRange plotRangeWithLocation:volumeLowDisplayLocation - length:volumeLengthDisplayLocation] - duration:2.5]; - } - - axisSet.xAxis.orthogonalPosition = low; - axisSet.yAxis.majorIntervalLength = @50.0; - axisSet.yAxis.minorTicksPerInterval = 4; - axisSet.yAxis.orthogonalPosition = @1.0; - CPTPlotRangeArray exclusionRanges = @[[CPTPlotRange plotRangeWithLocation:@0.0 length:low]]; - - axisSet.yAxis.labelExclusionRanges = exclusionRanges; - - [self.graph reloadData]; -} - -@end diff --git a/examples/AAPLot/Classes/RootViewController.h b/examples/AAPLot/Classes/RootViewController.h deleted file mode 100644 index 57e4a4988..000000000 --- a/examples/AAPLot/Classes/RootViewController.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// RootViewController.h -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import - -@class MainViewController; -@class FlipsideViewController; - -@interface RootViewController : UIViewController - -@property (nonatomic, strong) IBOutlet UIButton *infoButton; -@property (nonatomic, strong) MainViewController *mainViewController; -@property (nonatomic, strong) UINavigationBar *flipsideNavigationBar; -@property (nonatomic, strong) FlipsideViewController *flipsideViewController; - --(IBAction)toggleView; - -@end diff --git a/examples/AAPLot/Classes/RootViewController.m b/examples/AAPLot/Classes/RootViewController.m deleted file mode 100644 index 120ecc7a2..000000000 --- a/examples/AAPLot/Classes/RootViewController.m +++ /dev/null @@ -1,106 +0,0 @@ -// -// RootViewController.m -// AAPLot -// -// Created by Jonathan Saggau on 6/9/09. -// Copyright Sounds Broken inc. 2009. All rights reserved. -// - -#import "FlipsideViewController.h" -#import "MainViewController.h" -#import "RootViewController.h" - -@implementation RootViewController - -@synthesize infoButton; -@synthesize flipsideNavigationBar; -@synthesize mainViewController; -@synthesize flipsideViewController; - --(void)viewDidLoad -{ - [super viewDidLoad]; - MainViewController *viewController = [[MainViewController alloc] initWithNibName:@"MainView" bundle:nil]; - self.mainViewController = viewController; - - [self.view insertSubview:self.mainViewController.view belowSubview:self.infoButton]; - self.mainViewController.view.frame = self.view.bounds; -} - --(void)loadFlipsideViewController -{ - FlipsideViewController *viewController = [[FlipsideViewController alloc] initWithNibName:@"FlipsideView" bundle:nil]; - - self.flipsideViewController = viewController; - - self.flipsideViewController.view.frame = self.view.bounds; - - // Set up the navigation bar - UINavigationBar *aNavigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0.0, 0.0, 320.0, 44.0)]; - aNavigationBar.barStyle = UIBarStyleBlackOpaque; - self.flipsideNavigationBar = aNavigationBar; - - UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone - target:self - action:@selector(toggleView)]; - UINavigationItem *navigationItem = [[UINavigationItem alloc] initWithTitle:@"AAPLot"]; - navigationItem.rightBarButtonItem = buttonItem; - [self.flipsideNavigationBar pushNavigationItem:navigationItem animated:NO]; -} - --(IBAction)toggleView -{ - /* - * This method is called when the info or Done button is pressed. - * It flips the displayed view from the main view to the flipside view and vice-versa. - */ - if ( self.flipsideViewController == nil ) { - [self loadFlipsideViewController]; - } - - UIView *mainView = self.mainViewController.view; - UIView *flipsideView = self.flipsideViewController.view; - - [UIView beginAnimations:nil context:NULL]; - [UIView setAnimationDuration:1]; - UIViewAnimationTransition transition = ([mainView superview] ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft); - [UIView setAnimationTransition:transition forView:self.view cache:YES]; - - if ( [mainView superview] != nil ) { - [self.flipsideViewController viewWillAppear:YES]; - [self.mainViewController viewWillDisappear:YES]; - [mainView removeFromSuperview]; - [self.infoButton removeFromSuperview]; - [self.view addSubview:flipsideView]; - [self.view insertSubview:self.flipsideNavigationBar aboveSubview:flipsideView]; - [self.mainViewController viewDidDisappear:YES]; - [self.flipsideViewController viewDidAppear:YES]; - } - else { - [self.mainViewController viewWillAppear:YES]; - [self.flipsideViewController viewWillDisappear:YES]; - [flipsideView removeFromSuperview]; - [self.flipsideNavigationBar removeFromSuperview]; - [self.view addSubview:mainView]; - [self.view insertSubview:self.infoButton aboveSubview:self.mainViewController.view]; - [self.flipsideViewController viewDidDisappear:YES]; - [self.mainViewController viewDidAppear:YES]; - } - [UIView commitAnimations]; -} - -/* - * // Override to allow orientations other than the default portrait orientation. - * - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - * // Return YES for supported orientations - * return (interfaceOrientation == UIInterfaceOrientationPortrait); - * } - */ - --(void)didReceiveMemoryWarning -{ - [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview - // Release anything that's not essential, such as cached data -} - -@end diff --git a/examples/AAPLot/FlipsideView.xib b/examples/AAPLot/FlipsideView.xib deleted file mode 100644 index 165ced2e7..000000000 --- a/examples/AAPLot/FlipsideView.xib +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/AAPLot/Launch Screen.xib b/examples/AAPLot/Launch Screen.xib deleted file mode 100644 index f8672842a..000000000 --- a/examples/AAPLot/Launch Screen.xib +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/AAPLot/MainView.xib b/examples/AAPLot/MainView.xib deleted file mode 100644 index e968aa1ef..000000000 --- a/examples/AAPLot/MainView.xib +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/AAPLot/MainWindow.xib b/examples/AAPLot/MainWindow.xib deleted file mode 100644 index 182fe85d1..000000000 --- a/examples/AAPLot/MainWindow.xib +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/AAPLot/NSDateFormatterExtensions.h b/examples/AAPLot/NSDateFormatterExtensions.h deleted file mode 100644 index 2deb1696c..000000000 --- a/examples/AAPLot/NSDateFormatterExtensions.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -@interface NSDateFormatter(APExtensions) - -+(NSDateFormatter *)csvDateFormatter; - -@end diff --git a/examples/AAPLot/NSDateFormatterExtensions.m b/examples/AAPLot/NSDateFormatterExtensions.m deleted file mode 100644 index 9bb5989a1..000000000 --- a/examples/AAPLot/NSDateFormatterExtensions.m +++ /dev/null @@ -1,18 +0,0 @@ -#import "NSDateFormatterExtensions.h" - -@implementation NSDateFormatter(APExtensions) - -+(NSDateFormatter *)csvDateFormatter -{ - static NSDateFormatter *df = nil; - static dispatch_once_t onceToken = 0; - - dispatch_once(&onceToken, ^{ - df = [[NSDateFormatter alloc] init]; - [df setDateFormat:@"yyyy-MM-dd"]; - }); - - return df; -} - -@end diff --git a/examples/AAPLot/main.m b/examples/AAPLot/main.m deleted file mode 100644 index 9098265c6..000000000 --- a/examples/AAPLot/main.m +++ /dev/null @@ -1,10 +0,0 @@ -#import - -int main(int argc, char *argv[]) -{ - @autoreleasepool { - int retVal = UIApplicationMain(argc, argv, nil, nil); - - return retVal; - } -} diff --git a/examples/CPTTestApp-iPad/CPTTestApp_iPad-Info.plist b/examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPad-Info.plist similarity index 95% rename from examples/CPTTestApp-iPad/CPTTestApp_iPad-Info.plist rename to examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPad-Info.plist index f0cf9adbd..65b56f8c5 100644 --- a/examples/CPTTestApp-iPad/CPTTestApp_iPad-Info.plist +++ b/examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPad-Info.plist @@ -18,6 +18,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPadViewController.xib b/examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPadViewController.xib new file mode 100644 index 000000000..03311ea1e --- /dev/null +++ b/examples/CPTTestApp-iPad/Base.lproj/CPTTestApp_iPadViewController.xib @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CPTTestApp-iPad/Launch Screen.xib b/examples/CPTTestApp-iPad/Base.lproj/Launch Screen.xib similarity index 66% rename from examples/CPTTestApp-iPad/Launch Screen.xib rename to examples/CPTTestApp-iPad/Base.lproj/Launch Screen.xib index 31b1b876d..84090add7 100644 --- a/examples/CPTTestApp-iPad/Launch Screen.xib +++ b/examples/CPTTestApp-iPad/Base.lproj/Launch Screen.xib @@ -1,8 +1,12 @@ - - + + + + + - - + + + @@ -11,14 +15,14 @@ - - + diff --git a/examples/CPTTestApp-iPad/MainWindow.xib b/examples/CPTTestApp-iPad/Base.lproj/MainWindow.xib similarity index 100% rename from examples/CPTTestApp-iPad/MainWindow.xib rename to examples/CPTTestApp-iPad/Base.lproj/MainWindow.xib diff --git a/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/project.pbxproj b/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/project.pbxproj index a41fbd14c..afd032e09 100644 --- a/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/project.pbxproj +++ b/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/project.pbxproj @@ -12,12 +12,11 @@ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; - 2899E5220DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E5210DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib */; }; - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD733E0D9D9553002E5188 /* MainWindow.xib */; }; 28D7ACF80DDB3853001CB0EB /* CPTTestApp_iPadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28D7ACF70DDB3853001CB0EB /* CPTTestApp_iPadViewController.m */; }; BC65758F116549890008F594 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC65758E116549890008F594 /* QuartzCore.framework */; }; - C34677AE19F3341700429A85 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C34677AD19F3341700429A85 /* Launch Screen.xib */; }; - C3CD283917DE9C59008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD283817DE9C59008EED1E /* Accelerate.framework */; }; + C3D0A1F520E019BF00BA2921 /* CPTTestApp_iPadViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1F720E019BF00BA2921 /* CPTTestApp_iPadViewController.xib */; }; + C3D0A20620E019CD00BA2921 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A20820E019CD00BA2921 /* MainWindow.xib */; }; + C3D0A20920E019D400BA2921 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A20B20E019D400BA2921 /* Launch Screen.xib */; }; C3D3936019FD670400148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3935F19FD670400148319 /* Images.xcassets */; }; C3D414AD1A7D844400B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D414AA1A7D843800B6F5D6 /* libCorePlot-CocoaTouch.a */; }; C3F47B6E17BF99DE0075181F /* CorePlotIcon.png in Resources */ = {isa = PBXBuildFile; fileRef = C3F47B6C17BF99DE0075181F /* CorePlotIcon.png */; }; @@ -25,6 +24,20 @@ /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + C31D01E01D10F4FF008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3D414951A7D843800B6F5D6 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C31D01E21D10F4FF008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3D414951A7D843800B6F5D6 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3D414A11A7D843800B6F5D6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C3D414951A7D843800B6F5D6 /* CorePlot.xcodeproj */; @@ -76,17 +89,17 @@ 1D6058910D05DD3D006BFB54 /* CPTTestApp-iPad.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "CPTTestApp-iPad.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 2899E5210DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = CPTTestApp_iPadViewController.xib; sourceTree = ""; }; - 28AD733E0D9D9553002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; 28D7ACF60DDB3853001CB0EB /* CPTTestApp_iPadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTTestApp_iPadViewController.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 28D7ACF70DDB3853001CB0EB /* CPTTestApp_iPadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTTestApp_iPadViewController.m; sourceTree = ""; }; + 28D7ACF70DDB3853001CB0EB /* CPTTestApp_iPadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTTestApp_iPadViewController.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* CPTTestApp_iPad_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTestApp_iPad_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* CPTTestApp_iPad-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "CPTTestApp_iPad-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; BC65758E116549890008F594 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - C34677AD19F3341700429A85 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; C36E7CC519DE1C1F00EDEACB /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C37A40E120E0320500C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CPTTestApp_iPad-Info.plist"; sourceTree = ""; }; C3CD283817DE9C59008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + C3D0A20520E019C900BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CPTTestApp_iPadViewController.xib; sourceTree = ""; }; + C3D0A20720E019CD00BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = ""; }; + C3D0A20A20E019D400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Base.lproj/Launch Screen.xib"; sourceTree = ""; }; C3D3935F19FD670400148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "CPTTestApp-iPad/Images.xcassets"; sourceTree = ""; }; C3D414951A7D843800B6F5D6 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = ""; }; C3F47B6C17BF99DE0075181F /* CorePlotIcon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CorePlotIcon.png; sourceTree = ""; }; @@ -102,7 +115,6 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, BC65758F116549890008F594 /* QuartzCore.framework in Frameworks */, - C3CD283917DE9C59008EED1E /* Accelerate.framework in Frameworks */, C3D414AD1A7D844400B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -159,12 +171,12 @@ isa = PBXGroup; children = ( C3D3935F19FD670400148319 /* Images.xcassets */, - 2899E5210DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib */, - 28AD733E0D9D9553002E5188 /* MainWindow.xib */, - C34677AD19F3341700429A85 /* Launch Screen.xib */, + C3D0A1F720E019BF00BA2921 /* CPTTestApp_iPadViewController.xib */, + C3D0A20820E019CD00BA2921 /* MainWindow.xib */, + C3D0A20B20E019D400BA2921 /* Launch Screen.xib */, C3F47B6C17BF99DE0075181F /* CorePlotIcon.png */, C3F47B6D17BF99DE0075181F /* CorePlotIcon@2x.png */, - 8D1107310486CEB800E47090 /* CPTTestApp_iPad-Info.plist */, + C37A40E220E0320500C4FF48 /* CPTTestApp_iPad-Info.plist */, ); name = Resources; sourceTree = ""; @@ -190,6 +202,8 @@ C3D414A81A7D843800B6F5D6 /* UnitTests iOS.xctest */, C3D414AA1A7D843800B6F5D6 /* libCorePlot-CocoaTouch.a */, C3D414AC1A7D843800B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, + C31D01E11D10F4FF008C1EF2 /* CorePlot.framework */, + C31D01E31D10F4FF008C1EF2 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -220,17 +234,23 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0900; + TargetAttributes = { + 1D6058900D05DD3D006BFB54 = { + DevelopmentTeam = 28ZA45DE7D; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CPTTestApp-iPad" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + ja, + en, + de, + fr, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; projectDirPath = ""; @@ -248,6 +268,20 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + C31D01E11D10F4FF008C1EF2 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C31D01E01D10F4FF008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C31D01E31D10F4FF008C1EF2 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C31D01E21D10F4FF008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3D414A21A7D843800B6F5D6 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -297,12 +331,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 28AD733F0D9D9553002E5188 /* MainWindow.xib in Resources */, - 2899E5220DE3E06400AC0155 /* CPTTestApp_iPadViewController.xib in Resources */, + C3D0A20620E019CD00BA2921 /* MainWindow.xib in Resources */, + C3D0A1F520E019BF00BA2921 /* CPTTestApp_iPadViewController.xib in Resources */, C3F47B6E17BF99DE0075181F /* CorePlotIcon.png in Resources */, C3D3936019FD670400148319 /* Images.xcassets in Resources */, C3F47B6F17BF99DE0075181F /* CorePlotIcon@2x.png in Resources */, - C34677AE19F3341700429A85 /* Launch Screen.xib in Resources */, + C3D0A20920E019D400BA2921 /* Launch Screen.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -321,6 +355,41 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + C37A40E220E0320500C4FF48 /* CPTTestApp_iPad-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40E120E0320500C4FF48 /* Base */, + ); + name = "CPTTestApp_iPad-Info.plist"; + sourceTree = ""; + }; + C3D0A1F720E019BF00BA2921 /* CPTTestApp_iPadViewController.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A20520E019C900BA2921 /* Base */, + ); + name = CPTTestApp_iPadViewController.xib; + sourceTree = ""; + }; + C3D0A20820E019CD00BA2921 /* MainWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A20720E019CD00BA2921 /* Base */, + ); + name = MainWindow.xib; + sourceTree = ""; + }; + C3D0A20B20E019D400BA2921 /* Launch Screen.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A20A20E019D400BA2921 /* Base */, + ); + name = "Launch Screen.xib"; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; @@ -333,12 +402,12 @@ CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + DEVELOPMENT_TEAM = 28ZA45DE7D; GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_iPad_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "CPTTestApp_iPad-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/CPTTestApp_iPad-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = org.CorePlot.CPTTestAppiPad; PRODUCT_NAME = "CPTTestApp-iPad"; }; @@ -355,10 +424,11 @@ CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; + DEVELOPMENT_TEAM = 28ZA45DE7D; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_iPad_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "CPTTestApp_iPad-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/CPTTestApp_iPad-Info.plist"; PRODUCT_BUNDLE_IDENTIFIER = org.CorePlot.CPTTestAppiPad; PRODUCT_NAME = "CPTTestApp-iPad"; VALIDATE_PRODUCT = YES; @@ -367,14 +437,16 @@ }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C36E7CC519DE1C1F00EDEACB /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-ObjC", @@ -383,19 +455,21 @@ SDKROOT = iphoneos; SYMROOT = "$(SRCROOT)/../../build"; TARGETED_DEVICE_FAMILY = 2; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\" \"${PROJECT_DIR}/../../framework/Source\" \"${PROJECT_DIR}/../../framework/iPhoneOnly\""; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C36E7CC519DE1C1F00EDEACB /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; OTHER_LDFLAGS = ( "-ObjC", @@ -404,7 +478,7 @@ SDKROOT = iphoneos; SYMROOT = "$(SRCROOT)/../../build"; TARGETED_DEVICE_FAMILY = 2; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\" \"${PROJECT_DIR}/../../framework/Source\" \"${PROJECT_DIR}/../../framework/iPhoneOnly\""; }; name = Release; }; diff --git a/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPad.xcscheme b/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPad.xcscheme new file mode 100644 index 000000000..8ee44490d --- /dev/null +++ b/examples/CPTTestApp-iPad/CPTTestApp-iPad.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPad.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/Contents.json index 9423e2f5b..80abb1d7e 100644 --- a/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "size" : "29x29", "idiom" : "ipad", @@ -59,6 +69,18 @@ "idiom" : "ipad", "filename" : "Icon-76@2x.png", "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-iPadPro@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "iTunesArtwork.png", + "scale" : "1x" } ], "info" : { diff --git a/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/Icon-iPadPro@2x.png b/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/Icon-iPadPro@2x.png new file mode 100644 index 000000000..594df78ef Binary files /dev/null and b/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/Icon-iPadPro@2x.png differ diff --git a/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png b/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png new file mode 100644 index 000000000..969aff8dd Binary files /dev/null and b/examples/CPTTestApp-iPad/CPTTestApp-iPad/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png differ diff --git a/examples/CPTTestApp-iPad/CPTTestApp_iPadViewController.xib b/examples/CPTTestApp-iPad/CPTTestApp_iPadViewController.xib deleted file mode 100644 index e100cb2b5..000000000 --- a/examples/CPTTestApp-iPad/CPTTestApp_iPadViewController.xib +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadAppDelegate.h b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadAppDelegate.h index 8ba37367e..728b16a7b 100644 --- a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadAppDelegate.h +++ b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadAppDelegate.h @@ -1,8 +1,8 @@ // -// CPTTestApp_iPadAppDelegate.h -// CPTTestApp-iPad +// CPTTestApp_iPadAppDelegate.h +// CPTTestApp-iPad // -// Created by Brad Larson on 4/1/2010. +// Created by Brad Larson on 4/1/2010. // #import @@ -11,7 +11,7 @@ @interface CPTTestApp_iPadAppDelegate : NSObject -@property (nonatomic, readwrite, strong) IBOutlet UIWindow *window; -@property (nonatomic, readwrite, strong) IBOutlet CPTTestApp_iPadViewController *viewController; +@property (nonatomic, readwrite, strong, nullable) IBOutlet UIWindow *window; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTTestApp_iPadViewController *viewController; @end diff --git a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadAppDelegate.m b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadAppDelegate.m index efbdfc2ac..b3c3e65b8 100644 --- a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadAppDelegate.m +++ b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadAppDelegate.m @@ -1,8 +1,8 @@ // -// CPTTestApp_iPadAppDelegate.m -// CPTTestApp-iPad +// CPTTestApp_iPadAppDelegate.m +// CPTTestApp-iPad // -// Created by Brad Larson on 4/1/2010. +// Created by Brad Larson on 4/1/2010. // #import "CPTTestApp_iPadAppDelegate.h" @@ -13,7 +13,7 @@ @implementation CPTTestApp_iPadAppDelegate @synthesize window; @synthesize viewController; --(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(CPTDictionary)launchOptions +-(BOOL)application:(nonnull UIApplication *__unused)application didFinishLaunchingWithOptions:(nullable CPTDictionary *__unused)launchOptions { self.window.rootViewController = self.viewController; [self.window makeKeyAndVisible]; diff --git a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.h b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.h index d41e34802..120d9fbf3 100644 --- a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.h +++ b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.h @@ -1,17 +1,20 @@ // -// CPTTestApp_iPadViewController.h -// CPTTestApp-iPad +// CPTTestApp_iPadViewController.h +// CPTTestApp-iPad // -// Created by Brad Larson on 4/1/2010. +// Created by Brad Larson on 4/1/2010. // #import "CorePlot-CocoaTouch.h" #import -@interface CPTTestApp_iPadViewController : UIViewController +@interface CPTTestApp_iPadViewController : UIViewController -@property (nonatomic, readwrite, strong) CPTNumberArray dataForChart; -@property (nonatomic, readwrite, strong) NSArray *dataForPlot; +@property (nonatomic, readwrite, strong, nonnull) CPTNumberArray *dataForChart; +@property (nonatomic, readwrite, strong, nonnull) NSArray *dataForPlot; // Plot construction methods -(void)constructScatterPlot; diff --git a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m index 1e92e8e73..4312843d4 100644 --- a/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m +++ b/examples/CPTTestApp-iPad/Classes/CPTTestApp_iPadViewController.m @@ -1,8 +1,8 @@ // -// CPTTestApp_iPadViewController.m -// CPTTestApp-iPad +// CPTTestApp_iPadViewController.m +// CPTTestApp-iPad // -// Created by Brad Larson on 4/1/2010. +// Created by Brad Larson on 4/1/2010. // #import "CPTTestApp_iPadViewController.h" @@ -10,15 +10,15 @@ @interface CPTTestApp_iPadViewController() -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *scatterPlotView; -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *barChartView; -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *pieChartView; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *scatterPlotView; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *barChartView; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *pieChartView; -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; -@property (nonatomic, readwrite, strong) CPTXYGraph *barChart; -@property (nonatomic, readwrite, strong) CPTXYGraph *pieGraph; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *barChart; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *pieGraph; -@property (nonatomic, readwrite, strong) CPTPieChart *piePlot; +@property (nonatomic, readwrite, strong, nonnull) CPTPieChart *piePlot; @property (nonatomic, readwrite, assign) BOOL piePlotIsRotating; @end @@ -70,36 +70,12 @@ -(void)viewDidAppear:(BOOL)animated self.piePlotIsRotating = YES; } --(void)animationDidStop:(CAAnimation *)theAnimation finished:(BOOL)flag +-(void)animationDidStop:(CAAnimation *__unused)theAnimation finished:(BOOL __unused)flag { self.piePlotIsRotating = NO; [self.piePlot performSelector:@selector(reloadData) withObject:nil afterDelay:0.4]; } --(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation -{ - if ( UIInterfaceOrientationIsLandscape(fromInterfaceOrientation) ) { - // Move the plots into place for portrait - self.scatterPlotView.frame = CGRectMake(20.0, 55.0, 728.0, 556.0); - self.barChartView.frame = CGRectMake(20.0, 644.0, 340.0, 340.0); - self.pieChartView.frame = CGRectMake(408.0, 644.0, 340.0, 340.0); - } - else { - // Move the plots into place for landscape - self.scatterPlotView.frame = CGRectMake(20.0, 51.0, 628.0, 677.0); - self.barChartView.frame = CGRectMake(684.0, 51.0, 320.0, 320.0); - self.pieChartView.frame = CGRectMake(684.0, 408.0, 320.0, 320.0); - } -} - --(void)didReceiveMemoryWarning -{ - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - - // Release any cached data, images, etc that aren't in use. -} - #pragma mark - #pragma mark Plot construction methods @@ -130,9 +106,9 @@ -(void)constructScatterPlot x.majorIntervalLength = @0.5; x.orthogonalPosition = @2.0; x.minorTicksPerInterval = 2; - CPTPlotRangeArray exclusionRanges = @[[CPTPlotRange plotRangeWithLocation:@1.99 length:@0.02], - [CPTPlotRange plotRangeWithLocation:@0.99 length:@0.02], - [CPTPlotRange plotRangeWithLocation:@2.99 length:@0.02]]; + CPTPlotRangeArray *exclusionRanges = @[[CPTPlotRange plotRangeWithLocation:@1.99 length:@0.02], + [CPTPlotRange plotRangeWithLocation:@0.99 length:@0.02], + [CPTPlotRange plotRangeWithLocation:@2.99 length:@0.02]]; x.labelExclusionRanges = exclusionRanges; CPTXYAxis *y = axisSet.yAxis; @@ -219,7 +195,7 @@ -(void)constructScatterPlot -(void)constructBarChart { - // Create barChart from theme +// Create barChart from theme CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; @@ -235,7 +211,7 @@ -(void)constructBarChart newGraph.paddingRight = 20.0; newGraph.paddingBottom = 80.0; - // Add plot space for horizontal bar charts +// Add plot space for horizontal bar charts CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@300.0]; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@16.0]; @@ -251,13 +227,13 @@ -(void)constructBarChart x.titleLocation = @7.5; x.titleOffset = 55.0; - // Define some custom labels for the data elements +// Define some custom labels for the data elements x.labelRotation = CPTFloat(M_PI_4); x.labelingPolicy = CPTAxisLabelingPolicyNone; - CPTNumberArray customTickLocations = @[@1, @5, @10, @15]; - CPTStringArray xAxisLabels = @[@"Label A", @"Label B", @"Label C", @"Label D"]; - NSUInteger labelLocation = 0; - CPTMutableAxisLabelSet customLabels = [NSMutableSet setWithCapacity:[xAxisLabels count]]; + CPTNumberArray *customTickLocations = @[@1, @5, @10, @15]; + CPTStringArray *xAxisLabels = @[@"Label A", @"Label B", @"Label C", @"Label D"]; + NSUInteger labelLocation = 0; + CPTMutableAxisLabelSet *customLabels = [NSMutableSet setWithCapacity:xAxisLabels.count]; for ( NSNumber *tickLocation in customTickLocations ) { CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText:xAxisLabels[labelLocation++] textStyle:x.labelTextStyle]; newLabel.tickLocation = tickLocation; @@ -278,7 +254,7 @@ -(void)constructBarChart y.titleOffset = 45.0; y.titleLocation = @150.0; - // First bar plot +// First bar plot CPTBarPlot *barPlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor darkGrayColor] horizontalBars:NO]; barPlot.baseValue = @0.0; barPlot.dataSource = self; @@ -286,7 +262,7 @@ -(void)constructBarChart barPlot.identifier = @"Bar Plot 1"; [newGraph addPlot:barPlot toPlotSpace:plotSpace]; - // Second bar plot +// Second bar plot barPlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor blueColor] horizontalBars:NO]; barPlot.dataSource = self; barPlot.baseValue = @0.0; @@ -299,7 +275,7 @@ -(void)constructBarChart -(void)constructPieChart { - // Create pieChart from theme +// Create pieChart from theme CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; @@ -317,14 +293,14 @@ -(void)constructPieChart newGraph.axisSet = nil; - // Prepare a radial overlay gradient for shading/gloss +// Prepare a radial overlay gradient for shading/gloss CPTGradient *overlayGradient = [[CPTGradient alloc] init]; overlayGradient.gradientType = CPTGradientTypeRadial; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:CPTFloat(0.0)] atPosition:CPTFloat(0.0)]; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:CPTFloat(0.3)] atPosition:CPTFloat(0.9)]; overlayGradient = [overlayGradient addColorStop:[[CPTColor blackColor] colorWithAlphaComponent:CPTFloat(0.7)] atPosition:CPTFloat(1.0)]; - // Add pie chart +// Add pie chart CPTPieChart *newPlot = [[CPTPieChart alloc] init]; newPlot.dataSource = self; newPlot.pieRadius = 130.0; @@ -337,14 +313,14 @@ -(void)constructPieChart [newGraph addPlot:newPlot]; self.piePlot = newPlot; - // Add some initial data +// Add some initial data self.dataForChart = @[@20.0, @30.0, @(NAN), @60.0]; } #pragma mark - #pragma mark CPTBarPlot delegate method --(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index +-(void)barPlot:(nonnull CPTBarPlot *__unused)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"barWasSelectedAtRecordIndex %lu", (unsigned long)index); } @@ -352,7 +328,7 @@ -(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { if ( [plot isKindOfClass:[CPTPieChart class]] ) { return self.dataForChart.count; @@ -365,12 +341,12 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot } } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num = nil; if ( [plot isKindOfClass:[CPTPieChart class]] ) { - if ( index >= [self.dataForChart count] ) { + if ( index >= self.dataForChart.count ) { return nil; } @@ -397,7 +373,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI num = @(NAN); } else { - num = @( (index + 1) * (index + 1) ); + num = @((index + 1) * (index + 1)); if ( [plot.identifier isEqual:@"Bar Plot 2"] ) { num = @(num.integerValue - 10); } @@ -409,10 +385,10 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI if ( index % 8 ) { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); num = self.dataForPlot[index][key]; - // Green plot gets shifted above the blue - if ( [(NSString *)plot.identifier isEqualToString : @"Green Plot"] ) { +// Green plot gets shifted above the blue + if ( [(NSString *) plot.identifier isEqualToString:@"Green Plot"] ) { if ( fieldEnum == CPTScatterPlotFieldY ) { - num = @([num doubleValue] + 1.0); + num = @(num.doubleValue + 1.0); } } } @@ -424,7 +400,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI return num; } --(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUInteger)index { if ( self.piePlotIsRotating ) { return nil; @@ -434,7 +410,7 @@ -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - whiteText = [[CPTMutableTextStyle alloc] init]; + whiteText = [[CPTMutableTextStyle alloc] init]; whiteText.color = [CPTColor whiteColor]; }); diff --git a/examples/CPTTestApp-iPad/main.m b/examples/CPTTestApp-iPad/main.m index 9ab34edf9..fa2ec758c 100644 --- a/examples/CPTTestApp-iPad/main.m +++ b/examples/CPTTestApp-iPad/main.m @@ -1,8 +1,8 @@ // -// main.m -// CPTTestApp-iPad +// main.m +// CPTTestApp-iPad // -// Created by Brad Larson on 4/1/2010. +// Created by Brad Larson on 4/1/2010. // #import diff --git a/examples/CPTTestApp-iPhone/BarChart.xib b/examples/CPTTestApp-iPhone/BarChart.xib deleted file mode 100644 index 08a16b67e..000000000 --- a/examples/CPTTestApp-iPhone/BarChart.xib +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/CPTTestApp-iPhone/Base.lproj/BarChart.xib b/examples/CPTTestApp-iPhone/Base.lproj/BarChart.xib new file mode 100644 index 000000000..646ef95c3 --- /dev/null +++ b/examples/CPTTestApp-iPhone/Base.lproj/BarChart.xib @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CPTTestApp-iPhone/Info.plist b/examples/CPTTestApp-iPhone/Base.lproj/Info.plist similarity index 95% rename from examples/CPTTestApp-iPhone/Info.plist rename to examples/CPTTestApp-iPhone/Base.lproj/Info.plist index 5e25306a4..3f5c82874 100644 --- a/examples/CPTTestApp-iPhone/Info.plist +++ b/examples/CPTTestApp-iPhone/Base.lproj/Info.plist @@ -18,6 +18,8 @@ ${PRODUCT_NAME} CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion diff --git a/examples/CPTTestApp-iPhone/Launch Screen.xib b/examples/CPTTestApp-iPhone/Base.lproj/Launch Screen.xib similarity index 66% rename from examples/CPTTestApp-iPhone/Launch Screen.xib rename to examples/CPTTestApp-iPhone/Base.lproj/Launch Screen.xib index 4529d82e3..b51d6d522 100644 --- a/examples/CPTTestApp-iPhone/Launch Screen.xib +++ b/examples/CPTTestApp-iPhone/Base.lproj/Launch Screen.xib @@ -1,8 +1,12 @@ - - + + + + + - - + + + @@ -11,14 +15,14 @@ - - + diff --git a/examples/CPTTestApp-iPhone/MainWindow.xib b/examples/CPTTestApp-iPhone/Base.lproj/MainWindow.xib similarity index 77% rename from examples/CPTTestApp-iPhone/MainWindow.xib rename to examples/CPTTestApp-iPhone/Base.lproj/MainWindow.xib index eb90ba470..19255ec6e 100644 --- a/examples/CPTTestApp-iPhone/MainWindow.xib +++ b/examples/CPTTestApp-iPhone/Base.lproj/MainWindow.xib @@ -1,7 +1,10 @@ - - + + + - + + + @@ -16,19 +19,18 @@ - - + + - - + + - - + @@ -45,6 +47,7 @@ + @@ -52,9 +55,4 @@ - - - - - diff --git a/examples/CPTTestApp-iPhone/Base.lproj/PieChart.xib b/examples/CPTTestApp-iPhone/Base.lproj/PieChart.xib new file mode 100644 index 000000000..840e4935a --- /dev/null +++ b/examples/CPTTestApp-iPhone/Base.lproj/PieChart.xib @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CPTTestApp-iPhone/ScatterPlot.xib b/examples/CPTTestApp-iPhone/Base.lproj/ScatterPlot.xib similarity index 50% rename from examples/CPTTestApp-iPhone/ScatterPlot.xib rename to examples/CPTTestApp-iPhone/Base.lproj/ScatterPlot.xib index 7e1ed2991..b1747d817 100644 --- a/examples/CPTTestApp-iPhone/ScatterPlot.xib +++ b/examples/CPTTestApp-iPhone/Base.lproj/ScatterPlot.xib @@ -1,7 +1,10 @@ - - + + + - + + + @@ -11,15 +14,10 @@ - + - - + + - - - - - diff --git a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj index cb532b83c..672347980 100644 --- a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj +++ b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/project.pbxproj @@ -9,27 +9,40 @@ /* Begin PBXBuildFile section */ 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 282CCBFE0DB6C98000C4EA27 /* BarChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = 282CCBFD0DB6C98000C4EA27 /* BarChart.xib */; }; 288765080DF74369002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765070DF74369002DB57D /* CoreGraphics.framework */; }; - 28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD73870D9D96C1002E5188 /* MainWindow.xib */; }; - BC74A34110FC418D00E7E90D /* PieChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC74A34010FC418D00E7E90D /* PieChart.xib */; }; BC8166CE1100DD00006D898E /* 16-line-chart.png in Resources */ = {isa = PBXBuildFile; fileRef = BC8166CC1100DD00006D898E /* 16-line-chart.png */; }; BC8166CF1100DD00006D898E /* 17-bar-chart.png in Resources */ = {isa = PBXBuildFile; fileRef = BC8166CD1100DD00006D898E /* 17-bar-chart.png */; }; BC8166D21100DD6F006D898E /* 62-contrast.png in Resources */ = {isa = PBXBuildFile; fileRef = BC8166D11100DD6F006D898E /* 62-contrast.png */; }; BC9B81DA0FB893F70035D8DA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC9B81D90FB893F70035D8DA /* QuartzCore.framework */; }; - BC9B84360FB8B7110035D8DA /* ScatterPlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = BC9B84350FB8B7110035D8DA /* ScatterPlot.xib */; }; - C34677B219F3345500429A85 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C34677B119F3345500429A85 /* Launch Screen.xib */; }; C359603719CE34FC005CDFB9 /* BarChartController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359603319CE34FB005CDFB9 /* BarChartController.swift */; }; C359603819CE34FC005CDFB9 /* iPhoneAppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359603419CE34FB005CDFB9 /* iPhoneAppDelegate.swift */; }; C359603919CE34FC005CDFB9 /* PieChartController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359603519CE34FB005CDFB9 /* PieChartController.swift */; }; C359603A19CE34FC005CDFB9 /* ScatterPlotController.swift in Sources */ = {isa = PBXBuildFile; fileRef = C359603619CE34FB005CDFB9 /* ScatterPlotController.swift */; }; C3B9F9D417503CDD001CCC50 /* BlueTexture.png in Resources */ = {isa = PBXBuildFile; fileRef = C3B9F9D317503CDD001CCC50 /* BlueTexture.png */; }; - C3CD283E17DE9C95008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD283D17DE9C95008EED1E /* Accelerate.framework */; }; + C3D0A20C20E019EB00BA2921 /* PieChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A20E20E019EB00BA2921 /* PieChart.xib */; }; + C3D0A21C20E019F000BA2921 /* BarChart.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A21E20E019F000BA2921 /* BarChart.xib */; }; + C3D0A21F20E019F300BA2921 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A22120E019F300BA2921 /* MainWindow.xib */; }; + C3D0A22220E019F800BA2921 /* ScatterPlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A22420E019F800BA2921 /* ScatterPlot.xib */; }; + C3D0A22520E019FF00BA2921 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A22720E019FF00BA2921 /* Launch Screen.xib */; }; C3D3936419FD671100148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3936319FD671100148319 /* Images.xcassets */; }; C3D414C61A7D847C00B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D414C31A7D846500B6F5D6 /* libCorePlot-CocoaTouch.a */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ + C31D01F11D10F506008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3D414AE1A7D846500B6F5D6 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C31D01F31D10F506008C1EF2 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = C3D414AE1A7D846500B6F5D6 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3D414BA1A7D846500B6F5D6 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C3D414AE1A7D846500B6F5D6 /* CorePlot.xcodeproj */; @@ -78,25 +91,25 @@ 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; 1D6058910D05DD3D006BFB54 /* CPTTestApp-iPhone.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "CPTTestApp-iPhone.app"; sourceTree = BUILT_PRODUCTS_DIR; }; 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 282CCBFD0DB6C98000C4EA27 /* BarChart.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = BarChart.xib; sourceTree = ""; }; 288765070DF74369002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 28AD73870D9D96C1002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - BC74A34010FC418D00E7E90D /* PieChart.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = PieChart.xib; sourceTree = ""; }; BC8166CC1100DD00006D898E /* 16-line-chart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "16-line-chart.png"; path = "GlyphishIcons/16-line-chart.png"; sourceTree = ""; }; BC8166CD1100DD00006D898E /* 17-bar-chart.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "17-bar-chart.png"; path = "GlyphishIcons/17-bar-chart.png"; sourceTree = ""; }; BC8166D11100DD6F006D898E /* 62-contrast.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "62-contrast.png"; path = "GlyphishIcons/62-contrast.png"; sourceTree = ""; }; BC9B81D90FB893F70035D8DA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - BC9B84350FB8B7110035D8DA /* ScatterPlot.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = ScatterPlot.xib; sourceTree = ""; }; - C34677B119F3345500429A85 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; C359603319CE34FB005CDFB9 /* BarChartController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarChartController.swift; sourceTree = ""; }; C359603419CE34FB005CDFB9 /* iPhoneAppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = iPhoneAppDelegate.swift; sourceTree = ""; }; C359603519CE34FB005CDFB9 /* PieChartController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PieChartController.swift; sourceTree = ""; }; C359603619CE34FB005CDFB9 /* ScatterPlotController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScatterPlotController.swift; sourceTree = ""; }; C359603B19CE352A005CDFB9 /* CPTTestApp-iPhone-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = "CPTTestApp-iPhone-Bridging-Header.h"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; + C37A40F020E0322D00C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C3B9F9D317503CDD001CCC50 /* BlueTexture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = BlueTexture.png; sourceTree = ""; }; C3C3CBDE19EA125D00A0296A /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; C3CD283D17DE9C95008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; + C3D0A22820E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PieChart.xib; sourceTree = ""; }; + C3D0A22920E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/BarChart.xib; sourceTree = ""; }; + C3D0A22A20E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainWindow.xib; sourceTree = ""; }; + C3D0A22B20E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ScatterPlot.xib; sourceTree = ""; }; + C3D0A22C20E01A0600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Base.lproj/Launch Screen.xib"; sourceTree = ""; }; C3D3936319FD671100148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "CPTTestApp-iPhone/Images.xcassets"; sourceTree = ""; }; C3D414AE1A7D846500B6F5D6 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = ""; }; /* End PBXFileReference section */ @@ -110,7 +123,6 @@ 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, 288765080DF74369002DB57D /* CoreGraphics.framework in Frameworks */, BC9B81DA0FB893F70035D8DA /* QuartzCore.framework in Frameworks */, - C3CD283E17DE9C95008EED1E /* Accelerate.framework in Frameworks */, C3D414C61A7D847C00B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -170,12 +182,12 @@ BC8166CC1100DD00006D898E /* 16-line-chart.png */, BC8166CD1100DD00006D898E /* 17-bar-chart.png */, C3B9F9D317503CDD001CCC50 /* BlueTexture.png */, - BC74A34010FC418D00E7E90D /* PieChart.xib */, - 282CCBFD0DB6C98000C4EA27 /* BarChart.xib */, - 28AD73870D9D96C1002E5188 /* MainWindow.xib */, - 8D1107310486CEB800E47090 /* Info.plist */, - BC9B84350FB8B7110035D8DA /* ScatterPlot.xib */, - C34677B119F3345500429A85 /* Launch Screen.xib */, + C3D0A22720E019FF00BA2921 /* Launch Screen.xib */, + C3D0A22120E019F300BA2921 /* MainWindow.xib */, + C3D0A22420E019F800BA2921 /* ScatterPlot.xib */, + C3D0A21E20E019F000BA2921 /* BarChart.xib */, + C3D0A20E20E019EB00BA2921 /* PieChart.xib */, + C37A40F120E0322D00C4FF48 /* Info.plist */, ); name = Resources; sourceTree = ""; @@ -201,6 +213,8 @@ C3D414C11A7D846500B6F5D6 /* UnitTests iOS.xctest */, C3D414C31A7D846500B6F5D6 /* libCorePlot-CocoaTouch.a */, C3D414C51A7D846500B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, + C31D01F21D10F506008C1EF2 /* CorePlot.framework */, + C31D01F41D10F506008C1EF2 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -232,17 +246,24 @@ isa = PBXProject; attributes = { LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 0930; + TargetAttributes = { + 1D6058900D05DD3D006BFB54 = { + DevelopmentTeam = 28ZA45DE7D; + LastSwiftMigration = 1020; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CPTTestApp-iPhone" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + fr, + de, + ja, + en, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CPTTestApp-iPhone */; projectDirPath = ""; @@ -260,6 +281,20 @@ /* End PBXProject section */ /* Begin PBXReferenceProxy section */ + C31D01F21D10F506008C1EF2 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C31D01F11D10F506008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C31D01F41D10F506008C1EF2 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C31D01F31D10F506008C1EF2 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3D414BB1A7D846500B6F5D6 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -309,12 +344,12 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - 28AD73880D9D96C1002E5188 /* MainWindow.xib in Resources */, - 282CCBFE0DB6C98000C4EA27 /* BarChart.xib in Resources */, - BC9B84360FB8B7110035D8DA /* ScatterPlot.xib in Resources */, + C3D0A21F20E019F300BA2921 /* MainWindow.xib in Resources */, + C3D0A21C20E019F000BA2921 /* BarChart.xib in Resources */, + C3D0A22220E019F800BA2921 /* ScatterPlot.xib in Resources */, C3D3936419FD671100148319 /* Images.xcassets in Resources */, - BC74A34110FC418D00E7E90D /* PieChart.xib in Resources */, - C34677B219F3345500429A85 /* Launch Screen.xib in Resources */, + C3D0A20C20E019EB00BA2921 /* PieChart.xib in Resources */, + C3D0A22520E019FF00BA2921 /* Launch Screen.xib in Resources */, BC8166CE1100DD00006D898E /* 16-line-chart.png in Resources */, BC8166CF1100DD00006D898E /* 17-bar-chart.png in Resources */, BC8166D21100DD6F006D898E /* 62-contrast.png in Resources */, @@ -338,6 +373,57 @@ }; /* End PBXSourcesBuildPhase section */ +/* Begin PBXVariantGroup section */ + C37A40F120E0322D00C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40F020E0322D00C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; + C3D0A20E20E019EB00BA2921 /* PieChart.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22820E01A0600BA2921 /* Base */, + ); + name = PieChart.xib; + sourceTree = ""; + }; + C3D0A21E20E019F000BA2921 /* BarChart.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22920E01A0600BA2921 /* Base */, + ); + name = BarChart.xib; + sourceTree = ""; + }; + C3D0A22120E019F300BA2921 /* MainWindow.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22A20E01A0600BA2921 /* Base */, + ); + name = MainWindow.xib; + sourceTree = ""; + }; + C3D0A22420E019F800BA2921 /* ScatterPlot.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22B20E01A0600BA2921 /* Base */, + ); + name = ScatterPlot.xib; + sourceTree = ""; + }; + C3D0A22720E019FF00BA2921 /* Launch Screen.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A22C20E01A0600BA2921 /* Base */, + ); + name = "Launch Screen.xib"; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + /* Begin XCBuildConfiguration section */ 1D6058940D05DD3E006BFB54 /* Debug */ = { isa = XCBuildConfiguration; @@ -345,16 +431,15 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; + DEVELOPMENT_TEAM = 28ZA45DE7D; GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_iPhone_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; LIBRARY_SEARCH_PATHS = ""; OTHER_LDFLAGS = ( "-all_load", @@ -364,7 +449,7 @@ PRODUCT_NAME = "CPTTestApp-iPhone"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SWIFT_OBJC_BRIDGING_HEADER = "CPTTestApp-iPhone-Bridging-Header.h"; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -374,14 +459,14 @@ buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; CLANG_ENABLE_OBJC_ARC = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; + DEVELOPMENT_TEAM = 28ZA45DE7D; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_iPhone_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; LIBRARY_SEARCH_PATHS = ""; OTHER_LDFLAGS = ( "-all_load", @@ -391,22 +476,24 @@ PRODUCT_NAME = "CPTTestApp-iPhone"; "PROVISIONING_PROFILE[sdk=iphoneos*]" = ""; SWIFT_OBJC_BRIDGING_HEADER = "CPTTestApp-iPhone-Bridging-Header.h"; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C3CBDE19EA125D00A0296A /* CorePlotWarnings.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/Frameworks"; @@ -417,21 +504,22 @@ SDKROOT = iphoneos; SYMROOT = "$(SRCROOT)/../../build"; TARGETED_DEVICE_FAMILY = 1; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\" \"${PROJECT_DIR}/../../framework/Source\" \"${PROJECT_DIR}/../../framework/iPhoneOnly\""; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C3CBDE19EA125D00A0296A /* CorePlotWarnings.xcconfig */; buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CODE_SIGN_IDENTITY = "iPhone Distribution"; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - EMBEDDED_CONTENT_CONTAINS_SWIFT = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; HEADER_SEARCH_PATHS = ""; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/Frameworks"; @@ -442,7 +530,7 @@ SDKROOT = iphoneos; SYMROOT = "$(SRCROOT)/../../build"; TARGETED_DEVICE_FAMILY = 1; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; + USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\" \"${PROJECT_DIR}/../../framework/Source\" \"${PROJECT_DIR}/../../framework/iPhoneOnly\""; }; name = Release; }; diff --git a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPhone.xcscheme b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPhone.xcscheme new file mode 100644 index 000000000..0977a0925 --- /dev/null +++ b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone.xcodeproj/xcshareddata/xcschemes/CPTTestApp-iPhone.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/AppIcon.appiconset/Contents.json index 340f2376e..44518e8c3 100644 --- a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "size" : "29x29", "idiom" : "iphone", @@ -12,12 +22,22 @@ "filename" : "Icon-Small@2x.png", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, { "size" : "40x40", "idiom" : "iphone", "filename" : "Icon-Spotlight-40@2x.png", "scale" : "2x" }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, { "size" : "57x57", "idiom" : "iphone", @@ -41,6 +61,12 @@ "idiom" : "iphone", "filename" : "Icon-60@3x.png", "scale" : "3x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "iTunesArtwork.png", + "scale" : "1x" } ], "info" : { diff --git a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png new file mode 100644 index 000000000..969aff8dd Binary files /dev/null and b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/Contents.json b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/Contents.json similarity index 100% rename from examples/StockPlot/StockPlot/Images.xcassets/Contents.json rename to examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/Contents.json diff --git a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/LaunchImage.launchimage/Contents.json b/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index 3dd8aa5b6..000000000 --- a/examples/CPTTestApp-iPhone/CPTTestApp-iPhone/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,142 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "667h", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "1x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "to-status-bar", - "scale" : "2x" - }, - { - "orientation" : "landscape", - "idiom" : "ipad", - "extent" : "full-screen", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift index 54c61d31b..5e5618f03 100644 --- a/examples/CPTTestApp-iPhone/Classes/BarChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/BarChartController.swift @@ -3,15 +3,15 @@ import UIKit class BarChartController : UIViewController, CPTBarPlotDataSource { private var barGraph : CPTXYGraph? = nil - // MARK: Initialization + // 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: .darkGradientTheme)) 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,16 +49,16 @@ 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(NSParagraphStyleAttributeName, value:paragraphStyle, range:NSRange(location: 0, length: graphTitle.length)) - graphTitle.addAttribute(NSFontAttributeName, value:line1Font!, range:titleRange1) - graphTitle.addAttribute(NSFontAttributeName, value:line2Font!, range:titleRange2) + graphTitle.addAttribute(.foregroundColor, value:UIColor.white, range:titleRange1) + graphTitle.addAttribute(.foregroundColor, value:UIColor.gray, range:titleRange2) + graphTitle.addAttribute(.paragraphStyle, value:paragraphStyle, range:NSRange(location: 0, length: graphTitle.length)) + graphTitle.addAttribute(.font, value:line1Font!, range:titleRange1) + graphTitle.addAttribute(.font, value:line2Font!, range:titleRange2) 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 @@ -78,8 +78,8 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { x.titleOffset = 55.0 // Custom labels - x.labelRotation = CGFloat(M_PI_4) - x.labelingPolicy = .None + x.labelRotation = CGFloat(.pi / 4.0) + x.labelingPolicy = .none let customTickLocations = [1, 5, 10, 15] let xAxisLabels = ["Label A", "Label B", "Label C", "Label D"] @@ -87,10 +87,11 @@ class BarChartController : UIViewController, CPTBarPlotDataSource { var labelLocation = 0 var customLabels = Set() for tickLocation in customTickLocations { - let newLabel = CPTAxisLabel(text:xAxisLabels[labelLocation++], textStyle:x.labelTextStyle) - newLabel.tickLocation = tickLocation + let newLabel = CPTAxisLabel(text:xAxisLabels[labelLocation], textStyle:x.labelTextStyle) + labelLocation += 1 + newLabel.tickLocation = tickLocation as NSNumber newLabel.offset = x.labelOffset + x.majorTickLength - newLabel.rotation = CGFloat(M_PI_4) + newLabel.rotation = CGFloat(.pi / 4.0) customLabels.insert(newLabel) } @@ -109,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) + barPlot1.identifier = "Bar Plot 1" as NSString + 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) + barPlot2.identifier = "Bar Plot 2" as NSString + 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) -> Any? { 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..3b99ed916 100644 --- a/examples/CPTTestApp-iPhone/Classes/PieChartController.swift +++ b/examples/CPTTestApp-iPhone/Classes/PieChartController.swift @@ -1,19 +1,19 @@ import UIKit -class PieChartController : UIViewController, CPTPieChartDataSource { +class PieChartController : UIViewController, CPTPieChartDataSource, CPTPieChartDelegate { private var pieGraph : CPTXYGraph? = nil let dataForChart = [20.0, 30.0, 60.0] - // MARK: Initialization + // 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: .darkGradientTheme)) 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.identifier = "Pie Chart 1" as NSString + piePlot.startAngle = CGFloat(.pi / 4.0) + 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) -> Any? { - 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 } @@ -83,7 +83,7 @@ class PieChartController : UIViewController, CPTPieChartDataSource { return label } - func radialOffsetForPieChart(piePlot: CPTPieChart, recordIndex: UInt) -> CGFloat + func radialOffset(for piePlot: CPTPieChart, record recordIndex: UInt) -> CGFloat { var offset: CGFloat = 0.0 @@ -95,9 +95,8 @@ class PieChartController : UIViewController, CPTPieChartDataSource { } // MARK: - Delegate Methods - - func pieChart(plot: CPTPlot, sliceWasSelectedAtRecordIndex recordIndex: UInt) - { - self.pieGraph?.title = "Selected index: \(recordIndex)" + + func pieChart(_ plot: CPTPieChart, sliceWasSelectedAtRecord idx: UInt) { + self.pieGraph?.title = "Selected index: \(idx)" } } diff --git a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift index 842ad29b5..76b3191ee 100644 --- a/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift +++ b/examples/CPTTestApp-iPhone/Classes/ScatterPlotController.swift @@ -1,20 +1,20 @@ import UIKit -class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { +class ScatterPlotController : UIViewController, CPTScatterPlotDataSource, CPTAxisDelegate { private var scatterGraph : CPTXYGraph? = nil typealias plotDataType = [CPTScatterPlotField : Double] private var dataForPlot = [plotDataType]() - // MARK: Initialization + // 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: .darkGradientTheme)) let hostingView = self.view as! CPTGraphHostingView hostingView.hostedGraph = newGraph @@ -45,7 +45,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { ] } - if let y = axisSet.xAxis { + if let y = axisSet.yAxis { y.majorIntervalLength = 0.5 y.minorTicksPerInterval = 5 y.orthogonalPosition = 2.0 @@ -58,43 +58,43 @@ 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.identifier = "Blue Plot" as NSString 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" + dataSourceLinePlot.identifier = "Green Plot" as NSString dataSourceLinePlot.dataSource = self // 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.fillMode = kCAFillModeForwards + fadeInAnimation.isRemovedOnCompletion = false + fadeInAnimation.fillMode = .forwards 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) -> Any? { 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 @@ -151,7 +151,7 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { // MARK: - Axis Delegate Methods - func axis(axis: CPTAxis, shouldUpdateAxisLabelsAtLocations locations: NSSet!) -> Bool + func axis(_ axis: CPTAxis, shouldUpdateAxisLabelsAtLocations locations: Set) -> Bool { if let formatter = axis.labelFormatter { let labelOffset = axis.labelOffset @@ -160,21 +160,20 @@ class ScatterPlotController : UIViewController, CPTScatterPlotDataSource { for tickLocation in locations { 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) - newLabel.tickLocation = tickLocation as? NSNumber + newLabel.tickLocation = tickLocation newLabel.offset = labelOffset - + newLabels.insert(newLabel) } 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/CPTTestApp-iPhone/PieChart.xib b/examples/CPTTestApp-iPhone/PieChart.xib deleted file mode 100644 index 2489ea51a..000000000 --- a/examples/CPTTestApp-iPhone/PieChart.xib +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/CPTTestApp/Info.plist b/examples/CPTTestApp/Base.lproj/Info.plist similarity index 100% rename from examples/CPTTestApp/Info.plist rename to examples/CPTTestApp/Base.lproj/Info.plist diff --git a/examples/CPTTestApp/CPTTestApp.xcodeproj/project.pbxproj b/examples/CPTTestApp/CPTTestApp.xcodeproj/project.pbxproj index 2671da8c5..a844a7791 100644 --- a/examples/CPTTestApp/CPTTestApp.xcodeproj/project.pbxproj +++ b/examples/CPTTestApp/CPTTestApp.xcodeproj/project.pbxproj @@ -7,22 +7,21 @@ objects = { /* Begin PBXBuildFile section */ - 07032B7111ABB9F300463D20 /* CorePlot.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 07032B6A11ABB9E000463D20 /* CorePlot.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; - 07032B7211ABB9F700463D20 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07032B6A11ABB9E000463D20 /* CorePlot.framework */; }; 077382B10F3DC1FB002F10E2 /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 077382B00F3DC1FB002F10E2 /* Controller.m */; }; - 07C13BBB0FF9322A00BEE616 /* BlueTexture.png in Resources */ = {isa = PBXBuildFile; fileRef = 07C13BBA0FF9322A00BEE616 /* BlueTexture.png */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - 90AF4F440F36CF1800753D26 /* CPTTestApp.xib in Resources */ = {isa = PBXBuildFile; fileRef = 90AF4F430F36CF1800753D26 /* CPTTestApp.xib */; }; BC8E74240FC0B96000DF8511 /* RotationView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC8E74230FC0B96000DF8511 /* RotationView.m */; }; - C317AB4F1093CC1E00B25011 /* PlotSymbolDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C317AB4E1093CC1E00B25011 /* PlotSymbolDemo.xib */; }; - C317AB711093E09D00B25011 /* AxisDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C317AB701093E09D00B25011 /* AxisDemo.xib */; }; C317AB751093E17500B25011 /* AxisDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = C317AB731093E17500B25011 /* AxisDemoController.m */; }; C34D4F8E0F8ED78400969C24 /* CPTPlotSymbolTestController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34D4F8C0F8ED78400969C24 /* CPTPlotSymbolTestController.m */; }; - C38017DD124132020052B00D /* SelectionDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C38017DC124132020052B00D /* SelectionDemo.xib */; }; + C36912D21C0B48DF000A1D61 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07032B6A11ABB9E000463D20 /* CorePlot.framework */; }; + C36912D31C0B48DF000A1D61 /* CorePlot.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 07032B6A11ABB9E000463D20 /* CorePlot.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; C38017E1124132610052B00D /* SelectionDemoController.m in Sources */ = {isa = PBXBuildFile; fileRef = C38017E0124132610052B00D /* SelectionDemoController.m */; }; C39BB9A4181C154500D95E01 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */; }; + C3D0A18B20E017C500BA2921 /* AxisDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A18D20E017C500BA2921 /* AxisDemo.xib */; }; + C3D0A19A20E017CC00BA2921 /* CPTTestApp.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A19C20E017CC00BA2921 /* CPTTestApp.xib */; }; + C3D0A19D20E017D100BA2921 /* PlotSymbolDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A19F20E017D100BA2921 /* PlotSymbolDemo.xib */; }; + C3D0A1A020E017D600BA2921 /* SelectionDemo.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1A220E017D600BA2921 /* SelectionDemo.xib */; }; C3D3935C19FD653300148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3935B19FD653300148319 /* Images.xcassets */; }; /* End PBXBuildFile section */ @@ -48,6 +47,13 @@ remoteGlobalIDString = 8DC2EF4F0486A6940098B216; remoteInfo = CorePlot; }; + C36912D41C0B48DF000A1D61 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 07032B6311ABB9E000463D20 /* CorePlot.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = 8DC2EF4F0486A6940098B216; + remoteInfo = "CorePlot Mac"; + }; C371E4D01BB714EC00AC18DB /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 07032B6311ABB9E000463D20 /* CorePlot.xcodeproj */; @@ -76,6 +82,20 @@ remoteGlobalIDString = C38A09C41A4619A900D45436; remoteInfo = "CorePlot-CocoaTouchTests"; }; + C3CBFB691BE5874200519EE8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 07032B6311ABB9E000463D20 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C3CBFB6B1BE5874200519EE8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 07032B6311ABB9E000463D20 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -85,7 +105,7 @@ dstPath = ""; dstSubfolderSpec = 10; files = ( - 07032B7111ABB9F300463D20 /* CorePlot.framework in Copy Frameworks */, + C36912D31C0B48DF000A1D61 /* CorePlot.framework in Copy Frameworks */, ); name = "Copy Frameworks"; runOnlyForDeploymentPostprocessing = 0; @@ -97,30 +117,29 @@ 0761854B0F3CB3CB00A89A76 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CorePlot.framework; path = ../../../../framework/build/Debug/CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 077382AF0F3DC1FB002F10E2 /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Controller.h; path = Source/Controller.h; sourceTree = ""; }; 077382B00F3DC1FB002F10E2 /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Controller.m; path = Source/Controller.m; sourceTree = ""; }; - 07C13BBA0FF9322A00BEE616 /* BlueTexture.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = BlueTexture.png; path = Resources/BlueTexture.png; sourceTree = ""; }; - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Source/main.m; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* CPTTestApp_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTestApp_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* CPTTestApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CPTTestApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 90AF4F430F36CF1800753D26 /* CPTTestApp.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = CPTTestApp.xib; path = Resources/CPTTestApp.xib; sourceTree = ""; }; BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; BC8E74220FC0B96000DF8511 /* RotationView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RotationView.h; path = Source/RotationView.h; sourceTree = ""; }; BC8E74230FC0B96000DF8511 /* RotationView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RotationView.m; path = Source/RotationView.m; sourceTree = ""; }; - C317AB4E1093CC1E00B25011 /* PlotSymbolDemo.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = PlotSymbolDemo.xib; path = Resources/PlotSymbolDemo.xib; sourceTree = ""; }; - C317AB701093E09D00B25011 /* AxisDemo.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = AxisDemo.xib; path = Resources/AxisDemo.xib; sourceTree = ""; }; C317AB731093E17500B25011 /* AxisDemoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AxisDemoController.m; path = Source/AxisDemoController.m; sourceTree = ""; }; C317AB741093E17500B25011 /* AxisDemoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AxisDemoController.h; path = Source/AxisDemoController.h; sourceTree = ""; }; C34D4F8C0F8ED78400969C24 /* CPTPlotSymbolTestController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotSymbolTestController.m; path = Source/CPTPlotSymbolTestController.m; sourceTree = ""; }; C34D4F8D0F8ED78400969C24 /* CPTPlotSymbolTestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotSymbolTestController.h; path = Source/CPTPlotSymbolTestController.h; sourceTree = ""; }; - C38017DC124132020052B00D /* SelectionDemo.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = SelectionDemo.xib; path = Resources/SelectionDemo.xib; sourceTree = ""; }; + C3564D2522A2D11D000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + C37A40A620E030C000C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C38017DF124132610052B00D /* SelectionDemoController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SelectionDemoController.h; path = Source/SelectionDemoController.h; sourceTree = ""; }; C38017E0124132610052B00D /* SelectionDemoController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SelectionDemoController.m; path = Source/SelectionDemoController.m; sourceTree = ""; }; C3880C3919DCD6A000ED0618 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3D0A1A320E017E400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AxisDemo.xib; sourceTree = ""; }; + C3D0A1A420E017E400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CPTTestApp.xib; sourceTree = ""; }; + C3D0A1A520E017E400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/PlotSymbolDemo.xib; sourceTree = ""; }; + C3D0A1A620E017E400BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SelectionDemo.xib; sourceTree = ""; }; C3D3935B19FD653300148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = CPTTestApp/Images.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -129,7 +148,7 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - 07032B7211ABB9F700463D20 /* CorePlot.framework in Frameworks */, + C36912D21C0B48DF000A1D61 /* CorePlot.framework in Frameworks */, 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, C39BB9A4181C154500D95E01 /* QuartzCore.framework in Frameworks */, ); @@ -147,6 +166,8 @@ C371E4D31BB714EC00AC18DB /* UnitTests iOS.xctest */, C371E4D51BB714EC00AC18DB /* libCorePlot-CocoaTouch.a */, C371E4D71BB714EC00AC18DB /* CorePlot-CocoaTouchTests.xctest */, + C3CBFB6A1BE5874200519EE8 /* CorePlot.framework */, + C3CBFB6C1BE5874200519EE8 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -226,13 +247,12 @@ isa = PBXGroup; children = ( C3D3935B19FD653300148319 /* Images.xcassets */, - 8D1107310486CEB800E47090 /* Info.plist */, - 07C13BBA0FF9322A00BEE616 /* BlueTexture.png */, + C37A40A720E030C000C4FF48 /* Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, - C317AB701093E09D00B25011 /* AxisDemo.xib */, - 90AF4F430F36CF1800753D26 /* CPTTestApp.xib */, - C317AB4E1093CC1E00B25011 /* PlotSymbolDemo.xib */, - C38017DC124132020052B00D /* SelectionDemo.xib */, + C3D0A18D20E017C500BA2921 /* AxisDemo.xib */, + C3D0A19C20E017CC00BA2921 /* CPTTestApp.xib */, + C3D0A19F20E017D100BA2921 /* PlotSymbolDemo.xib */, + C3D0A1A220E017D600BA2921 /* SelectionDemo.xib */, ); name = Resources; sourceTree = ""; @@ -262,6 +282,7 @@ ); dependencies = ( 07032B7411ABBA0E00463D20 /* PBXTargetDependency */, + C36912D51C0B48DF000A1D61 /* PBXTargetDependency */, ); name = CPTTestApp; productInstallPath = "$(HOME)/Applications"; @@ -276,17 +297,18 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = NO; - LastUpgradeCheck = 0610; + LastUpgradeCheck = 1100; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CPTTestApp" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + ja, + de, + en, + fr, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CPTTestApp */; projectDirPath = ""; @@ -346,6 +368,20 @@ remoteRef = C371E4D61BB714EC00AC18DB /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + C3CBFB6A1BE5874200519EE8 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C3CBFB691BE5874200519EE8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C3CBFB6C1BE5874200519EE8 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C3CBFB6B1BE5874200519EE8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -355,11 +391,10 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, C3D3935C19FD653300148319 /* Images.xcassets in Resources */, - 90AF4F440F36CF1800753D26 /* CPTTestApp.xib in Resources */, - 07C13BBB0FF9322A00BEE616 /* BlueTexture.png in Resources */, - C317AB4F1093CC1E00B25011 /* PlotSymbolDemo.xib in Resources */, - C317AB711093E09D00B25011 /* AxisDemo.xib in Resources */, - C38017DD124132020052B00D /* SelectionDemo.xib in Resources */, + C3D0A19A20E017CC00BA2921 /* CPTTestApp.xib in Resources */, + C3D0A19D20E017D100BA2921 /* PlotSymbolDemo.xib in Resources */, + C3D0A18B20E017C500BA2921 /* AxisDemo.xib in Resources */, + C3D0A1A020E017D600BA2921 /* SelectionDemo.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -387,17 +422,66 @@ name = CorePlot; targetProxy = 07032B7311ABBA0E00463D20 /* PBXContainerItemProxy */; }; + C36912D51C0B48DF000A1D61 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "CorePlot Mac"; + targetProxy = C36912D41C0B48DF000A1D61 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C165DFE840E0CC02AAC07 /* English */, + C3564D2522A2D11D000A54C9 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; + C37A40A720E030C000C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40A620E030C000C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; + C3D0A18D20E017C500BA2921 /* AxisDemo.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1A320E017E400BA2921 /* Base */, + ); + name = AxisDemo.xib; + path = Resources; + sourceTree = ""; + }; + C3D0A19C20E017CC00BA2921 /* CPTTestApp.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1A420E017E400BA2921 /* Base */, + ); + name = CPTTestApp.xib; + path = Resources; + sourceTree = ""; + }; + C3D0A19F20E017D100BA2921 /* PlotSymbolDemo.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1A520E017E400BA2921 /* Base */, + ); + name = PlotSymbolDemo.xib; + path = Resources; + sourceTree = ""; + }; + C3D0A1A220E017D600BA2921 /* SelectionDemo.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1A620E017E400BA2921 /* Base */, + ); + name = SelectionDemo.xib; + path = Resources; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -408,18 +492,18 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; GCC_TREAT_WARNINGS_AS_ERRORS = YES; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = CPTTestApp; }; @@ -432,15 +516,16 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = CPTTestApp_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks @executable_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = CPTTestApp; }; @@ -448,14 +533,16 @@ }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3880C3919DCD6A000ED0618 /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SYMROOT = "$(PROJECT_DIR)/../../build"; @@ -464,13 +551,15 @@ }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3880C3919DCD6A000ED0618 /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; SDKROOT = macosx; SYMROOT = "$(PROJECT_DIR)/../../build"; }; diff --git a/examples/CPTTestApp/CPTTestApp.xcodeproj/xcshareddata/xcschemes/CPTTestApp.xcscheme b/examples/CPTTestApp/CPTTestApp.xcodeproj/xcshareddata/xcschemes/CPTTestApp.xcscheme new file mode 100644 index 000000000..a741352d0 --- /dev/null +++ b/examples/CPTTestApp/CPTTestApp.xcodeproj/xcshareddata/xcschemes/CPTTestApp.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CPTTestApp/Resources/AxisDemo.xib b/examples/CPTTestApp/Resources/Base.lproj/AxisDemo.xib similarity index 68% rename from examples/CPTTestApp/Resources/AxisDemo.xib rename to examples/CPTTestApp/Resources/Base.lproj/AxisDemo.xib index 943805a61..27d0611f4 100644 --- a/examples/CPTTestApp/Resources/AxisDemo.xib +++ b/examples/CPTTestApp/Resources/Base.lproj/AxisDemo.xib @@ -1,26 +1,29 @@ - - + + - + + + - - + + - + + diff --git a/examples/CPTTestApp/Resources/CPTTestApp.xib b/examples/CPTTestApp/Resources/Base.lproj/CPTTestApp.xib similarity index 95% rename from examples/CPTTestApp/Resources/CPTTestApp.xib rename to examples/CPTTestApp/Resources/Base.lproj/CPTTestApp.xib index 8bec09504..4b7d3ae17 100644 --- a/examples/CPTTestApp/Resources/CPTTestApp.xib +++ b/examples/CPTTestApp/Resources/Base.lproj/CPTTestApp.xib @@ -1,13 +1,14 @@ - - + + - + + - + @@ -558,18 +559,19 @@ + - + - + - - - + - + - - + + - + @@ -657,13 +659,12 @@ - - - + - - - - - - @@ -688,7 +683,7 @@ - + @@ -696,7 +691,7 @@ - + @@ -704,15 +699,15 @@ - + - + - - + @@ -745,7 +741,7 @@ y - + diff --git a/examples/CPTTestApp/Resources/PlotSymbolDemo.xib b/examples/CPTTestApp/Resources/Base.lproj/PlotSymbolDemo.xib similarity index 67% rename from examples/CPTTestApp/Resources/PlotSymbolDemo.xib rename to examples/CPTTestApp/Resources/Base.lproj/PlotSymbolDemo.xib index bffdf5c16..ce94cac6a 100644 --- a/examples/CPTTestApp/Resources/PlotSymbolDemo.xib +++ b/examples/CPTTestApp/Resources/Base.lproj/PlotSymbolDemo.xib @@ -1,26 +1,29 @@ - - + + - + + + - - + + - + + diff --git a/examples/CPTTestApp/Resources/SelectionDemo.xib b/examples/CPTTestApp/Resources/Base.lproj/SelectionDemo.xib similarity index 68% rename from examples/CPTTestApp/Resources/SelectionDemo.xib rename to examples/CPTTestApp/Resources/Base.lproj/SelectionDemo.xib index 9dee883b9..c79ae2d56 100644 --- a/examples/CPTTestApp/Resources/SelectionDemo.xib +++ b/examples/CPTTestApp/Resources/Base.lproj/SelectionDemo.xib @@ -1,26 +1,29 @@ - - + + - + + + - - + + - + + diff --git a/examples/CPTTestApp/Resources/BlueTexture.png b/examples/CPTTestApp/Resources/BlueTexture.png deleted file mode 100644 index ea004c70d..000000000 Binary files a/examples/CPTTestApp/Resources/BlueTexture.png and /dev/null differ diff --git a/examples/CPTTestApp/Source/AxisDemoController.m b/examples/CPTTestApp/Source/AxisDemoController.m index b72d72233..51cf85317 100644 --- a/examples/CPTTestApp/Source/AxisDemoController.m +++ b/examples/CPTTestApp/Source/AxisDemoController.m @@ -2,7 +2,7 @@ @interface AxisDemoController() -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *hostView; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *hostView; @end diff --git a/examples/CPTTestApp/Source/CPTPlotSymbolTestController.m b/examples/CPTTestApp/Source/CPTPlotSymbolTestController.m index ec5e347ac..8cf7d0aee 100644 --- a/examples/CPTTestApp/Source/CPTPlotSymbolTestController.m +++ b/examples/CPTTestApp/Source/CPTPlotSymbolTestController.m @@ -2,8 +2,8 @@ @interface CPTPlotSymbolTestController() -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *hostView; -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *hostView; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *graph; @end @@ -50,7 +50,7 @@ -(void)awakeFromNib // Create a series of plots that uses the data source method for ( NSUInteger i = CPTPlotSymbolTypeNone; i <= CPTPlotSymbolTypeCustom; i++ ) { CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] initWithFrame:newGraph.bounds]; - dataSourceLinePlot.identifier = [NSString stringWithFormat:@"%lu", (unsigned long)i]; + dataSourceLinePlot.identifier = @(i); dataSourceLinePlot.shadow = lineShadow; CPTMutableLineStyle *lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy]; @@ -67,12 +67,12 @@ -(void)awakeFromNib #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return 10; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num; @@ -82,7 +82,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI break; case CPTScatterPlotFieldY: - num = @([(NSString *)plot.identifier integerValue]); + num = (NSNumber *)plot.identifier; break; default: @@ -91,7 +91,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI return num; } --(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTPlotSymbol *)symbolForScatterPlot:(nonnull CPTScatterPlot *)plot recordIndex:(NSUInteger)index { CPTGradient *gradientFill = [CPTGradient rainbowGradient]; @@ -103,7 +103,7 @@ -(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUIn symbolShadow.shadowColor = [CPTColor blackColor]; CPTPlotSymbol *symbol = [[CPTPlotSymbol alloc] init]; - symbol.symbolType = (CPTPlotSymbolType)[(NSString *)plot.identifier intValue]; + symbol.symbolType = (CPTPlotSymbolType)((NSString *)plot.identifier).intValue; symbol.fill = [CPTFill fillWithGradient:gradientFill]; symbol.shadow = symbolShadow; @@ -116,9 +116,9 @@ -(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUIn CGMutablePathRef path = CGPathCreateMutable(); CGPathMoveToPoint(path, NULL, 0., 0.); - CGPathAddEllipseInRect( path, NULL, CGRectMake(0., 0., 10., 10.) ); - CGPathAddEllipseInRect( path, NULL, CGRectMake(1.5, 4., 3., 3.) ); - CGPathAddEllipseInRect( path, NULL, CGRectMake(5.5, 4., 3., 3.) ); + CGPathAddEllipseInRect(path, NULL, CGRectMake(0., 0., 10., 10.)); + CGPathAddEllipseInRect(path, NULL, CGRectMake(1.5, 4., 3., 3.)); + CGPathAddEllipseInRect(path, NULL, CGRectMake(5.5, 4., 3., 3.)); CGPathMoveToPoint(path, NULL, 5., 2.); CGPathAddArc(path, NULL, 5., 3.3, 2.8, 0., M_PI, TRUE); CGPathCloseSubpath(path); diff --git a/examples/CPTTestApp/Source/Controller.h b/examples/CPTTestApp/Source/Controller.h index 206c7e1ca..d6fee2276 100644 --- a/examples/CPTTestApp/Source/Controller.h +++ b/examples/CPTTestApp/Source/Controller.h @@ -9,27 +9,27 @@ @property (nonatomic, readwrite, assign) CGFloat labelRotation; // Data loading --(IBAction)reloadDataSourcePlot:(id)sender; --(IBAction)removeData:(id)sender; --(IBAction)insertData:(id)sender; +-(IBAction)reloadDataSourcePlot:(nullable id)sender; +-(IBAction)removeData:(nullable id)sender; +-(IBAction)insertData:(nullable id)sender; // PDF / image export --(IBAction)exportToPDF:(id)sender; --(IBAction)exportToPNG:(id)sender; +-(IBAction)exportToPDF:(nullable id)sender; +-(IBAction)exportToPNG:(nullable id)sender; // Printing --(IBAction)printDocument:(id)sender; --(void)printOperationDidRun:(NSPrintOperation *)printOperation success:(BOOL)success contextInfo:(void *)contextInfo; +-(IBAction)printDocument:(nullable id)sender; +-(void)printOperationDidRun:(nonnull NSPrintOperation *)printOperation success:(BOOL)success contextInfo:(nullable void *)contextInfo; // Layer exploding for illustration --(IBAction)explodeLayers:(id)sender; -+(void)recursivelySplitSublayersInZForLayer:(CALayer *)layer depthLevel:(NSUInteger)depthLevel; --(IBAction)reassembleLayers:(id)sender; -+(void)recursivelyAssembleSublayersInZForLayer:(CALayer *)layer; +-(IBAction)explodeLayers:(nullable id)sender; ++(void)recursivelySplitSublayersInZForLayer:(nonnull CALayer *)layer depthLevel:(NSUInteger)depthLevel; +-(IBAction)reassembleLayers:(nullable id)sender; ++(void)recursivelyAssembleSublayersInZForLayer:(nonnull CALayer *)layer; // Demo windows --(IBAction)plotSymbolDemo:(id)sender; --(IBAction)axisDemo:(id)sender; --(IBAction)selectionDemo:(id)sender; +-(IBAction)plotSymbolDemo:(nullable id)sender; +-(IBAction)axisDemo:(nullable id)sender; +-(IBAction)selectionDemo:(nullable id)sender; @end diff --git a/examples/CPTTestApp/Source/Controller.m b/examples/CPTTestApp/Source/Controller.m index 92c910ad3..9f1d5439a 100644 --- a/examples/CPTTestApp/Source/Controller.m +++ b/examples/CPTTestApp/Source/Controller.m @@ -1,5 +1,9 @@ #import "Controller.h" +#import "AxisDemoController.h" +#import "CPTPlotSymbolTestController.h" +#import "SelectionDemoController.h" + static const CGFloat kZDistanceBetweenLayers = 20.0; static NSString *const bindingsPlot = @"Bindings Plot"; @@ -9,14 +13,24 @@ @interface Controller() -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *hostView; -@property (nonatomic, readwrite, weak) IBOutlet NSWindow *plotSymbolWindow; -@property (nonatomic, readwrite, weak) IBOutlet NSWindow *axisDemoWindow; -@property (nonatomic, readwrite, weak) IBOutlet NSWindow *selectionDemoWindow; +-(void)plotSymbolWindowClosed; +-(void)axisDemoWindowClosed; +-(void)selectionDemoWindowClosed; + +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *hostView; + +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSWindow *plotSymbolWindow; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTPlotSymbolTestController *plotSymbolTestController; + +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSWindow *axisDemoWindow; +@property (nonatomic, readwrite, strong, nullable) IBOutlet AxisDemoController *axisDemoController; + +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSWindow *selectionDemoWindow; +@property (nonatomic, readwrite, strong, nullable) IBOutlet SelectionDemoController *selectionDemoController; -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; -@property (nonatomic, readwrite, strong) RotationView *overlayRotationView; -@property (nonatomic, readwrite, strong) CPTPlotSpaceAnnotation *symbolTextAnnotation; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nullable) RotationView *overlayRotationView; +@property (nonatomic, readwrite, strong, nullable) CPTPlotSpaceAnnotation *symbolTextAnnotation; -(void)setupGraph; -(void)setupAxes; @@ -32,8 +46,11 @@ @implementation Controller @synthesize hostView; @synthesize plotSymbolWindow; +@synthesize plotSymbolTestController; @synthesize axisDemoWindow; +@synthesize axisDemoController; @synthesize selectionDemoWindow; +@synthesize selectionDemoController; @synthesize graph; @synthesize overlayRotationView; @@ -64,12 +81,12 @@ -(void)awakeFromNib -(id)newObject { - NSNumber *x1 = @(1.0 + ( (NSMutableArray *)self.content ).count * 0.05); + NSNumber *x1 = @(1.0 + ((NSMutableArray *)self.content).count * 0.05); NSNumber *y1 = @(1.2 * arc4random() / (double)UINT32_MAX + 1.2); return @{ - @"x": x1, - @"y": y1 + @"x": x1, + @"y": y1 }; } @@ -80,9 +97,7 @@ -(void)setupGraph { // Create graph and apply a dark theme CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:NSRectToCGRect(self.hostView.bounds)]; - CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; - [newGraph applyTheme:theme]; self.hostView.hostedGraph = newGraph; self.graph = newGraph; @@ -91,8 +106,8 @@ -(void)setupGraph NSString *lineTwo = @"This is the Second Line of the Title"; NSMutableAttributedString *graphTitle = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"%@\n%@", lineOne, lineTwo]]; - [graphTitle addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(0, lineOne.length)]; - [graphTitle addAttribute:NSForegroundColorAttributeName value:[NSColor darkGrayColor] range:NSMakeRange(lineOne.length + 1, lineTwo.length)]; + [graphTitle addAttribute:NSForegroundColorAttributeName value:[NSColor labelColor] range:NSMakeRange(0, lineOne.length)]; + [graphTitle addAttribute:NSForegroundColorAttributeName value:[NSColor secondaryLabelColor] range:NSMakeRange(lineOne.length + 1, lineTwo.length)]; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle.alignment = CPTTextAlignmentCenter; [graphTitle addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, graphTitle.length)]; @@ -105,11 +120,14 @@ -(void)setupGraph newGraph.titleDisplacement = CGPointMake(0.0, 50.0); newGraph.titlePlotAreaFrameAnchor = CPTRectAnchorTop; + // newGraph.fill = [CPTFill fillWithColor:[CPTColor colorWithNSColor:[NSColor windowBackgroundColor]]]; + newGraph.plotAreaFrame.fill = [CPTFill fillWithColor:[CPTColor colorWithNSColor:[NSColor controlBackgroundColor]]]; + // Graph padding - newGraph.paddingLeft = 60.0; + newGraph.paddingLeft = 10.0; newGraph.paddingTop = 60.0; - newGraph.paddingRight = 60.0; - newGraph.paddingBottom = 60.0; + newGraph.paddingRight = 10.0; + newGraph.paddingBottom = 10.0; // Plot area delegate newGraph.plotAreaFrame.plotArea.delegate = self; @@ -126,33 +144,38 @@ -(void)setupAxes // Grid line styles CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle]; majorGridLineStyle.lineWidth = 0.75; - majorGridLineStyle.lineColor = [[CPTColor colorWithGenericGray:0.2] colorWithAlphaComponent:0.75]; + majorGridLineStyle.lineColor = [[CPTColor colorWithNSColor:[NSColor gridColor]] colorWithAlphaComponent:0.75]; CPTMutableLineStyle *minorGridLineStyle = [CPTMutableLineStyle lineStyle]; minorGridLineStyle.lineWidth = 0.25; - minorGridLineStyle.lineColor = [[CPTColor whiteColor] colorWithAlphaComponent:0.1]; + minorGridLineStyle.lineColor = [[CPTColor colorWithNSColor:[NSColor gridColor]] colorWithAlphaComponent:0.1]; CPTMutableLineStyle *redLineStyle = [CPTMutableLineStyle lineStyle]; redLineStyle.lineWidth = 10.0; - redLineStyle.lineColor = [[CPTColor redColor] colorWithAlphaComponent:0.5]; + redLineStyle.lineColor = [[CPTColor colorWithNSColor:[NSColor systemRedColor]] colorWithAlphaComponent:0.5]; // Axes // Label x axis with a fixed interval policy CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet; CPTXYAxis *x = axisSet.xAxis; + + CPTMutableTextStyle *textStyle = [x.titleTextStyle mutableCopy]; + textStyle.color = [CPTColor colorWithNSColor:[NSColor secondaryLabelColor]]; + + x.labelTextStyle = textStyle; x.majorIntervalLength = @0.5; x.orthogonalPosition = @2.0; x.minorTicksPerInterval = 2; x.majorGridLineStyle = majorGridLineStyle; x.minorGridLineStyle = minorGridLineStyle; - CPTPlotRangeArray exclusionRanges = @[[CPTPlotRange plotRangeWithLocation:@1.99 length:@0.02], - [CPTPlotRange plotRangeWithLocation:@0.99 length:@0.02], - [CPTPlotRange plotRangeWithLocation:@2.99 length:@0.02]]; + CPTPlotRangeArray *exclusionRanges = @[[CPTPlotRange plotRangeWithLocation:@1.99 length:@0.02], + [CPTPlotRange plotRangeWithLocation:@0.99 length:@0.02], + [CPTPlotRange plotRangeWithLocation:@2.99 length:@0.02]]; x.labelExclusionRanges = exclusionRanges; NSMutableAttributedString *xTitle = [[NSMutableAttributedString alloc] initWithString:@"X Axis\nLine 2"]; - [xTitle addAttribute:NSForegroundColorAttributeName value:[NSColor whiteColor] range:NSMakeRange(0, 6)]; - [xTitle addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(7, 6)]; + [xTitle addAttribute:NSForegroundColorAttributeName value:[NSColor secondaryLabelColor] range:NSMakeRange(0, 6)]; + [xTitle addAttribute:NSForegroundColorAttributeName value:[NSColor tertiaryLabelColor] range:NSMakeRange(7, 6)]; NSMutableParagraphStyle *xParagraphStyle = [[NSMutableParagraphStyle alloc] init]; xParagraphStyle.alignment = CPTTextAlignmentCenter; [xTitle addAttribute:NSParagraphStyleAttributeName value:xParagraphStyle range:NSMakeRange(0, xTitle.length)]; @@ -164,6 +187,7 @@ -(void)setupAxes // Label y with an automatic label policy. CPTXYAxis *y = axisSet.yAxis; y.labelingPolicy = CPTAxisLabelingPolicyAutomatic; + y.labelTextStyle = textStyle; y.orthogonalPosition = @2.0; y.minorTicksPerInterval = 2; y.preferredNumberOfMajorTicks = 8; @@ -176,8 +200,8 @@ -(void)setupAxes y.labelExclusionRanges = exclusionRanges; NSMutableAttributedString *yTitle = [[NSMutableAttributedString alloc] initWithString:@"Y Axis\nLine 2"]; - [yTitle addAttribute:NSForegroundColorAttributeName value:[NSColor whiteColor] range:NSMakeRange(0, 6)]; - [yTitle addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(7, 6)]; + [yTitle addAttribute:NSForegroundColorAttributeName value:[NSColor secondaryLabelColor] range:NSMakeRange(0, 6)]; + [yTitle addAttribute:NSForegroundColorAttributeName value:[NSColor tertiaryLabelColor] range:NSMakeRange(7, 6)]; NSMutableParagraphStyle *yParagraphStyle = [[NSMutableParagraphStyle alloc] init]; yParagraphStyle.alignment = CPTTextAlignmentCenter; [yTitle addAttribute:NSParagraphStyleAttributeName value:yParagraphStyle range:NSMakeRange(0, yTitle.length)]; @@ -192,6 +216,7 @@ -(void)setupAxes // Add an extra y axis (red) // We add constraints to this axis below CPTXYAxis *y2 = [[CPTXYAxis alloc] initWithFrame:CGRectZero]; + y2.labelingPolicy = CPTAxisLabelingPolicyAutomatic; y2.orthogonalPosition = @3.0; y2.minorTicksPerInterval = 0; @@ -206,8 +231,10 @@ -(void)setupAxes y2.minorTickLineStyle = nil; y2.labelTextStyle = nil; y2.visibleRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@3.0]; + y2.titleTextStyle = textStyle; y2.title = @"Y2 title"; y2.titleLocation = @3.0; + // Set axes self.graph.axisSet.axes = @[x, y, y2]; } @@ -232,17 +259,19 @@ -(void)setupScatterPlots [boundLinePlot bind:CPTScatterPlotBindingYValues toObject:self withKeyPath:@"arrangedObjects.y" options:nil]; // Put an area gradient under the plot above - CPTImage *fillImage = [CPTImage imageNamed:@"BlueTexture"]; - fillImage.tiled = YES; - CPTFill *areaImageFill = [CPTFill fillWithImage:fillImage]; - boundLinePlot.areaFill = areaImageFill; + CPTColor *areaColor = [CPTColor colorWithComponentRed:0.3 green:0.3 blue:1.0 alpha:0.8]; + CPTGradient *areaGradient = [CPTGradient gradientWithBeginningColor:areaColor endingColor:[CPTColor clearColor]]; + areaGradient.angle = -90.0; + CPTFill *areaGradientFill = [CPTFill fillWithGradient:areaGradient]; + + boundLinePlot.areaFill = areaGradientFill; boundLinePlot.areaBaseValue = @1.0; // Add plot symbols CPTMutableLineStyle *symbolLineStyle = [CPTMutableLineStyle lineStyle]; symbolLineStyle.lineColor = [CPTColor blackColor]; CPTPlotSymbol *plotSymbol = [CPTPlotSymbol ellipsePlotSymbol]; - plotSymbol.fill = [CPTFill fillWithColor:[CPTColor blueColor]]; + plotSymbol.fill = [CPTFill fillWithColor:[CPTColor colorWithNSColor:[NSColor systemBlueColor]]]; plotSymbol.lineStyle = symbolLineStyle; plotSymbol.size = CGSizeMake(10.0, 10.0); boundLinePlot.plotSymbol = plotSymbol; @@ -259,14 +288,14 @@ -(void)setupScatterPlots lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy]; lineStyle.lineWidth = 1.0; - lineStyle.lineColor = [CPTColor greenColor]; + lineStyle.lineColor = [CPTColor colorWithNSColor:[NSColor systemGreenColor]]; dataSourceLinePlot.dataLineStyle = lineStyle; dataSourceLinePlot.dataSource = self; - CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle]; - whiteTextStyle.color = [CPTColor whiteColor]; - dataSourceLinePlot.labelTextStyle = whiteTextStyle; + CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle]; + textStyle.color = [CPTColor colorWithNSColor:[NSColor secondaryLabelColor]]; + dataSourceLinePlot.labelTextStyle = textStyle; dataSourceLinePlot.labelOffset = 5.0; dataSourceLinePlot.labelRotation = M_PI_4; @@ -276,10 +305,11 @@ -(void)setupScatterPlots dataSourceLinePlot.interpolation = CPTScatterPlotInterpolationStepped; // Put an area gradient under the plot above - CPTColor *areaColor = [CPTColor colorWithComponentRed:0.3 green:1.0 blue:0.3 alpha:0.8]; - CPTGradient *areaGradient = [CPTGradient gradientWithBeginningColor:areaColor endingColor:[CPTColor clearColor]]; + areaColor = [CPTColor colorWithComponentRed:0.3 green:1.0 blue:0.3 alpha:0.8]; + areaGradient = [CPTGradient gradientWithBeginningColor:areaColor endingColor:[CPTColor clearColor]]; areaGradient.angle = -90.0; - CPTFill *areaGradientFill = [CPTFill fillWithGradient:areaGradient]; + areaGradientFill = [CPTFill fillWithGradient:areaGradient]; + dataSourceLinePlot.areaFill = areaGradientFill; dataSourceLinePlot.areaBaseValue = @1.75; @@ -338,15 +368,16 @@ -(void)setupBarPlots [self.graph addPlotSpace:barPlotSpace]; // First bar plot - CPTMutableTextStyle *whiteTextStyle = [CPTMutableTextStyle textStyle]; - whiteTextStyle.color = [CPTColor whiteColor]; + CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle]; + textStyle.color = [CPTColor colorWithNSColor:[NSColor secondaryLabelColor]]; + CPTBarPlot *barPlot = [CPTBarPlot tubularBarPlotWithColor:[CPTColor darkGrayColor] horizontalBars:YES]; barPlot.baseValue = @20.0; barPlot.dataSource = self; barPlot.barOffset = @(-0.25); barPlot.identifier = barPlot1; barPlot.plotRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@7.0]; - barPlot.labelTextStyle = whiteTextStyle; + barPlot.labelTextStyle = textStyle; [self.graph addPlot:barPlot toPlotSpace:barPlotSpace]; // Second bar plot @@ -364,14 +395,14 @@ -(void)setupBarPlots #pragma mark - #pragma mark Actions --(IBAction)reloadDataSourcePlot:(id)sender +-(IBAction)reloadDataSourcePlot:(nullable id __unused)sender { CPTPlot *plot = [self.graph plotWithIdentifier:dataSourcePlot]; [plot reloadData]; } --(IBAction)removeData:(id)sender +-(IBAction)removeData:(nullable id __unused)sender { NSUInteger index = self.selectionIndex; @@ -383,7 +414,7 @@ -(IBAction)removeData:(id)sender } } --(IBAction)insertData:(id)sender +-(IBAction)insertData:(nullable id __unused)sender { NSUInteger index = self.selectionIndex; @@ -399,7 +430,7 @@ -(IBAction)insertData:(id)sender #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { if ( [plot isKindOfClass:[CPTBarPlot class]] ) { return 8; @@ -409,12 +440,12 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot } } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num; if ( [plot isKindOfClass:[CPTBarPlot class]] ) { - num = @( (index + 1) * (index + 1) ); + num = @((index + 1) * (index + 1)); if ( [plot.identifier isEqual:barPlot2] ) { num = @(num.integerValue - 10); } @@ -423,18 +454,18 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); num = (self.arrangedObjects)[index][key]; if ( fieldEnum == CPTScatterPlotFieldY ) { - num = @([num doubleValue] + 1.0); + num = @(num.doubleValue + 1.0); } } return num; } --(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUInteger)index { - if ( [(NSString *)plot.identifier isEqualToString : barPlot2] ) { + if ( [(NSString *) plot.identifier isEqualToString:barPlot2] ) { return (id)[NSNull null]; // Don't show any label } - else if ( [(NSString *)plot.identifier isEqualToString : barPlot1] && (index < 4) ) { + else if ( [(NSString *) plot.identifier isEqualToString:barPlot1] && (index < 4)) { return (id)[NSNull null]; } else if ( index % 4 ) { @@ -448,7 +479,7 @@ -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index #pragma mark - #pragma mark CPTScatterPlot delegate method --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; @@ -459,8 +490,8 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS // Setup a style for the annotation CPTMutableTextStyle *hitAnnotationTextStyle = [CPTMutableTextStyle textStyle]; - hitAnnotationTextStyle.color = [CPTColor whiteColor]; - hitAnnotationTextStyle.fontSize = 16.0f; + hitAnnotationTextStyle.color = [CPTColor colorWithNSColor:[NSColor labelColor]]; + hitAnnotationTextStyle.fontSize = CPTFloat(16.0); hitAnnotationTextStyle.fontName = @"Helvetica-Bold"; // Determine point of symbol in plot coordinates @@ -469,12 +500,12 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS NSNumber *x = dataPoint[@"x"]; NSNumber *y = dataPoint[@"y"]; - CPTNumberArray anchorPoint = @[x, y]; + CPTNumberArray *anchorPoint = @[x, y]; // Add annotation // First make a string for the y value NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - [formatter setMaximumFractionDigits:2]; + formatter.maximumFractionDigits = 2; NSString *yString = [formatter stringFromNumber:y]; // Now add the annotation to the plot area @@ -492,7 +523,7 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS #pragma mark - #pragma mark CPTBarPlot delegate method --(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index +-(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"barWasSelectedAtRecordIndex %u", (unsigned)index); @@ -504,46 +535,62 @@ -(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index // Setup a style for the annotation CPTMutableTextStyle *hitAnnotationTextStyle = [CPTMutableTextStyle textStyle]; - hitAnnotationTextStyle.color = [CPTColor redColor]; + hitAnnotationTextStyle.color = [CPTColor colorWithNSColor:[NSColor labelColor]]; hitAnnotationTextStyle.fontSize = 16.0; hitAnnotationTextStyle.fontName = @"Helvetica-Bold"; // Determine point of symbol in plot coordinates - NSNumber *x = @0; - NSNumber *y = [self numberForPlot:plot field:0 recordIndex:index]; - CPTNumberArray anchorPoint = @[x, @(index)]; + NSNumber *x = @0; + NSNumber *y = [self numberForPlot:plot field:CPTBarPlotFieldBarLocation recordIndex:index]; + + CPTNumberArray *anchorPoint = @[x, @(index)]; // Add annotation // First make a string for the y value NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - [formatter setMaximumFractionDigits:2]; + formatter.maximumFractionDigits = 2; NSString *yString = [formatter stringFromNumber:y]; // Now add the annotation to the plot area - CPTPlotSpace *defaultSpace = self.graph.defaultPlotSpace; - if ( defaultSpace ) { + CPTPlotSpace *plotSpace = plot.plotSpace; + if ( plotSpace ) { CPTTextLayer *textLayer = [[CPTTextLayer alloc] initWithText:yString style:hitAnnotationTextStyle]; - annotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:defaultSpace anchorPlotPoint:anchorPoint]; + annotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:plotSpace anchorPlotPoint:anchorPoint]; annotation.contentLayer = textLayer; annotation.displacement = CGPointMake(0.0, 0.0); [self.graph.plotAreaFrame.plotArea addAnnotation:annotation]; self.symbolTextAnnotation = annotation; } - CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"barWidth"]; - animation.duration = 0.25; - animation.toValue = @0.0; - animation.repeatCount = 1; - animation.autoreverses = YES; - animation.removedOnCompletion = YES; - [plot addAnimation:animation forKey:@"barWidth"]; + const CGFloat duration = 0.25; + NSNumber *barWidth = plot.barWidth; + + if ( barWidth ) { + [CPTAnimation animate:plot + property:@"barWidth" + fromNumber:plot.barWidth + toNumber:@0.0 + duration:duration + withDelay:0.0 + animationCurve:CPTAnimationCurveDefault + delegate:nil]; + + [CPTAnimation animate:plot + property:@"barWidth" + fromNumber:nil + toNumber:barWidth + duration:duration + withDelay:duration + animationCurve:CPTAnimationCurveDefault + delegate:nil]; + } } #pragma mark - #pragma mark Plot area delegate method --(void)plotAreaWasSelected:(CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *__unused)plotArea { // Remove the annotation CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; @@ -557,35 +604,35 @@ -(void)plotAreaWasSelected:(CPTPlotArea *)plotArea #pragma mark - #pragma mark PDF / image export --(IBAction)exportToPDF:(id)sender +-(IBAction)exportToPDF:(nullable id __unused)sender { NSSavePanel *pdfSavingDialog = [NSSavePanel savePanel]; - [pdfSavingDialog setAllowedFileTypes:@[@"pdf"]]; + pdfSavingDialog.allowedFileTypes = @[@"pdf"]; if ( [pdfSavingDialog runModal] == NSOKButton ) { NSData *dataForPDF = [self.graph dataForPDFRepresentationOfLayer]; - NSURL *url = [pdfSavingDialog URL]; + NSURL *url = pdfSavingDialog.URL; if ( url ) { [dataForPDF writeToURL:url atomically:NO]; } } } --(IBAction)exportToPNG:(id)sender +-(IBAction)exportToPNG:(nullable id __unused)sender { NSSavePanel *pngSavingDialog = [NSSavePanel savePanel]; - [pngSavingDialog setAllowedFileTypes:@[@"png"]]; + pngSavingDialog.allowedFileTypes = @[@"png"]; if ( [pngSavingDialog runModal] == NSOKButton ) { NSImage *image = [self.graph imageOfLayer]; - NSData *tiffData = [image TIFFRepresentation]; + NSData *tiffData = image.TIFFRepresentation; NSBitmapImageRep *tiffRep = [NSBitmapImageRep imageRepWithData:tiffData]; - NSData *pngData = [tiffRep representationUsingType:NSPNGFileType properties:[NSDictionary dictionary]]; + NSData *pngData = [tiffRep representationUsingType:NSPNGFileType properties:@{}]; - NSURL *url = [pngSavingDialog URL]; + NSURL *url = pngSavingDialog.URL; if ( url ) { [pngData writeToURL:url atomically:NO]; } @@ -595,7 +642,7 @@ -(IBAction)exportToPNG:(id)sender #pragma mark - #pragma mark Printing --(IBAction)printDocument:(id)sender +-(IBAction)printDocument:(nullable id __unused)sender { NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo]; @@ -606,9 +653,10 @@ -(IBAction)printDocument:(id)sender self.hostView.printRect = printRect; - NSWindow *window = self.hostView.window; + CPTGraphHostingView *host = self.hostView; + NSWindow *window = host.window; if ( window ) { - NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:self.hostView printInfo:printInfo]; + NSPrintOperation *printOperation = [NSPrintOperation printOperationWithView:host printInfo:printInfo]; [printOperation runOperationModalForWindow:window delegate:self didRunSelector:@selector(printOperationDidRun:success:contextInfo:) @@ -616,15 +664,15 @@ -(IBAction)printDocument:(id)sender } } --(void)printOperationDidRun:(NSPrintOperation *)printOperation success:(BOOL)success contextInfo:(void *)contextInfo +-(void)printOperationDidRun:(nonnull NSPrintOperation *__unused)printOperation success:(BOOL __unused)success contextInfo:(nullable void *__unused)contextInfo { - // print delegate +// print delegate } #pragma mark - #pragma mark Layer exploding for illustration --(IBAction)explodeLayers:(id)sender +-(IBAction)explodeLayers:(nullable id __unused)sender { CATransform3D perspectiveRotation = CATransform3DMakeRotation(-40.0 * M_PI / 180.0, 0.0, 1.0, 0.0); @@ -638,8 +686,8 @@ -(IBAction)explodeLayers:(id)sender RotationView *overlayView = [[RotationView alloc] initWithFrame:self.hostView.frame]; overlayView.rotationDelegate = self; overlayView.rotationTransform = perspectiveRotation; - [overlayView setAutoresizingMask:[self.hostView autoresizingMask]]; - [[self.hostView superview] addSubview:overlayView positioned:NSWindowAbove relativeTo:self.hostView]; + overlayView.autoresizingMask = self.hostView.autoresizingMask; + [self.hostView.superview addSubview:overlayView positioned:NSWindowAbove relativeTo:self.hostView]; self.overlayRotationView = overlayView; [CATransaction begin]; @@ -651,7 +699,7 @@ -(IBAction)explodeLayers:(id)sender [CATransaction commit]; } -+(void)recursivelySplitSublayersInZForLayer:(CALayer *)layer depthLevel:(NSUInteger)depthLevel ++(void)recursivelySplitSublayersInZForLayer:(nonnull CALayer *)layer depthLevel:(NSUInteger)depthLevel { layer.zPosition = kZDistanceBetweenLayers * (CGFloat)depthLevel; layer.borderColor = [CPTColor blueColor].cgColor; @@ -663,7 +711,7 @@ +(void)recursivelySplitSublayersInZForLayer:(CALayer *)layer depthLevel:(NSUInte } } --(IBAction)reassembleLayers:(id)sender +-(IBAction)reassembleLayers:(nullable id __unused)sender { [CATransaction begin]; [CATransaction setValue:@1.0f forKey:kCATransactionAnimationDuration]; @@ -677,7 +725,7 @@ -(IBAction)reassembleLayers:(id)sender self.overlayRotationView = nil; } -+(void)recursivelyAssembleSublayersInZForLayer:(CALayer *)layer ++(void)recursivelyAssembleSublayersInZForLayer:(nonnull CALayer *)layer { layer.zPosition = 0.0; layer.borderColor = [CPTColor clearColor].cgColor; @@ -690,34 +738,73 @@ +(void)recursivelyAssembleSublayersInZForLayer:(CALayer *)layer #pragma mark - #pragma mark Demo windows --(IBAction)plotSymbolDemo:(id)sender +-(IBAction)plotSymbolDemo:(nullable id)sender { if ( !self.plotSymbolWindow ) { - [NSBundle loadNibNamed:@"PlotSymbolDemo" owner:self]; + [[NSBundle mainBundle] loadNibNamed:@"PlotSymbolDemo" + owner:self + topLevelObjects:nil]; } NSWindow *window = self.plotSymbolWindow; [window makeKeyAndOrderFront:sender]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(plotSymbolWindowClosed) + name:NSWindowWillCloseNotification + object:window]; } --(IBAction)axisDemo:(id)sender +-(IBAction)axisDemo:(nullable id)sender { if ( !self.axisDemoWindow ) { - [NSBundle loadNibNamed:@"AxisDemo" owner:self]; + [[NSBundle mainBundle] loadNibNamed:@"AxisDemo" + owner:self + topLevelObjects:nil]; } NSWindow *window = self.axisDemoWindow; [window makeKeyAndOrderFront:sender]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(axisDemoWindowClosed) + name:NSWindowWillCloseNotification + object:window]; } --(IBAction)selectionDemo:(id)sender +-(IBAction)selectionDemo:(nullable id)sender { if ( !self.selectionDemoWindow ) { - [NSBundle loadNibNamed:@"SelectionDemo" owner:self]; + [[NSBundle mainBundle] loadNibNamed:@"SelectionDemo" + owner:self + topLevelObjects:nil]; } NSWindow *window = self.selectionDemoWindow; [window makeKeyAndOrderFront:sender]; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(selectionDemoWindowClosed) + name:NSWindowWillCloseNotification + object:window]; +} + +-(void)plotSymbolWindowClosed +{ + self.plotSymbolWindow = nil; + self.plotSymbolTestController = nil; +} + +-(void)axisDemoWindowClosed +{ + self.axisDemoWindow = nil; + self.axisDemoController = nil; +} + +-(void)selectionDemoWindowClosed +{ + self.selectionDemoWindow = nil; + self.selectionDemoController = nil; } #pragma mark - @@ -758,7 +845,7 @@ -(void)setLabelRotation:(CGFloat)newRotation { labelRotation = newRotation; - ( (CPTXYAxisSet *)self.graph.axisSet ).yAxis.labelRotation = newRotation; + ((CPTXYAxisSet *)self.graph.axisSet).yAxis.labelRotation = newRotation; [self.graph plotWithIdentifier:dataSourcePlot].labelRotation = newRotation; } diff --git a/examples/CPTTestApp/Source/RotationView.h b/examples/CPTTestApp/Source/RotationView.h index b8917b021..0ec33c63c 100644 --- a/examples/CPTTestApp/Source/RotationView.h +++ b/examples/CPTTestApp/Source/RotationView.h @@ -1,6 +1,6 @@ // -// RotationView.h -// CPTTestApp +// RotationView.h +// CPTTestApp // #import @@ -11,10 +11,11 @@ @interface RotationView : NSView @property (nonatomic, readwrite) CATransform3D rotationTransform; -@property (nonatomic, readwrite, weak) id rotationDelegate; +@property (nonatomic, readwrite, weak, nullable) id rotationDelegate; @end @protocol CPTRotationDelegate -(void)rotateObjectUsingTransform:(CATransform3D)rotationTransform; + @end diff --git a/examples/CPTTestApp/Source/RotationView.m b/examples/CPTTestApp/Source/RotationView.m index 429f143a6..68b892fab 100644 --- a/examples/CPTTestApp/Source/RotationView.m +++ b/examples/CPTTestApp/Source/RotationView.m @@ -1,6 +1,6 @@ // -// 3DRotationView.m -// CPTTestApp +// 3DRotationView.m +// CPTTestApp // #import "RotationView.h" @@ -18,9 +18,9 @@ @implementation RotationView #pragma mark - #pragma mark Initialization and teardown --(instancetype)initWithFrame:(NSRect)frame +-(nonnull instancetype)initWithFrame:(NSRect)frame { - if ( (self = [super initWithFrame:frame]) ) { + if ((self = [super initWithFrame:frame])) { rotationTransform = CATransform3DIdentity; // Initialization code here. } @@ -30,19 +30,19 @@ -(instancetype)initWithFrame:(NSRect)frame #pragma mark - #pragma mark Mouse handling methods --(BOOL)acceptsFirstMouse:(NSEvent *)theEvent +-(BOOL)acceptsFirstMouse:(nullable NSEvent *__unused)theEvent { return YES; } --(void)mouseDown:(NSEvent *)theEvent +-(void)mouseDown:(nonnull NSEvent *)theEvent { - self.previousLocation = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + self.previousLocation = [self convertPoint:theEvent.locationInWindow fromView:nil]; } --(void)mouseDragged:(NSEvent *)theEvent +-(void)mouseDragged:(nonnull NSEvent *)theEvent { - NSPoint currentLocation = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + NSPoint currentLocation = [self convertPoint:theEvent.locationInWindow fromView:nil]; CGFloat displacementInX = kMouseMovementScaleFactorForRotation * (currentLocation.x - self.previousLocation.x); CGFloat displacementInY = kMouseMovementScaleFactorForRotation * (self.previousLocation.y - currentLocation.y); @@ -50,21 +50,22 @@ -(void)mouseDragged:(NSEvent *)theEvent CGFloat totalRotation = sqrt(displacementInX * displacementInX + displacementInY * displacementInY); CATransform3D oldTransform = self.rotationTransform; - CATransform3D newTransform = CATransform3DRotate( oldTransform, totalRotation * M_PI / 180.0, - ( (displacementInX / totalRotation) * oldTransform.m12 + (displacementInY / totalRotation) * oldTransform.m11 ), - ( (displacementInX / totalRotation) * oldTransform.m22 + (displacementInY / totalRotation) * oldTransform.m21 ), - ( (displacementInX / totalRotation) * oldTransform.m32 + (displacementInY / totalRotation) * oldTransform.m31 ) ); + CATransform3D newTransform = CATransform3DRotate(oldTransform, totalRotation * M_PI / 180.0, + ((displacementInX / totalRotation) * oldTransform.m12 + (displacementInY / totalRotation) * oldTransform.m11), + ((displacementInX / totalRotation) * oldTransform.m22 + (displacementInY / totalRotation) * oldTransform.m21), + ((displacementInX / totalRotation) * oldTransform.m32 + (displacementInY / totalRotation) * oldTransform.m31)); id theDelegate = self.rotationDelegate; + [theDelegate rotateObjectUsingTransform:newTransform]; self.rotationTransform = newTransform; - self.previousLocation = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + self.previousLocation = [self convertPoint:theEvent.locationInWindow fromView:nil]; } --(void)mouseUp:(NSEvent *)theEvent +-(void)mouseUp:(nonnull NSEvent *)theEvent { - self.previousLocation = [self convertPoint:[theEvent locationInWindow] fromView:nil]; + self.previousLocation = [self convertPoint:theEvent.locationInWindow fromView:nil]; } #pragma mark - 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/CPTTestApp/Source/SelectionDemoController.m b/examples/CPTTestApp/Source/SelectionDemoController.m index d6e61cd49..bcf2fdde1 100644 --- a/examples/CPTTestApp/Source/SelectionDemoController.m +++ b/examples/CPTTestApp/Source/SelectionDemoController.m @@ -10,11 +10,11 @@ -(void)setupAxes; -(void)setupScatterPlots; -(void)initializeData; -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *hostView; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *hostView; -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *graph; -@property (nonatomic, readwrite, strong) NSMutableArray *dataForPlot; +@property (nonatomic, readwrite, strong, nonnull) NSMutableArray *dataForPlot; @property (nonatomic, readwrite) NSUInteger selectedIndex; @end @@ -182,14 +182,14 @@ -(void)initializeData #pragma mark - #pragma mark Plot datasource methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { NSUInteger count = 0; - if ( [(NSString *)plot.identifier isEqualToString : MAIN_PLOT] ) { - count = [self.dataForPlot count]; + if ( [(NSString *) plot.identifier isEqualToString:MAIN_PLOT] ) { + count = self.dataForPlot.count; } - else if ( [(NSString *)plot.identifier isEqualToString : SELECTION_PLOT] ) { + else if ( [(NSString *) plot.identifier isEqualToString:SELECTION_PLOT] ) { if ( self.selectedIndex < NSUIntegerMax ) { count = 5; } @@ -198,15 +198,15 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot return count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num = nil; - if ( [(NSString *)plot.identifier isEqualToString : MAIN_PLOT] ) { + if ( [(NSString *) plot.identifier isEqualToString:MAIN_PLOT] ) { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); num = (self.dataForPlot)[index][key]; } - else if ( [(NSString *)plot.identifier isEqualToString : SELECTION_PLOT] ) { + else if ( [(NSString *) plot.identifier isEqualToString:SELECTION_PLOT] ) { CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace; switch ( fieldEnum ) { @@ -260,13 +260,13 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI return num; } --(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTPlotSymbol *)symbolForScatterPlot:(nonnull CPTScatterPlot *)plot recordIndex:(NSUInteger)index { static CPTPlotSymbol *redDot = nil; CPTPlotSymbol *symbol = (id)[NSNull null]; - if ( [(NSString *)plot.identifier isEqualToString : SELECTION_PLOT] && (index == 2) ) { + if ( [(NSString *) plot.identifier isEqualToString:SELECTION_PLOT] && (index == 2)) { if ( !redDot ) { redDot = [[CPTPlotSymbol alloc] init]; redDot.symbolType = CPTPlotSymbolTypeEllipse; @@ -282,7 +282,7 @@ -(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUIn #pragma mark - #pragma mark CPTScatterPlot delegate methods --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { self.selectedIndex = index; } @@ -291,11 +291,12 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS #pragma mark Plot space delegate methods #ifdef REMOVE_SELECTION_ON_CLICK --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)event atPoint:(CGPoint)point +-(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)point { self.selectedIndex = NSUIntegerMax; return YES; } + #endif #pragma mark - diff --git a/examples/CPTTestApp/Source/main.m b/examples/CPTTestApp/Source/main.m index e8a345f07..4177914fd 100644 --- a/examples/CPTTestApp/Source/main.m +++ b/examples/CPTTestApp/Source/main.m @@ -1,9 +1,9 @@ // -// main.m -// CPTTestApp +// main.m +// CPTTestApp // -// Created by Dirkjan Krijnders on 2/2/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. +// Created by Dirkjan Krijnders on 2/2/09. +// Copyright __MyCompanyName__ 2009. All rights reserved. // int main(int argc, const char *argv[]) diff --git a/examples/CPTTestApp/English.lproj/InfoPlist.strings b/examples/CPTTestApp/en.lproj/InfoPlist.strings similarity index 100% rename from examples/CPTTestApp/English.lproj/InfoPlist.strings rename to examples/CPTTestApp/en.lproj/InfoPlist.strings diff --git a/examples/CorePlotExamples.xcworkspace/contents.xcworkspacedata b/examples/CorePlotExamples.xcworkspace/contents.xcworkspacedata index df38f3d5a..a9ec2bf00 100644 --- a/examples/CorePlotExamples.xcworkspace/contents.xcworkspacedata +++ b/examples/CorePlotExamples.xcworkspace/contents.xcworkspacedata @@ -30,18 +30,12 @@ - - - - + + + + IDEDidComputeMac32BitWarning + + + diff --git a/examples/CorePlotExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/examples/CorePlotExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..0c67376eb --- /dev/null +++ b/examples/CorePlotExamples.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/examples/CorePlotGallery/Plot_Gallery_Mac-Info.plist b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_Mac-Info.plist similarity index 94% rename from examples/CorePlotGallery/Plot_Gallery_Mac-Info.plist rename to examples/CorePlotGallery/Base.lproj/Plot_Gallery_Mac-Info.plist index b0cb1bbde..0bd38f049 100644 --- a/examples/CorePlotGallery/Plot_Gallery_Mac-Info.plist +++ b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_Mac-Info.plist @@ -20,6 +20,8 @@ ???? CFBundleVersion 1 + LSApplicationCategoryType + LSMinimumSystemVersion ${MACOSX_DEPLOYMENT_TARGET} NSMainNibFile diff --git a/examples/CorePlotGallery/Plot_Gallery_iOS-Info.plist b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_iOS-Info.plist similarity index 100% rename from examples/CorePlotGallery/Plot_Gallery_iOS-Info.plist rename to examples/CorePlotGallery/Base.lproj/Plot_Gallery_iOS-Info.plist diff --git a/examples/AAPLot/Info.plist b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_tvOS-Info.plist similarity index 60% rename from examples/AAPLot/Info.plist rename to examples/CorePlotGallery/Base.lproj/Plot_Gallery_tvOS-Info.plist index 4081ec7d1..4f338601b 100644 --- a/examples/AAPLot/Info.plist +++ b/examples/CorePlotGallery/Base.lproj/Plot_Gallery_tvOS-Info.plist @@ -3,34 +3,30 @@ CFBundleDevelopmentRegion - English - CFBundleDisplayName - ${PRODUCT_NAME} + en CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIcons~ipad - + $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - ${PRODUCT_NAME} + $(PRODUCT_NAME) CFBundlePackageType APPL + CFBundleShortVersionString + 1.0 CFBundleSignature ???? CFBundleVersion - 1.0 + 1 LSRequiresIPhoneOS - NSMainNibFile - MainWindow - UILaunchStoryboardName - Launch Screen - UISupportedInterfaceOrientations + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities - UIInterfaceOrientationPortrait + arm64 diff --git a/examples/CorePlotGallery/Plot Gallery-Mac/PlotViewItem.xib b/examples/CorePlotGallery/Plot Gallery-Mac/PlotViewItem.xib new file mode 100644 index 000000000..047384075 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-Mac/PlotViewItem.xib @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Contents.json index 1e95c6488..b3e167fda 100644 --- a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "size" : "29x29", "idiom" : "iphone", @@ -54,6 +64,16 @@ "filename" : "Icon-60@3x.png", "scale" : "3x" }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "20x20", + "scale" : "2x" + }, { "idiom" : "ipad", "size" : "29x29", @@ -110,6 +130,18 @@ "idiom" : "ipad", "filename" : "Icon-76@2x.png", "scale" : "2x" + }, + { + "size" : "83.5x83.5", + "idiom" : "ipad", + "filename" : "Icon-iPadPro@2x.png", + "scale" : "2x" + }, + { + "size" : "1024x1024", + "idiom" : "ios-marketing", + "filename" : "iTunesArtwork.png", + "scale" : "1x" } ], "info" : { diff --git a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Icon-iPadPro@2x.png b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Icon-iPadPro@2x.png new file mode 100644 index 000000000..4f193923f Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/Icon-iPadPro@2x.png differ diff --git a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png new file mode 100644 index 000000000..228e5b861 Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/AppIcon.appiconset/iTunesArtwork.png differ diff --git a/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/Contents.json b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/AAPLot/AAPLot/Images.xcassets/LaunchImage.launchimage/Contents.json b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json similarity index 88% rename from examples/AAPLot/AAPLot/Images.xcassets/LaunchImage.launchimage/Contents.json rename to examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json index 3dd8aa5b6..6d2d4295e 100644 --- a/examples/AAPLot/AAPLot/Images.xcassets/LaunchImage.launchimage/Contents.json +++ b/examples/CorePlotGallery/Plot Gallery-iOS/Images.xcassets/LaunchImage.launchimage/Contents.json @@ -1,5 +1,21 @@ { "images" : [ + { + "orientation" : "portrait", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "11.0", + "subtype" : "2436h", + "scale" : "3x" + }, + { + "orientation" : "landscape", + "idiom" : "iphone", + "extent" : "full-screen", + "minimum-system-version" : "11.0", + "subtype" : "2436h", + "scale" : "3x" + }, { "orientation" : "portrait", "idiom" : "iphone", diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..7aa641214 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "tv", + "filename" : "PlotGalleryLargeIconBack.png", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/PlotGalleryLargeIconBack.png b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/PlotGalleryLargeIconBack.png new file mode 100644 index 000000000..cb50a05bc Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Content.imageset/PlotGalleryLargeIconBack.png differ diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json new file mode 100644 index 000000000..cf8282aa5 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Contents.json @@ -0,0 +1,14 @@ +{ + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..f9614e449 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "tv", + "filename" : "PlotGalleryLargeIconFront.png", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/PlotGalleryLargeIconFront.png b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/PlotGalleryLargeIconFront.png new file mode 100644 index 000000000..43e6f1300 Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Content.imageset/PlotGalleryLargeIconFront.png differ diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Large.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..2f7e2f531 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "tv", + "filename" : "PlotGallerySmallIconBack.png", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/PlotGallerySmallIconBack.png b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/PlotGallerySmallIconBack.png new file mode 100644 index 000000000..9f511b9bc Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Content.imageset/PlotGallerySmallIconBack.png differ diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Back.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json new file mode 100644 index 000000000..cf8282aa5 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Contents.json @@ -0,0 +1,14 @@ +{ + "layers" : [ + { + "filename" : "Front.imagestacklayer" + }, + { + "filename" : "Back.imagestacklayer" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json new file mode 100644 index 000000000..387ff905b --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "tv", + "filename" : "PlotGallerySmallIconFront.png", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/PlotGallerySmallIconFront.png b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/PlotGallerySmallIconFront.png new file mode 100644 index 000000000..51a34de0f Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Content.imageset/PlotGallerySmallIconFront.png differ diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/App Icon - Small.imagestack/Front.imagestacklayer/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json new file mode 100644 index 000000000..dea6e49fd --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Contents.json @@ -0,0 +1,32 @@ +{ + "assets" : [ + { + "size" : "1280x768", + "idiom" : "tv", + "filename" : "App Icon - Large.imagestack", + "role" : "primary-app-icon" + }, + { + "size" : "400x240", + "idiom" : "tv", + "filename" : "App Icon - Small.imagestack", + "role" : "primary-app-icon" + }, + { + "size" : "2320x720", + "idiom" : "tv", + "filename" : "Top Shelf Image Wide.imageset", + "role" : "top-shelf-image-wide" + }, + { + "size" : "1920x720", + "idiom" : "tv", + "filename" : "Top Shelf Image.imageset", + "role" : "top-shelf-image" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json new file mode 100644 index 000000000..16a370df0 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image Wide.imageset/Contents.json @@ -0,0 +1,16 @@ +{ + "images" : [ + { + "idiom" : "tv", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json new file mode 100644 index 000000000..167022b51 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/Contents.json @@ -0,0 +1,17 @@ +{ + "images" : [ + { + "idiom" : "tv", + "filename" : "PlotGalleryTopShelf.png", + "scale" : "1x" + }, + { + "idiom" : "tv", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/PlotGalleryTopShelf.png b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/PlotGalleryTopShelf.png new file mode 100644 index 000000000..ea9cef263 Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/App Icon & Top Shelf Image.brandassets/Top Shelf Image.imageset/PlotGalleryTopShelf.png differ diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/Contents.json new file mode 100644 index 000000000..da4a164c9 --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/Contents.json b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/Contents.json new file mode 100644 index 000000000..f4a929b0d --- /dev/null +++ b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "orientation" : "landscape", + "idiom" : "tv", + "extent" : "full-screen", + "minimum-system-version" : "11.0", + "scale" : "2x" + }, + { + "orientation" : "landscape", + "idiom" : "tv", + "filename" : "LaunchImage.png", + "extent" : "full-screen", + "minimum-system-version" : "9.0", + "scale" : "1x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/LaunchImage.png b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/LaunchImage.png new file mode 100644 index 000000000..d0ba363b2 Binary files /dev/null and b/examples/CorePlotGallery/Plot Gallery-tvOS/Assets.xcassets/LaunchImage.launchimage/LaunchImage.png differ diff --git a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/project.pbxproj b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/project.pbxproj index d70c93309..5fc2950c5 100644 --- a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/project.pbxproj +++ b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/project.pbxproj @@ -9,8 +9,6 @@ /* Begin PBXBuildFile section */ 4F22FF4912342978006BF615 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF4712342978006BF615 /* main.m */; }; 4F22FF4C1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF4B1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m */; }; - 4F22FF5B12342A21006BF615 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 4F22FF5712342A21006BF615 /* InfoPlist.strings */; }; - 4F22FF5C12342A21006BF615 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4F22FF5912342A21006BF615 /* MainMenu.xib */; }; 4F22FFA412342D7C006BF615 /* CompositePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9B12342D7C006BF615 /* CompositePlot.m */; }; 4F22FFA512342D7C006BF615 /* GradientScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9D12342D7C006BF615 /* GradientScatterPlot.m */; }; 4F22FFA612342D7C006BF615 /* SimplePieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9F12342D7C006BF615 /* SimplePieChart.m */; }; @@ -19,7 +17,6 @@ 4F22FFAF12342DB1006BF615 /* PlotGallery.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAC12342DB1006BF615 /* PlotGallery.m */; }; 4F22FFB012342DB1006BF615 /* PlotItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAE12342DB1006BF615 /* PlotItem.m */; }; 4F22FFE8123431D2006BF615 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F22FFE7123431D2006BF615 /* Quartz.framework */; }; - 4F35EBBD12360D89007C3389 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 4F35EBBC12360D89007C3389 /* Icon.icns */; }; 4F35EBF7123611E3007C3389 /* PlotGalleryController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F35EBF4123611E3007C3389 /* PlotGalleryController.m */; }; 4F35EBF8123611E3007C3389 /* PlotView.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F35EBF6123611E3007C3389 /* PlotView.m */; }; 4F8E1C14129077C200D2035F /* DatePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1C13129077C200D2035F /* DatePlot.m */; }; @@ -28,62 +25,105 @@ 4FABDD421291110D003A2DB7 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4F4892891290FFCD00EDB93F /* CorePlot.framework */; }; 4FABDD4612911127003A2DB7 /* CorePlot.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 4F4892891290FFCD00EDB93F /* CorePlot.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; + C309C23423B3E12500DEDE9D /* PlotViewItem.xib in Resources */ = {isa = PBXBuildFile; fileRef = C309C23323B3E12500DEDE9D /* PlotViewItem.xib */; }; + C309C23623B3E21500DEDE9D /* PlotViewItem.m in Sources */ = {isa = PBXBuildFile; fileRef = C309C23523B3E21500DEDE9D /* PlotViewItem.m */; }; C30B12431BCADD300084C567 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D4146F1A7D824700B6F5D6 /* CorePlot.framework */; }; C30B12441BCADD300084C567 /* CorePlot.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = C3D4146F1A7D824700B6F5D6 /* CorePlot.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - C30B12481BCADE170084C567 /* PlotItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAE12342DB1006BF615 /* PlotItem.m */; settings = {ASSET_TAGS = (); }; }; - C30B12491BCADE170084C567 /* PlotGallery.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAC12342DB1006BF615 /* PlotGallery.m */; settings = {ASSET_TAGS = (); }; }; - C30B124A1BCADE170084C567 /* PiNumberFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C3457A4C17AD7C5D000880F3 /* PiNumberFormatter.m */; settings = {ASSET_TAGS = (); }; }; + C30B12481BCADE170084C567 /* PlotItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAE12342DB1006BF615 /* PlotItem.m */; }; + C30B12491BCADE170084C567 /* PlotGallery.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAC12342DB1006BF615 /* PlotGallery.m */; }; + C30B124A1BCADE170084C567 /* PiNumberFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C3457A4C17AD7C5D000880F3 /* PiNumberFormatter.m */; }; + C30D8AFA1BCAF99D0003BB70 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C30D8AF91BCAF99D0003BB70 /* main.m */; }; + C30D8AFD1BCAF99D0003BB70 /* AppDelegateTV.m in Sources */ = {isa = PBXBuildFile; fileRef = C30D8AFC1BCAF99D0003BB70 /* AppDelegateTV.m */; }; + C30D8B081BCAF99D0003BB70 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C30D8B071BCAF99D0003BB70 /* Assets.xcassets */; }; + C30D8B211BCAFD3E0003BB70 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D2FE6219FF1D03002CD4D6 /* Images.xcassets */; }; + C30D8B221BCAFD3E0003BB70 /* PlotItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAE12342DB1006BF615 /* PlotItem.m */; }; + C30D8B231BCAFD3E0003BB70 /* PlotGallery.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFAC12342DB1006BF615 /* PlotGallery.m */; }; + C30D8B241BCAFD3E0003BB70 /* PiNumberFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C3457A4C17AD7C5D000880F3 /* PiNumberFormatter.m */; }; + C30D8B251BCAFDE20003BB70 /* AxisDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1CC112908B0000D2035F /* AxisDemo.m */; }; + C30D8B261BCAFDE20003BB70 /* CandlestickPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1DF13B18CAE007994B6 /* CandlestickPlot.m */; }; + C30D8B271BCAFDE20003BB70 /* ColoredBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A31A5514DF782A00734AB7 /* ColoredBarChart.m */; }; + C30D8B281BCAFDE20003BB70 /* CompositePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9B12342D7C006BF615 /* CompositePlot.m */; }; + C30D8B291BCAFDE20003BB70 /* ControlChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C35597951437E07800B41DA7 /* ControlChart.m */; }; + C30D8B2A1BCAFDE20003BB70 /* CurvedScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F42A2714D3A75F0044B323 /* CurvedScatterPlot.m */; }; + C30D8B2B1BCAFDE20003BB70 /* DatePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1C13129077C200D2035F /* DatePlot.m */; }; + C30D8B2C1BCAFDE20003BB70 /* DonutChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F34F1412AB2598008FBDC3 /* DonutChart.m */; }; + C30D8B2D1BCAFDE20003BB70 /* FunctionPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F97F1817A9DE2000A52FF2 /* FunctionPlot.m */; }; + C30D8B2E1BCAFDE20003BB70 /* GradientScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9D12342D7C006BF615 /* GradientScatterPlot.m */; }; + C30D8B2F1BCAFDE20003BB70 /* ImageDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D70BA5175EB29E00F27173 /* ImageDemo.m */; }; + C30D8B301BCAFDE20003BB70 /* LabelingPolicyDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C39C4E4013BFE1A900CD9194 /* LabelingPolicyDemo.m */; }; + C30D8B311BCAFDE20003BB70 /* LineCapDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C367249213E103910070F47A /* LineCapDemo.m */; }; + C30D8B321BCAFDE20003BB70 /* OHLCPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1C513B18AAF007994B6 /* OHLCPlot.m */; }; + C30D8B331BCAFDE20003BB70 /* PlotSpaceDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C39C4E4313BFE1B400CD9194 /* PlotSpaceDemo.m */; }; + C30D8B341BCAFDE20003BB70 /* RangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A14BEB13AEB7E700D103EA /* RangePlot.m */; }; + C30D8B351BCAFDE20003BB70 /* RealTimePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C354C0D613C7CDBE00DA8822 /* RealTimePlot.m */; }; + C30D8B361BCAFDE20003BB70 /* SteppedScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1C85129083B000D2035F /* SteppedScatterPlot.m */; }; + C30D8B371BCAFDE20003BB70 /* SimplePieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9F12342D7C006BF615 /* SimplePieChart.m */; }; + C30D8B381BCAFDE20003BB70 /* SimpleScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA112342D7C006BF615 /* SimpleScatterPlot.m */; }; + C30D8B391BCAFDE20003BB70 /* VerticalBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA312342D7C006BF615 /* VerticalBarChart.m */; }; + C30D8B3D1BCAFFB50003BB70 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B3C1BCAFFB50003BB70 /* CoreGraphics.framework */; }; + C30D8B3F1BCAFFBB0003BB70 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B3E1BCAFFBB0003BB70 /* QuartzCore.framework */; }; + C30D8B411BCAFFC10003BB70 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B401BCAFFC10003BB70 /* Foundation.framework */; }; + C30D8B431BCAFFCB0003BB70 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B421BCAFFCB0003BB70 /* UIKit.framework */; }; + C32D229E23B1086600043720 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = C32D229C23B1086600043720 /* MainMenu.xib */; }; C3457A4D17AD7C5D000880F3 /* PiNumberFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C3457A4C17AD7C5D000880F3 /* PiNumberFormatter.m */; }; - C34CB5461BC9A83C009270A0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C34CB5451BC9A83C009270A0 /* Images.xcassets */; settings = {ASSET_TAGS = (); }; }; - C34CB5541BC9A889009270A0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5481BC9A889009270A0 /* AppDelegate.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5551BC9A889009270A0 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB54A1BC9A889009270A0 /* DetailViewController.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5561BC9A889009270A0 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C34CB54B1BC9A889009270A0 /* Launch Screen.xib */; settings = {ASSET_TAGS = (); }; }; - C34CB5571BC9A889009270A0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB54C1BC9A889009270A0 /* main.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5581BC9A889009270A0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C34CB54D1BC9A889009270A0 /* Main.storyboard */; settings = {ASSET_TAGS = (); }; }; - C34CB55A1BC9A889009270A0 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5511BC9A889009270A0 /* RootViewController.m */; settings = {ASSET_TAGS = (); }; }; - C34CB55B1BC9A889009270A0 /* ThemeTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5531BC9A889009270A0 /* ThemeTableViewController.m */; settings = {ASSET_TAGS = (); }; }; + C3490DD820E025760089F309 /* Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = C3490DDA20E025760089F309 /* Icon.icns */; }; + C34CB5461BC9A83C009270A0 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C34CB5451BC9A83C009270A0 /* Images.xcassets */; }; + C34CB5541BC9A889009270A0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5481BC9A889009270A0 /* AppDelegate.m */; }; + C34CB5551BC9A889009270A0 /* DetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB54A1BC9A889009270A0 /* DetailViewController.m */; }; + C34CB5571BC9A889009270A0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB54C1BC9A889009270A0 /* main.m */; }; + C34CB55A1BC9A889009270A0 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5511BC9A889009270A0 /* RootViewController.m */; }; + C34CB55B1BC9A889009270A0 /* ThemeTableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = C34CB5531BC9A889009270A0 /* ThemeTableViewController.m */; }; C34CB5601BC9AB7B009270A0 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB55F1BC9AB7B009270A0 /* Foundation.framework */; }; C34CB5621BC9AB85009270A0 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB5611BC9AB85009270A0 /* UIKit.framework */; }; C34CB5641BC9AB8C009270A0 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB5631BC9AB8C009270A0 /* CoreGraphics.framework */; }; C34CB5661BC9AB93009270A0 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB5651BC9AB93009270A0 /* QuartzCore.framework */; }; - C34CB5681BC9AB9E009270A0 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C34CB5671BC9AB9E009270A0 /* Accelerate.framework */; }; - C34CB57C1BC9B1C1009270A0 /* AxisDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1CC112908B0000D2035F /* AxisDemo.m */; settings = {ASSET_TAGS = (); }; }; - C34CB57D1BC9B1C1009270A0 /* CandlestickPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1DF13B18CAE007994B6 /* CandlestickPlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB57E1BC9B1C1009270A0 /* ColoredBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A31A5514DF782A00734AB7 /* ColoredBarChart.m */; settings = {ASSET_TAGS = (); }; }; - C34CB57F1BC9B1C1009270A0 /* CompositePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9B12342D7C006BF615 /* CompositePlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5801BC9B1C1009270A0 /* ControlChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C35597951437E07800B41DA7 /* ControlChart.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5811BC9B1C1009270A0 /* CurvedScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F42A2714D3A75F0044B323 /* CurvedScatterPlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5821BC9B1C1009270A0 /* DatePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1C13129077C200D2035F /* DatePlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5831BC9B1C1009270A0 /* DonutChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F34F1412AB2598008FBDC3 /* DonutChart.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5841BC9B1C1009270A0 /* FunctionPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F97F1817A9DE2000A52FF2 /* FunctionPlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5851BC9B1C1009270A0 /* GradientScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9D12342D7C006BF615 /* GradientScatterPlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5861BC9B1C1009270A0 /* ImageDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D70BA5175EB29E00F27173 /* ImageDemo.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5871BC9B1C1009270A0 /* LabelingPolicyDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C39C4E4013BFE1A900CD9194 /* LabelingPolicyDemo.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5881BC9B1C1009270A0 /* LineCapDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C367249213E103910070F47A /* LineCapDemo.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5891BC9B1C1009270A0 /* OHLCPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1C513B18AAF007994B6 /* OHLCPlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB58A1BC9B1C1009270A0 /* PlotSpaceDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C39C4E4313BFE1B400CD9194 /* PlotSpaceDemo.m */; settings = {ASSET_TAGS = (); }; }; - C34CB58B1BC9B1C1009270A0 /* RangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A14BEB13AEB7E700D103EA /* RangePlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB58C1BC9B1C1009270A0 /* RealTimePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C354C0D613C7CDBE00DA8822 /* RealTimePlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB58D1BC9B1C1009270A0 /* SteppedScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1C85129083B000D2035F /* SteppedScatterPlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB58E1BC9B1C1009270A0 /* SimplePieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9F12342D7C006BF615 /* SimplePieChart.m */; settings = {ASSET_TAGS = (); }; }; - C34CB58F1BC9B1C1009270A0 /* SimpleScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA112342D7C006BF615 /* SimpleScatterPlot.m */; settings = {ASSET_TAGS = (); }; }; - C34CB5901BC9B1C1009270A0 /* VerticalBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA312342D7C006BF615 /* VerticalBarChart.m */; settings = {ASSET_TAGS = (); }; }; + C34CB57C1BC9B1C1009270A0 /* AxisDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1CC112908B0000D2035F /* AxisDemo.m */; }; + C34CB57D1BC9B1C1009270A0 /* CandlestickPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1DF13B18CAE007994B6 /* CandlestickPlot.m */; }; + C34CB57E1BC9B1C1009270A0 /* ColoredBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A31A5514DF782A00734AB7 /* ColoredBarChart.m */; }; + C34CB57F1BC9B1C1009270A0 /* CompositePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9B12342D7C006BF615 /* CompositePlot.m */; }; + C34CB5801BC9B1C1009270A0 /* ControlChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C35597951437E07800B41DA7 /* ControlChart.m */; }; + C34CB5811BC9B1C1009270A0 /* CurvedScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F42A2714D3A75F0044B323 /* CurvedScatterPlot.m */; }; + C34CB5821BC9B1C1009270A0 /* DatePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1C13129077C200D2035F /* DatePlot.m */; }; + C34CB5831BC9B1C1009270A0 /* DonutChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F34F1412AB2598008FBDC3 /* DonutChart.m */; }; + C34CB5841BC9B1C1009270A0 /* FunctionPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F97F1817A9DE2000A52FF2 /* FunctionPlot.m */; }; + C34CB5851BC9B1C1009270A0 /* GradientScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9D12342D7C006BF615 /* GradientScatterPlot.m */; }; + C34CB5861BC9B1C1009270A0 /* ImageDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D70BA5175EB29E00F27173 /* ImageDemo.m */; }; + C34CB5871BC9B1C1009270A0 /* LabelingPolicyDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C39C4E4013BFE1A900CD9194 /* LabelingPolicyDemo.m */; }; + C34CB5881BC9B1C1009270A0 /* LineCapDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C367249213E103910070F47A /* LineCapDemo.m */; }; + C34CB5891BC9B1C1009270A0 /* OHLCPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1C513B18AAF007994B6 /* OHLCPlot.m */; }; + C34CB58A1BC9B1C1009270A0 /* PlotSpaceDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C39C4E4313BFE1B400CD9194 /* PlotSpaceDemo.m */; }; + C34CB58B1BC9B1C1009270A0 /* RangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A14BEB13AEB7E700D103EA /* RangePlot.m */; }; + C34CB58C1BC9B1C1009270A0 /* RealTimePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C354C0D613C7CDBE00DA8822 /* RealTimePlot.m */; }; + C34CB58D1BC9B1C1009270A0 /* SteppedScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F8E1C85129083B000D2035F /* SteppedScatterPlot.m */; }; + C34CB58E1BC9B1C1009270A0 /* SimplePieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FF9F12342D7C006BF615 /* SimplePieChart.m */; }; + C34CB58F1BC9B1C1009270A0 /* SimpleScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA112342D7C006BF615 /* SimpleScatterPlot.m */; }; + C34CB5901BC9B1C1009270A0 /* VerticalBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = 4F22FFA312342D7C006BF615 /* VerticalBarChart.m */; }; C354C0D713C7CDBE00DA8822 /* RealTimePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C354C0D613C7CDBE00DA8822 /* RealTimePlot.m */; }; C35597961437E07800B41DA7 /* ControlChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C35597951437E07800B41DA7 /* ControlChart.m */; }; + C357EA9D1F708E870060CF48 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C30D8B181BCAF99D0003BB70 /* CorePlot.framework */; }; C360E1C613B18AAF007994B6 /* OHLCPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1C513B18AAF007994B6 /* OHLCPlot.m */; }; C360E1E013B18CAF007994B6 /* CandlestickPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C360E1DF13B18CAE007994B6 /* CandlestickPlot.m */; }; C367249313E103910070F47A /* LineCapDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C367249213E103910070F47A /* LineCapDemo.m */; }; - C367EEE21BCAEA9E00A21FE7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D2FE6219FF1D03002CD4D6 /* Images.xcassets */; settings = {ASSET_TAGS = (); }; }; + C367EEE21BCAEA9E00A21FE7 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D2FE6219FF1D03002CD4D6 /* Images.xcassets */; }; C39C4E4113BFE1A900CD9194 /* LabelingPolicyDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C39C4E4013BFE1A900CD9194 /* LabelingPolicyDemo.m */; }; C39C4E4413BFE1B400CD9194 /* PlotSpaceDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C39C4E4313BFE1B400CD9194 /* PlotSpaceDemo.m */; }; C3A14BEC13AEB7E700D103EA /* RangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A14BEB13AEB7E700D103EA /* RangePlot.m */; }; C3A31A5614DF782A00734AB7 /* ColoredBarChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A31A5514DF782A00734AB7 /* ColoredBarChart.m */; }; C3AC1410150EDE5C00631001 /* CurvedScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F42A2714D3A75F0044B323 /* CurvedScatterPlot.m */; }; + C3B9C26F1BCB237000BD560B /* DetailViewControllerTV.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B9C26A1BCB237000BD560B /* DetailViewControllerTV.m */; }; + C3B9C2701BCB237000BD560B /* RootViewControllerTV.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B9C26C1BCB237000BD560B /* RootViewControllerTV.m */; }; + C3B9C2711BCB237000BD560B /* ThemeTableViewControllerTV.m in Sources */ = {isa = PBXBuildFile; fileRef = C3B9C26E1BCB237000BD560B /* ThemeTableViewControllerTV.m */; }; + C3D0A1B720E0187600BA2921 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1B920E0187600BA2921 /* Main.storyboard */; }; + C3D0A1C420E0188800BA2921 /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1C620E0188800BA2921 /* Launch Screen.xib */; }; + C3D0A1C820E018DE00BA2921 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1CA20E018DE00BA2921 /* Main.storyboard */; }; C3D2FE6319FF1D03002CD4D6 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D2FE6219FF1D03002CD4D6 /* Images.xcassets */; }; C3D70BA6175EB29E00F27173 /* ImageDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D70BA5175EB29E00F27173 /* ImageDemo.m */; }; C3EF42FD19FC75810060791A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3EF42FC19FC75810060791A /* Images.xcassets */; }; C3F34F1512AB2598008FBDC3 /* DonutChart.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F34F1412AB2598008FBDC3 /* DonutChart.m */; }; + C3F6216C1C9F365100301061 /* CurvedInterpolationDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = E9595DFB1C9973B9004129DA /* CurvedInterpolationDemo.m */; }; C3F97F1917A9DE2000A52FF2 /* FunctionPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F97F1817A9DE2000A52FF2 /* FunctionPlot.m */; }; + E9595DFC1C9973B9004129DA /* CurvedInterpolationDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = E9595DFB1C9973B9004129DA /* CurvedInterpolationDemo.m */; }; + E9AB989C1C9A903700D23875 /* CurvedInterpolationDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = E9595DFB1C9973B9004129DA /* CurvedInterpolationDemo.m */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -115,6 +155,27 @@ remoteGlobalIDString = C38A09771A46185200D45436; remoteInfo = "CorePlot iOS"; }; + C30D8B171BCAF99D0003BB70 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4F35EC1D1236AE6E007C3389 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C30D8B191BCAF99D0003BB70 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4F35EC1D1236AE6E007C3389 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; + C30D8B1E1BCAFC080003BB70 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 4F35EC1D1236AE6E007C3389 /* CorePlot.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = C37EA5C91BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; C34CB5791BC9B0D4009270A0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 4F35EC1D1236AE6E007C3389 /* CorePlot.xcodeproj */; @@ -184,10 +245,7 @@ 4F22FF4712342978006BF615 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = src/mac/main.m; sourceTree = ""; }; 4F22FF4A1234298E006BF615 /* Plot_Gallery_MacAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Plot_Gallery_MacAppDelegate.h; path = src/mac/Plot_Gallery_MacAppDelegate.h; sourceTree = ""; }; 4F22FF4B1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = Plot_Gallery_MacAppDelegate.m; path = src/mac/Plot_Gallery_MacAppDelegate.m; sourceTree = ""; }; - 4F22FF5812342A21006BF615 /* English */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = English; path = InfoPlist.strings; sourceTree = ""; }; - 4F22FF5A12342A21006BF615 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = MainMenu.xib; sourceTree = ""; }; 4F22FF7B12342B5A006BF615 /* Plot_Gallery_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Plot_Gallery_Prefix.pch; sourceTree = ""; }; - 4F22FF7C12342B6E006BF615 /* Plot_Gallery_Mac-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Plot_Gallery_Mac-Info.plist"; sourceTree = ""; }; 4F22FF9A12342D7C006BF615 /* CompositePlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = CompositePlot.h; path = src/plots/CompositePlot.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4F22FF9B12342D7C006BF615 /* CompositePlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = CompositePlot.m; path = src/plots/CompositePlot.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4F22FF9C12342D7C006BF615 /* GradientScatterPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = GradientScatterPlot.h; path = src/plots/GradientScatterPlot.h; sourceTree = ""; }; @@ -203,7 +261,6 @@ 4F22FFAD12342DB1006BF615 /* PlotItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = PlotItem.h; path = src/shared/PlotItem.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4F22FFAE12342DB1006BF615 /* PlotItem.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PlotItem.m; path = src/shared/PlotItem.m; sourceTree = ""; }; 4F22FFE7123431D2006BF615 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; }; - 4F35EBBC12360D89007C3389 /* Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Icon.icns; path = src/mac/Icon.icns; sourceTree = ""; }; 4F35EBF3123611E3007C3389 /* PlotGalleryController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlotGalleryController.h; path = src/mac/PlotGalleryController.h; sourceTree = ""; }; 4F35EBF4123611E3007C3389 /* PlotGalleryController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PlotGalleryController.m; path = src/mac/PlotGalleryController.m; sourceTree = ""; }; 4F35EBF5123611E3007C3389 /* PlotView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlotView.h; path = src/mac/PlotView.h; sourceTree = ""; }; @@ -216,22 +273,37 @@ 4F8E1CC012908B0000D2035F /* AxisDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AxisDemo.h; path = src/plots/AxisDemo.h; sourceTree = ""; }; 4F8E1CC112908B0000D2035F /* AxisDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = AxisDemo.m; path = src/plots/AxisDemo.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 8D1107320486CEB800E47090 /* Plot Gallery.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Plot Gallery.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + C309C23323B3E12500DEDE9D /* PlotViewItem.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = PlotViewItem.xib; path = "Plot Gallery-Mac/PlotViewItem.xib"; sourceTree = ""; }; + C309C23523B3E21500DEDE9D /* PlotViewItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = PlotViewItem.m; path = src/mac/PlotViewItem.m; sourceTree = ""; }; + C309C23723B3E29F00DEDE9D /* PlotViewItem.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PlotViewItem.h; path = src/mac/PlotViewItem.h; sourceTree = ""; }; + C30D8AF61BCAF99D0003BB70 /* Plot Gallery tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Plot Gallery tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; + C30D8AF91BCAF99D0003BB70 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = main.m; path = src/tvOS/main.m; sourceTree = ""; }; + C30D8AFB1BCAF99D0003BB70 /* AppDelegateTV.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AppDelegateTV.h; path = src/tvOS/AppDelegateTV.h; sourceTree = ""; }; + C30D8AFC1BCAF99D0003BB70 /* AppDelegateTV.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; name = AppDelegateTV.m; path = src/tvOS/AppDelegateTV.m; sourceTree = ""; }; + C30D8B071BCAF99D0003BB70 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = "Plot Gallery-tvOS/Assets.xcassets"; sourceTree = ""; }; + C30D8B3A1BCAFFAE0003BB70 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; }; + C30D8B3C1BCAFFB50003BB70 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; + C30D8B3E1BCAFFBB0003BB70 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; + C30D8B401BCAFFC10003BB70 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + C30D8B421BCAFFCB0003BB70 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; + C32D229D23B1086600043720 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = src/mac/Base.lproj/MainMenu.xib; sourceTree = ""; }; C3457A4B17AD7C5D000880F3 /* PiNumberFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PiNumberFormatter.h; path = src/shared/PiNumberFormatter.h; sourceTree = ""; }; C3457A4C17AD7C5D000880F3 /* PiNumberFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = PiNumberFormatter.m; path = src/shared/PiNumberFormatter.m; sourceTree = ""; }; + C3490DCC20E025660089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/Plot_Gallery_Mac-Info.plist"; sourceTree = ""; }; + C3490DD920E025760089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Base; path = Base.lproj/Icon.icns; sourceTree = ""; }; + C3490DDB20E025B60089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/Plot_Gallery_iOS-Info.plist"; sourceTree = ""; }; + C3490DDF20E026410089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/Plot_Gallery_tvOS-Info.plist"; sourceTree = ""; }; C34CB52E1BC9A76A009270A0 /* Plot Gallery-iOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "Plot Gallery-iOS.app"; sourceTree = BUILT_PRODUCTS_DIR; }; C34CB5451BC9A83C009270A0 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = "Plot Gallery-iOS/Images.xcassets"; sourceTree = ""; }; C34CB5471BC9A889009270A0 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AppDelegate.h; path = src/ios/AppDelegate.h; sourceTree = ""; }; C34CB5481BC9A889009270A0 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = AppDelegate.m; path = src/ios/AppDelegate.m; sourceTree = ""; }; C34CB5491BC9A889009270A0 /* DetailViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetailViewController.h; path = src/ios/DetailViewController.h; sourceTree = ""; }; C34CB54A1BC9A889009270A0 /* DetailViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DetailViewController.m; path = src/ios/DetailViewController.m; sourceTree = ""; }; - C34CB54B1BC9A889009270A0 /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = "Launch Screen.xib"; path = "src/ios/Launch Screen.xib"; sourceTree = ""; }; C34CB54C1BC9A889009270A0 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = src/ios/main.m; sourceTree = ""; }; - C34CB54D1BC9A889009270A0 /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = Main.storyboard; path = src/ios/Main.storyboard; sourceTree = ""; }; C34CB5501BC9A889009270A0 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RootViewController.h; path = src/ios/RootViewController.h; sourceTree = ""; }; C34CB5511BC9A889009270A0 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RootViewController.m; path = src/ios/RootViewController.m; sourceTree = ""; }; C34CB5521BC9A889009270A0 /* ThemeTableViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThemeTableViewController.h; path = src/ios/ThemeTableViewController.h; sourceTree = ""; }; C34CB5531BC9A889009270A0 /* ThemeTableViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ThemeTableViewController.m; path = src/ios/ThemeTableViewController.m; sourceTree = ""; }; - C34CB55D1BC9A936009270A0 /* Plot_Gallery_iOS-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "Plot_Gallery_iOS-Info.plist"; sourceTree = ""; }; C34CB55F1BC9AB7B009270A0 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; C34CB5611BC9AB85009270A0 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; C34CB5631BC9AB8C009270A0 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.0.sdk/System/Library/Frameworks/CoreGraphics.framework; sourceTree = DEVELOPER_DIR; }; @@ -255,7 +327,16 @@ C3A14BEB13AEB7E700D103EA /* RangePlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RangePlot.m; path = src/plots/RangePlot.m; sourceTree = ""; }; C3A31A5414DF782A00734AB7 /* ColoredBarChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ColoredBarChart.h; path = src/plots/ColoredBarChart.h; sourceTree = ""; }; C3A31A5514DF782A00734AB7 /* ColoredBarChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ColoredBarChart.m; path = src/plots/ColoredBarChart.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + C3B9C2691BCB237000BD560B /* DetailViewControllerTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DetailViewControllerTV.h; path = src/tvOS/DetailViewControllerTV.h; sourceTree = ""; }; + C3B9C26A1BCB237000BD560B /* DetailViewControllerTV.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = DetailViewControllerTV.m; path = src/tvOS/DetailViewControllerTV.m; sourceTree = ""; }; + C3B9C26B1BCB237000BD560B /* RootViewControllerTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RootViewControllerTV.h; path = src/tvOS/RootViewControllerTV.h; sourceTree = ""; }; + C3B9C26C1BCB237000BD560B /* RootViewControllerTV.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = RootViewControllerTV.m; path = src/tvOS/RootViewControllerTV.m; sourceTree = ""; }; + C3B9C26D1BCB237000BD560B /* ThemeTableViewControllerTV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThemeTableViewControllerTV.h; path = src/tvOS/ThemeTableViewControllerTV.h; sourceTree = ""; }; + C3B9C26E1BCB237000BD560B /* ThemeTableViewControllerTV.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = ThemeTableViewControllerTV.m; path = src/tvOS/ThemeTableViewControllerTV.m; sourceTree = ""; }; C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3D0A1B820E0187600BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + C3D0A1C520E0188800BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = "Base.lproj/Launch Screen.xib"; sourceTree = ""; }; + C3D0A1C920E018DE00BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; C3D2FE6219FF1D03002CD4D6 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = img/Images.xcassets; sourceTree = ""; }; C3D70BA4175EB29E00F27173 /* ImageDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageDemo.h; path = src/plots/ImageDemo.h; sourceTree = ""; }; C3D70BA5175EB29E00F27173 /* ImageDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = ImageDemo.m; path = src/plots/ImageDemo.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; @@ -266,6 +347,8 @@ C3F42A2714D3A75F0044B323 /* CurvedScatterPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 2; name = CurvedScatterPlot.m; path = src/plots/CurvedScatterPlot.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C3F97F1717A9DE2000A52FF2 /* FunctionPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FunctionPlot.h; path = src/plots/FunctionPlot.h; sourceTree = ""; }; C3F97F1817A9DE2000A52FF2 /* FunctionPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = FunctionPlot.m; path = src/plots/FunctionPlot.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + E9595DFA1C9973B9004129DA /* CurvedInterpolationDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CurvedInterpolationDemo.h; path = src/plots/CurvedInterpolationDemo.h; sourceTree = ""; }; + E9595DFB1C9973B9004129DA /* CurvedInterpolationDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CurvedInterpolationDemo.m; path = src/plots/CurvedInterpolationDemo.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -279,12 +362,23 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C30D8AF31BCAF99D0003BB70 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C30D8B3D1BCAFFB50003BB70 /* CoreGraphics.framework in Frameworks */, + C30D8B411BCAFFC10003BB70 /* Foundation.framework in Frameworks */, + C30D8B3F1BCAFFBB0003BB70 /* QuartzCore.framework in Frameworks */, + C30D8B431BCAFFCB0003BB70 /* UIKit.framework in Frameworks */, + C357EA9D1F708E870060CF48 /* CorePlot.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; C34CB52B1BC9A76A009270A0 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( C30B12431BCADD300084C567 /* CorePlot.framework in Frameworks */, - C34CB5681BC9AB9E009270A0 /* Accelerate.framework in Frameworks */, C34CB5641BC9AB8C009270A0 /* CoreGraphics.framework in Frameworks */, C34CB5601BC9AB7B009270A0 /* Foundation.framework in Frameworks */, C34CB5661BC9AB93009270A0 /* QuartzCore.framework in Frameworks */, @@ -303,6 +397,8 @@ 4F35EBF4123611E3007C3389 /* PlotGalleryController.m */, 4F35EBF5123611E3007C3389 /* PlotView.h */, 4F35EBF6123611E3007C3389 /* PlotView.m */, + C309C23723B3E29F00DEDE9D /* PlotViewItem.h */, + C309C23523B3E21500DEDE9D /* PlotViewItem.m */, 4F22FF4712342978006BF615 /* main.m */, 4F22FF4A1234298E006BF615 /* Plot_Gallery_MacAppDelegate.h */, 4F22FF4B1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m */, @@ -315,6 +411,7 @@ children = ( 8D1107320486CEB800E47090 /* Plot Gallery.app */, C34CB52E1BC9A76A009270A0 /* Plot Gallery-iOS.app */, + C30D8AF61BCAF99D0003BB70 /* Plot Gallery tvOS.app */, ); name = Products; sourceTree = ""; @@ -326,6 +423,7 @@ 4F22FF9812342D54006BF615 /* Shared */, 080E96DDFE201D6D7F000001 /* Mac */, C33821B11BC9A54100CF8FF6 /* iOS */, + C30D8B1C1BCAF9D10003BB70 /* tvOS */, 4F22FF9912342D5F006BF615 /* Plots */, 29B97315FDCFA39411CA2CEA /* Other Sources */, 29B97323FDCFA39411CA2CEA /* Frameworks */, @@ -349,10 +447,10 @@ isa = PBXGroup; children = ( C3EF42FC19FC75810060791A /* Images.xcassets */, - 4F35EBBC12360D89007C3389 /* Icon.icns */, - 4F22FF7C12342B6E006BF615 /* Plot_Gallery_Mac-Info.plist */, - 4F22FF5912342A21006BF615 /* MainMenu.xib */, - 4F22FF5712342A21006BF615 /* InfoPlist.strings */, + C3490DDA20E025760089F309 /* Icon.icns */, + C32D229C23B1086600043720 /* MainMenu.xib */, + C309C23323B3E12500DEDE9D /* PlotViewItem.xib */, + C3490DCD20E025660089F309 /* Plot_Gallery_Mac-Info.plist */, ); name = Resources; sourceTree = ""; @@ -360,6 +458,11 @@ 29B97323FDCFA39411CA2CEA /* Frameworks */ = { isa = PBXGroup; children = ( + C30D8B421BCAFFCB0003BB70 /* UIKit.framework */, + C30D8B401BCAFFC10003BB70 /* Foundation.framework */, + C30D8B3E1BCAFFBB0003BB70 /* QuartzCore.framework */, + C30D8B3C1BCAFFB50003BB70 /* CoreGraphics.framework */, + C30D8B3A1BCAFFAE0003BB70 /* Accelerate.framework */, C34CB5911BC9B21F009270A0 /* Mac */, C34CB5921BC9B224009270A0 /* iOS */, ); @@ -396,6 +499,8 @@ C35597951437E07800B41DA7 /* ControlChart.m */, C3F42A2614D3A75F0044B323 /* CurvedScatterPlot.h */, C3F42A2714D3A75F0044B323 /* CurvedScatterPlot.m */, + E9595DFA1C9973B9004129DA /* CurvedInterpolationDemo.h */, + E9595DFB1C9973B9004129DA /* CurvedInterpolationDemo.m */, 4F8E1C12129077C200D2035F /* DatePlot.h */, 4F8E1C13129077C200D2035F /* DatePlot.m */, C3F34F1312AB2598008FBDC3 /* DonutChart.h */, @@ -439,10 +544,39 @@ C3D414711A7D824700B6F5D6 /* UnitTests iOS.xctest */, C3D414731A7D824700B6F5D6 /* libCorePlot-CocoaTouch.a */, C3D414751A7D824700B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, + C30D8B181BCAF99D0003BB70 /* CorePlot.framework */, + C30D8B1A1BCAF99D0003BB70 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; }; + C30D8B1C1BCAF9D10003BB70 /* tvOS */ = { + isa = PBXGroup; + children = ( + C30D8B1D1BCAF9E80003BB70 /* Resources */, + C30D8AF91BCAF99D0003BB70 /* main.m */, + C30D8AFB1BCAF99D0003BB70 /* AppDelegateTV.h */, + C30D8AFC1BCAF99D0003BB70 /* AppDelegateTV.m */, + C3B9C2691BCB237000BD560B /* DetailViewControllerTV.h */, + C3B9C26A1BCB237000BD560B /* DetailViewControllerTV.m */, + C3B9C26B1BCB237000BD560B /* RootViewControllerTV.h */, + C3B9C26C1BCB237000BD560B /* RootViewControllerTV.m */, + C3B9C26D1BCB237000BD560B /* ThemeTableViewControllerTV.h */, + C3B9C26E1BCB237000BD560B /* ThemeTableViewControllerTV.m */, + ); + name = tvOS; + sourceTree = ""; + }; + C30D8B1D1BCAF9E80003BB70 /* Resources */ = { + isa = PBXGroup; + children = ( + C30D8B071BCAF99D0003BB70 /* Assets.xcassets */, + C3490DE020E026410089F309 /* Plot_Gallery_tvOS-Info.plist */, + C3D0A1CA20E018DE00BA2921 /* Main.storyboard */, + ); + name = Resources; + sourceTree = ""; + }; C33821B11BC9A54100CF8FF6 /* iOS */ = { isa = PBXGroup; children = ( @@ -464,9 +598,9 @@ isa = PBXGroup; children = ( C34CB5451BC9A83C009270A0 /* Images.xcassets */, - C34CB55D1BC9A936009270A0 /* Plot_Gallery_iOS-Info.plist */, - C34CB54D1BC9A889009270A0 /* Main.storyboard */, - C34CB54B1BC9A889009270A0 /* Launch Screen.xib */, + C3490DDC20E025B60089F309 /* Plot_Gallery_iOS-Info.plist */, + C3D0A1B920E0187600BA2921 /* Main.storyboard */, + C3D0A1C620E0188800BA2921 /* Launch Screen.xib */, ); name = Resources; sourceTree = ""; @@ -517,6 +651,24 @@ productReference = 8D1107320486CEB800E47090 /* Plot Gallery.app */; productType = "com.apple.product-type.application"; }; + C30D8AF51BCAF99D0003BB70 /* Plot Gallery tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = C30D8B1B1BCAF99D0003BB70 /* Build configuration list for PBXNativeTarget "Plot Gallery tvOS" */; + buildPhases = ( + C30D8AF21BCAF99D0003BB70 /* Sources */, + C30D8AF31BCAF99D0003BB70 /* Frameworks */, + C30D8AF41BCAF99D0003BB70 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + C30D8B1F1BCAFC080003BB70 /* PBXTargetDependency */, + ); + name = "Plot Gallery tvOS"; + productName = "Plot Gallery tvOS"; + productReference = C30D8AF61BCAF99D0003BB70 /* Plot Gallery tvOS.app */; + productType = "com.apple.product-type.application"; + }; C34CB52D1BC9A76A009270A0 /* Plot Gallery-iOS */ = { isa = PBXNativeTarget; buildConfigurationList = C34CB5421BC9A76A009270A0 /* Build configuration list for PBXNativeTarget "Plot Gallery-iOS" */; @@ -543,8 +695,12 @@ 29B97313FDCFA39411CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1100; TargetAttributes = { + C30D8AF51BCAF99D0003BB70 = { + CreatedOnToolsVersion = 7.1; + DevelopmentTeam = 28ZA45DE7D; + }; C34CB52D1BC9A76A009270A0 = { CreatedOnToolsVersion = 7.0.1; DevelopmentTeam = 28ZA45DE7D; @@ -553,14 +709,14 @@ }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Plot_Gallery" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, Base, + en, + fr, + ja, + de, ); mainGroup = 29B97314FDCFA39411CA2CEA /* Plot Gallery-Mac */; projectDirPath = ""; @@ -574,6 +730,7 @@ targets = ( 8D1107260486CEB800E47090 /* Plot Gallery-Mac */, C34CB52D1BC9A76A009270A0 /* Plot Gallery-iOS */, + C30D8AF51BCAF99D0003BB70 /* Plot Gallery tvOS */, ); }; /* End PBXProject section */ @@ -593,6 +750,20 @@ remoteRef = 4F48928A1290FFCD00EDB93F /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + C30D8B181BCAF99D0003BB70 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C30D8B171BCAF99D0003BB70 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C30D8B1A1BCAF99D0003BB70 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C30D8B191BCAF99D0003BB70 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3D4146F1A7D824700B6F5D6 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -629,10 +800,20 @@ buildActionMask = 2147483647; files = ( C3D2FE6319FF1D03002CD4D6 /* Images.xcassets in Resources */, - 4F22FF5B12342A21006BF615 /* InfoPlist.strings in Resources */, + C32D229E23B1086600043720 /* MainMenu.xib in Resources */, C3EF42FD19FC75810060791A /* Images.xcassets in Resources */, - 4F22FF5C12342A21006BF615 /* MainMenu.xib in Resources */, - 4F35EBBD12360D89007C3389 /* Icon.icns in Resources */, + C3490DD820E025760089F309 /* Icon.icns in Resources */, + C309C23423B3E12500DEDE9D /* PlotViewItem.xib in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C30D8AF41BCAF99D0003BB70 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C30D8B211BCAFD3E0003BB70 /* Images.xcassets in Resources */, + C30D8B081BCAF99D0003BB70 /* Assets.xcassets in Resources */, + C3D0A1C820E018DE00BA2921 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -642,8 +823,8 @@ files = ( C34CB5461BC9A83C009270A0 /* Images.xcassets in Resources */, C367EEE21BCAEA9E00A21FE7 /* Images.xcassets in Resources */, - C34CB5581BC9A889009270A0 /* Main.storyboard in Resources */, - C34CB5561BC9A889009270A0 /* Launch Screen.xib in Resources */, + C3D0A1B720E0187600BA2921 /* Main.storyboard in Resources */, + C3D0A1C420E0188800BA2921 /* Launch Screen.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -654,6 +835,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( + C309C23623B3E21500DEDE9D /* PlotViewItem.m in Sources */, 4F22FF4912342978006BF615 /* main.m in Sources */, 4F22FF4C1234298E006BF615 /* Plot_Gallery_MacAppDelegate.m in Sources */, 4F22FFA412342D7C006BF615 /* CompositePlot.m in Sources */, @@ -675,6 +857,7 @@ C39C4E4113BFE1A900CD9194 /* LabelingPolicyDemo.m in Sources */, C39C4E4413BFE1B400CD9194 /* PlotSpaceDemo.m in Sources */, C354C0D713C7CDBE00DA8822 /* RealTimePlot.m in Sources */, + E9595DFC1C9973B9004129DA /* CurvedInterpolationDemo.m in Sources */, C367249313E103910070F47A /* LineCapDemo.m in Sources */, C35597961437E07800B41DA7 /* ControlChart.m in Sources */, C3A31A5614DF782A00734AB7 /* ColoredBarChart.m in Sources */, @@ -685,6 +868,43 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C30D8AF21BCAF99D0003BB70 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C3F6216C1C9F365100301061 /* CurvedInterpolationDemo.m in Sources */, + C30D8B301BCAFDE20003BB70 /* LabelingPolicyDemo.m in Sources */, + C30D8B291BCAFDE20003BB70 /* ControlChart.m in Sources */, + C30D8B2B1BCAFDE20003BB70 /* DatePlot.m in Sources */, + C30D8B2E1BCAFDE20003BB70 /* GradientScatterPlot.m in Sources */, + C30D8B2F1BCAFDE20003BB70 /* ImageDemo.m in Sources */, + C30D8B261BCAFDE20003BB70 /* CandlestickPlot.m in Sources */, + C30D8B361BCAFDE20003BB70 /* SteppedScatterPlot.m in Sources */, + C30D8AFD1BCAF99D0003BB70 /* AppDelegateTV.m in Sources */, + C30D8B391BCAFDE20003BB70 /* VerticalBarChart.m in Sources */, + C3B9C26F1BCB237000BD560B /* DetailViewControllerTV.m in Sources */, + C30D8B231BCAFD3E0003BB70 /* PlotGallery.m in Sources */, + C30D8B221BCAFD3E0003BB70 /* PlotItem.m in Sources */, + C30D8B351BCAFDE20003BB70 /* RealTimePlot.m in Sources */, + C30D8B2C1BCAFDE20003BB70 /* DonutChart.m in Sources */, + C30D8B281BCAFDE20003BB70 /* CompositePlot.m in Sources */, + C30D8B311BCAFDE20003BB70 /* LineCapDemo.m in Sources */, + C30D8AFA1BCAF99D0003BB70 /* main.m in Sources */, + C30D8B371BCAFDE20003BB70 /* SimplePieChart.m in Sources */, + C30D8B241BCAFD3E0003BB70 /* PiNumberFormatter.m in Sources */, + C30D8B331BCAFDE20003BB70 /* PlotSpaceDemo.m in Sources */, + C30D8B321BCAFDE20003BB70 /* OHLCPlot.m in Sources */, + C30D8B341BCAFDE20003BB70 /* RangePlot.m in Sources */, + C30D8B251BCAFDE20003BB70 /* AxisDemo.m in Sources */, + C30D8B271BCAFDE20003BB70 /* ColoredBarChart.m in Sources */, + C3B9C2711BCB237000BD560B /* ThemeTableViewControllerTV.m in Sources */, + C30D8B2D1BCAFDE20003BB70 /* FunctionPlot.m in Sources */, + C30D8B2A1BCAFDE20003BB70 /* CurvedScatterPlot.m in Sources */, + C30D8B381BCAFDE20003BB70 /* SimpleScatterPlot.m in Sources */, + C3B9C2701BCB237000BD560B /* RootViewControllerTV.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; C34CB52A1BC9A76A009270A0 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -696,6 +916,7 @@ C34CB5871BC9B1C1009270A0 /* LabelingPolicyDemo.m in Sources */, C34CB5801BC9B1C1009270A0 /* ControlChart.m in Sources */, C34CB5831BC9B1C1009270A0 /* DonutChart.m in Sources */, + E9AB989C1C9A903700D23875 /* CurvedInterpolationDemo.m in Sources */, C34CB5811BC9B1C1009270A0 /* CurvedScatterPlot.m in Sources */, C34CB5861BC9B1C1009270A0 /* ImageDemo.m in Sources */, C34CB5541BC9A889009270A0 /* AppDelegate.m in Sources */, @@ -734,6 +955,11 @@ name = "CorePlot iOS"; targetProxy = C30B12451BCADD300084C567 /* PBXContainerItemProxy */; }; + C30D8B1F1BCAFC080003BB70 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = "CorePlot tvOS"; + targetProxy = C30D8B1E1BCAFC080003BB70 /* PBXContainerItemProxy */; + }; C34CB57A1BC9B0D4009270A0 /* PBXTargetDependency */ = { isa = PBXTargetDependency; name = "CorePlot iOS"; @@ -742,22 +968,72 @@ /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ - 4F22FF5712342A21006BF615 /* InfoPlist.strings */ = { + C32D229C23B1086600043720 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - 4F22FF5812342A21006BF615 /* English */, + C32D229D23B1086600043720 /* Base */, ); - name = InfoPlist.strings; - path = src/mac/English.lproj; + name = MainMenu.xib; sourceTree = ""; }; - 4F22FF5912342A21006BF615 /* MainMenu.xib */ = { + C3490DCD20E025660089F309 /* Plot_Gallery_Mac-Info.plist */ = { isa = PBXVariantGroup; children = ( - 4F22FF5A12342A21006BF615 /* English */, + C3490DCC20E025660089F309 /* Base */, ); - name = MainMenu.xib; - path = src/mac/English.lproj; + name = "Plot_Gallery_Mac-Info.plist"; + sourceTree = ""; + }; + C3490DDA20E025760089F309 /* Icon.icns */ = { + isa = PBXVariantGroup; + children = ( + C3490DD920E025760089F309 /* Base */, + ); + name = Icon.icns; + path = src/mac; + sourceTree = ""; + }; + C3490DDC20E025B60089F309 /* Plot_Gallery_iOS-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DDB20E025B60089F309 /* Base */, + ); + name = "Plot_Gallery_iOS-Info.plist"; + sourceTree = ""; + }; + C3490DE020E026410089F309 /* Plot_Gallery_tvOS-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DDF20E026410089F309 /* Base */, + ); + name = "Plot_Gallery_tvOS-Info.plist"; + sourceTree = ""; + }; + C3D0A1B920E0187600BA2921 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1B820E0187600BA2921 /* Base */, + ); + name = Main.storyboard; + path = src/ios; + sourceTree = ""; + }; + C3D0A1C620E0188800BA2921 /* Launch Screen.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1C520E0188800BA2921 /* Base */, + ); + name = "Launch Screen.xib"; + path = src/ios; + sourceTree = ""; + }; + C3D0A1CA20E018DE00BA2921 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1C920E018DE00BA2921 /* Base */, + ); + name = Main.storyboard; + path = src/tvOS; sourceTree = ""; }; /* End PBXVariantGroup section */ @@ -767,20 +1043,17 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Plot_Gallery_Prefix.pch; - INFOPLIST_FILE = "Plot_Gallery_Mac-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_Mac-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.11; OTHER_LDFLAGS = ( "-ObjC", "-all_load", @@ -788,6 +1061,7 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.Plot-Gallery-Mac"; PRODUCT_NAME = "Plot Gallery"; RUN_CLANG_STATIC_ANALYZER = YES; + SDKROOT = macosx; VALID_ARCHS = "i386 x86_64"; }; name = Debug; @@ -796,19 +1070,16 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = s; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Plot_Gallery_Prefix.pch; - INFOPLIST_FILE = "Plot_Gallery_Mac-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_Mac-Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.11; OTHER_LDFLAGS = ( "-ObjC", "-all_load", @@ -816,80 +1087,122 @@ PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.Plot-Gallery-Mac"; PRODUCT_NAME = "Plot Gallery"; RUN_CLANG_STATIC_ANALYZER = YES; + SDKROOT = macosx; VALID_ARCHS = "i386 x86_64"; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Plot_Gallery_Prefix.pch; ONLY_ACTIVE_ARCH = YES; OTHER_LDFLAGS = ( "-ObjC", "-all_load", ); - SDKROOT = macosx; SYMROOT = "$(PROJECT_DIR)/../../build"; }; name = Debug; }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = Plot_Gallery_Prefix.pch; OTHER_LDFLAGS = ( "-ObjC", "-all_load", ); - SDKROOT = macosx; SYMROOT = "$(PROJECT_DIR)/../../build"; }; name = Release; }; + C30D8B0A1BCAF99D0003BB70 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_tvOS-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.Plot-Gallery-tvOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + C30D8B0B1BCAF99D0003BB70 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = "App Icon & Top Shelf Image"; + ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_OBJC_ARC = YES; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + GCC_NO_COMMON_BLOCKS = YES; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_tvOS-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.Plot-Gallery-tvOS"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; C34CB5431BC9A76A009270A0 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; COPY_PHASE_STRIP = NO; DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_DYNAMIC_NO_PIC = NO; GCC_NO_COMMON_BLOCKS = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Plot_Gallery_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ( "DEBUG=1", "$(inherited)", ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - INFOPLIST_FILE = "Plot_Gallery_iOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_iOS-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; @@ -904,34 +1217,16 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C0DF2719D86B5E00631CAD /* CorePlotWarnings.xcconfig */; buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; COPY_PHASE_STRIP = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_NO_COMMON_BLOCKS = YES; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Plot_Gallery_Prefix.pch; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - INFOPLIST_FILE = "Plot_Gallery_iOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Plot_Gallery_iOS-Info.plist"; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; @@ -964,6 +1259,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + C30D8B1B1BCAF99D0003BB70 /* Build configuration list for PBXNativeTarget "Plot Gallery tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C30D8B0A1BCAF99D0003BB70 /* Debug */, + C30D8B0B1BCAF99D0003BB70 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; C34CB5421BC9A76A009270A0 /* Build configuration list for PBXNativeTarget "Plot Gallery-iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-Mac.xcscheme b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-Mac.xcscheme new file mode 100644 index 000000000..d03877413 --- /dev/null +++ b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-Mac.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-iOS.xcscheme b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-iOS.xcscheme new file mode 100644 index 000000000..a45febfc8 --- /dev/null +++ b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-iOS.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-tvOS.xcscheme b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-tvOS.xcscheme new file mode 100644 index 000000000..d0f30ca9a --- /dev/null +++ b/examples/CorePlotGallery/Plot_Gallery.xcodeproj/xcshareddata/xcschemes/Plot Gallery-tvOS.xcscheme @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CorePlotGallery/Plot_Gallery_Prefix.pch b/examples/CorePlotGallery/Plot_Gallery_Prefix.pch index 919ef2bfe..e76705a48 100644 --- a/examples/CorePlotGallery/Plot_Gallery_Prefix.pch +++ b/examples/CorePlotGallery/Plot_Gallery_Prefix.pch @@ -4,7 +4,7 @@ #ifdef __OBJC__ #import - #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE + #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV #import #import #else diff --git a/examples/CorePlotGallery/src/ios/AppDelegate.h b/examples/CorePlotGallery/src/ios/AppDelegate.h index c39b0224c..b0a134582 100644 --- a/examples/CorePlotGallery/src/ios/AppDelegate.h +++ b/examples/CorePlotGallery/src/ios/AppDelegate.h @@ -1,12 +1,12 @@ // -// AppDelegate.h -// CorePlotGallery +// AppDelegate.h +// CorePlotGallery // #import @interface AppDelegate : UIResponder -@property (nonatomic, readwrite, strong) UIWindow *window; +@property (nonatomic, readwrite, strong, nullable) UIWindow *window; @end diff --git a/examples/CorePlotGallery/src/ios/AppDelegate.m b/examples/CorePlotGallery/src/ios/AppDelegate.m index 0b50f831b..e3bafe91b 100644 --- a/examples/CorePlotGallery/src/ios/AppDelegate.m +++ b/examples/CorePlotGallery/src/ios/AppDelegate.m @@ -1,6 +1,6 @@ // -// AppDelegate.m -// CorePlotGallery +// AppDelegate.m +// CorePlotGallery // #import "AppDelegate.h" @@ -18,14 +18,14 @@ @implementation AppDelegate @synthesize window; --(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(CPTDictionary)launchOptions +-(BOOL)application:(nonnull UIApplication *__unused)application didFinishLaunchingWithOptions:(nullable CPTDictionary *__unused)launchOptions { [[PlotGallery sharedPlotGallery] sortByTitle]; UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController; splitViewController.delegate = self; - UINavigationController *navigationController = [splitViewController.viewControllers lastObject]; + UINavigationController *navigationController = splitViewController.viewControllers.lastObject; navigationController.topViewController.navigationItem.leftBarButtonItem = splitViewController.displayModeButtonItem; return YES; @@ -33,9 +33,9 @@ -(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(C #pragma mark - Split view --(BOOL)splitViewController:(UISplitViewController *)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *)primaryViewController +-(BOOL)splitViewController:(UISplitViewController *__unused)splitViewController collapseSecondaryViewController:(UIViewController *)secondaryViewController ontoPrimaryViewController:(UIViewController *__unused)primaryViewController { - if ( [secondaryViewController isKindOfClass:[UINavigationController class]] && [[(UINavigationController *)secondaryViewController topViewController] isKindOfClass:[DetailViewController class]] && ([(DetailViewController *)[(UINavigationController *)secondaryViewController topViewController] detailItem] == nil) ) { + if ( [secondaryViewController isKindOfClass:[UINavigationController class]] && [((UINavigationController *)secondaryViewController).topViewController isKindOfClass:[DetailViewController class]] && (((DetailViewController *)((UINavigationController *)secondaryViewController).topViewController).detailItem == nil)) { // Return YES to indicate that we have handled the collapse by doing nothing; the secondary controller will be discarded. return YES; } diff --git a/examples/CorePlotGallery/src/ios/Launch Screen.xib b/examples/CorePlotGallery/src/ios/Base.lproj/Launch Screen.xib similarity index 59% rename from examples/CorePlotGallery/src/ios/Launch Screen.xib rename to examples/CorePlotGallery/src/ios/Base.lproj/Launch Screen.xib index 3f2f3dbc8..8a42da815 100644 --- a/examples/CorePlotGallery/src/ios/Launch Screen.xib +++ b/examples/CorePlotGallery/src/ios/Base.lproj/Launch Screen.xib @@ -1,27 +1,28 @@ - - + + + + + - - + + - + - - - + diff --git a/examples/CorePlotGallery/src/ios/Main.storyboard b/examples/CorePlotGallery/src/ios/Base.lproj/Main.storyboard similarity index 84% rename from examples/CorePlotGallery/src/ios/Main.storyboard rename to examples/CorePlotGallery/src/ios/Base.lproj/Main.storyboard index 391428c19..949e2f780 100644 --- a/examples/CorePlotGallery/src/ios/Main.storyboard +++ b/examples/CorePlotGallery/src/ios/Base.lproj/Main.storyboard @@ -1,9 +1,12 @@ - - + + + + + - - + + @@ -11,8 +14,8 @@ + - @@ -31,17 +34,15 @@ - + - - - + + - - + @@ -66,37 +67,33 @@ - + - + - - + - + - + - - @@ -129,31 +126,27 @@ - + - - + - + - + - - - + @@ -171,13 +164,13 @@ - + - + + - diff --git a/examples/CorePlotGallery/src/ios/DetailViewController.h b/examples/CorePlotGallery/src/ios/DetailViewController.h index 5948c7918..fad34930c 100644 --- a/examples/CorePlotGallery/src/ios/DetailViewController.h +++ b/examples/CorePlotGallery/src/ios/DetailViewController.h @@ -1,18 +1,18 @@ // -// DetailViewController.h -// CorePlotGallery +// DetailViewController.h +// CorePlotGallery // @class PlotItem; @interface DetailViewController : UIViewController -@property (nonatomic, strong) PlotItem *detailItem; -@property (nonatomic, copy) NSString *currentThemeName; +@property (nonatomic, strong, nonnull) PlotItem *detailItem; +@property (nonatomic, copy, nonnull) NSString *currentThemeName; -@property (nonatomic, strong) IBOutlet UIView *hostingView; -@property (nonatomic, strong) IBOutlet UIBarButtonItem *themeBarButton; +@property (nonatomic, strong, nullable) IBOutlet UIView *hostingView; +@property (nonatomic, strong, nullable) IBOutlet UIBarButtonItem *themeBarButton; --(void)themeSelectedWithName:(NSString *)themeName; +-(void)themeSelectedWithName:(nonnull NSString *)themeName; @end diff --git a/examples/CorePlotGallery/src/ios/DetailViewController.m b/examples/CorePlotGallery/src/ios/DetailViewController.m index 715fe7878..9d787a9fa 100644 --- a/examples/CorePlotGallery/src/ios/DetailViewController.m +++ b/examples/CorePlotGallery/src/ios/DetailViewController.m @@ -1,6 +1,6 @@ // -// DetailViewController.m -// CorePlotGallery +// DetailViewController.m +// CorePlotGallery // #import "DetailViewController.h" @@ -10,12 +10,10 @@ @interface DetailViewController() --(CPTTheme *)currentTheme; - -@property (nonatomic, readwrite) UIPopoverController *themePopoverController; +-(nullable CPTTheme *)currentTheme; -(void)setupView; --(void)themeChanged:(NSNotification *)notification; +-(void)themeChanged:(nonnull NSNotification *)notification; @end @@ -27,7 +25,6 @@ @implementation DetailViewController @synthesize hostingView; @synthesize themeBarButton; @synthesize currentThemeName; -@synthesize themePopoverController; #pragma mark - #pragma mark Initialization and Memory Management @@ -39,17 +36,22 @@ -(void)setupView name:PlotGalleryThemeDidChangeNotification object:nil]; - [self.detailItem renderInView:self.hostingView withTheme:[self currentTheme] animated:YES]; + UIView *hostView = self.hostingView; + if ( hostView ) { + [self.detailItem renderInView:hostView withTheme:[self currentTheme] animated:YES]; + } } -(void)awakeFromNib { + [super awakeFromNib]; + [self setupView]; } --(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +-(nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil { - if ( (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) ) { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setupView]; } @@ -64,15 +66,16 @@ -(void)dealloc #pragma mark - #pragma mark Managing the detail item --(void)setDetailItem:(PlotItem *)newDetailItem +-(void)setDetailItem:(nonnull PlotItem *)newDetailItem { if ( detailItem != newDetailItem ) { [detailItem killGraph]; detailItem = newDetailItem; - if ( self.hostingView ) { - [detailItem renderInView:self.hostingView withTheme:[self currentTheme] animated:YES]; + UIView *hostView = self.hostingView; + if ( hostView ) { + [detailItem renderInView:hostView withTheme:[self currentTheme] animated:YES]; } } } @@ -90,7 +93,7 @@ -(void)viewDidAppear:(BOOL)animated #pragma mark - #pragma mark Theme Selection --(void)setCurrentThemeName:(NSString *)newThemeName +-(void)setCurrentThemeName:(nonnull NSString *)newThemeName { if ( newThemeName != currentThemeName ) { currentThemeName = [newThemeName copy]; @@ -99,7 +102,7 @@ -(void)setCurrentThemeName:(NSString *)newThemeName } } --(CPTTheme *)currentTheme +-(nullable CPTTheme *)currentTheme { CPTTheme *theme; @@ -116,18 +119,25 @@ -(CPTTheme *)currentTheme return theme; } --(void)themeSelectedWithName:(NSString *)themeName +-(void)themeSelectedWithName:(nonnull NSString *)themeName { self.currentThemeName = themeName; - [self.detailItem renderInView:self.hostingView withTheme:[self currentTheme] animated:YES]; + UIView *hostView = self.hostingView; + if ( hostView ) { + [self.detailItem renderInView:hostView withTheme:[self currentTheme] animated:YES]; + } } --(void)themeChanged:(NSNotification *)notification +-(void)themeChanged:(nonnull NSNotification *)notification { NSDictionary *themeInfo = notification.userInfo; - [self themeSelectedWithName:themeInfo[PlotGalleryThemeNameKey]]; + NSString *themeName = themeInfo[PlotGalleryThemeNameKey]; + + if ( themeName ) { + [self themeSelectedWithName:themeName]; + } } @end diff --git a/examples/CorePlotGallery/src/ios/RootViewController.h b/examples/CorePlotGallery/src/ios/RootViewController.h index 4b29ad39d..6318baa62 100644 --- a/examples/CorePlotGallery/src/ios/RootViewController.h +++ b/examples/CorePlotGallery/src/ios/RootViewController.h @@ -1,6 +1,6 @@ // -// RootViewController.h -// CorePlotGallery +// RootViewController.h +// CorePlotGallery // @interface RootViewController : UITableViewController diff --git a/examples/CorePlotGallery/src/ios/RootViewController.m b/examples/CorePlotGallery/src/ios/RootViewController.m index f1857bffb..9d81892b5 100644 --- a/examples/CorePlotGallery/src/ios/RootViewController.m +++ b/examples/CorePlotGallery/src/ios/RootViewController.m @@ -1,6 +1,6 @@ // -// RootViewController.m -// CorePlotGallery +// RootViewController.m +// CorePlotGallery // #import "RootViewController.h" @@ -13,9 +13,9 @@ @interface RootViewController() -@property (nonatomic, copy) NSString *currentThemeName; +@property (nonatomic, copy, nonnull) NSString *currentThemeName; --(void)themeChanged:(NSNotification *)notification; +-(void)themeChanged:(nonnull NSNotification *)notification; @end @@ -47,17 +47,17 @@ -(void)dealloc #pragma mark - #pragma mark Segues --(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender +-(void)prepareForSegue:(nonnull UIStoryboardSegue *)segue sender:(nullable id __unused)sender { if ( [segue.identifier isEqualToString:@"showDetail"] ) { - DetailViewController *controller = (DetailViewController *)[segue.destinationViewController topViewController]; + DetailViewController *controller = (DetailViewController *)((UINavigationController *)segue.destinationViewController).topViewController; controller.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem; controller.navigationItem.leftItemsSupplementBackButton = YES; controller.currentThemeName = self.currentThemeName; - NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow]; + NSIndexPath *indexPath = self.tableView.indexPathForSelectedRow; PlotItem *plotItem = [[PlotGallery sharedPlotGallery] objectInSection:[indexPath indexAtPosition:0] atIndex:[indexPath indexAtPosition:1]]; @@ -69,27 +69,31 @@ -(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender #pragma mark - #pragma mark Theme Selection --(void)themeChanged:(NSNotification *)notification +-(void)themeChanged:(nonnull NSNotification *)notification { NSDictionary *themeInfo = notification.userInfo; - self.currentThemeName = themeInfo[PlotGalleryThemeNameKey]; + NSString *themeName = themeInfo[PlotGalleryThemeNameKey]; + + if ( themeName ) { + self.currentThemeName = themeName; + } } #pragma mark - #pragma mark Table view data source --(NSInteger)numberOfSectionsInTableView:(UITableView *)tv +-(NSInteger)numberOfSectionsInTableView:(nonnull UITableView *__unused)tv { - return (NSInteger)[[PlotGallery sharedPlotGallery] numberOfSections]; + return (NSInteger)[PlotGallery sharedPlotGallery].numberOfSections; } --(NSInteger)tableView:(UITableView *)tv numberOfRowsInSection:(NSInteger)section +-(NSInteger)tableView:(nonnull UITableView *__unused)tv numberOfRowsInSection:(NSInteger)section { - return (NSInteger)[[PlotGallery sharedPlotGallery] numberOfRowsInSection : (NSUInteger)section]; + return (NSInteger)[[PlotGallery sharedPlotGallery] numberOfRowsInSection:(NSUInteger)section]; } --(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath +-(nonnull UITableViewCell *)tableView:(nonnull UITableView *)tv cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { static NSString *cellId = @"PlotCell"; @@ -108,9 +112,9 @@ -(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPa return cell; } --(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section +-(nullable NSString *)tableView:(nonnull UITableView *__unused)tableView titleForHeaderInSection:(NSInteger)section { - return [[PlotGallery sharedPlotGallery] sectionTitles][(NSUInteger)section]; + return [PlotGallery sharedPlotGallery].sectionTitles[(NSUInteger)section]; } @end diff --git a/examples/CorePlotGallery/src/ios/ThemeTableViewController.h b/examples/CorePlotGallery/src/ios/ThemeTableViewController.h index d7f28fe4e..4c14585c2 100644 --- a/examples/CorePlotGallery/src/ios/ThemeTableViewController.h +++ b/examples/CorePlotGallery/src/ios/ThemeTableViewController.h @@ -1,13 +1,13 @@ // -// ThemeTableViewController.h -// CorePlotGallery +// ThemeTableViewController.h +// CorePlotGallery // -extern NSString *const kThemeTableViewControllerNoTheme; -extern NSString *const kThemeTableViewControllerDefaultTheme; +extern NSString *__nonnull const kThemeTableViewControllerNoTheme; +extern NSString *__nonnull const kThemeTableViewControllerDefaultTheme; -extern NSString *const PlotGalleryThemeDidChangeNotification; -extern NSString *const PlotGalleryThemeNameKey; +extern NSString *__nonnull const PlotGalleryThemeDidChangeNotification; +extern NSString *__nonnull const PlotGalleryThemeNameKey; #pragma mark - diff --git a/examples/CorePlotGallery/src/ios/ThemeTableViewController.m b/examples/CorePlotGallery/src/ios/ThemeTableViewController.m index ba76fc8c3..a705f18cf 100644 --- a/examples/CorePlotGallery/src/ios/ThemeTableViewController.m +++ b/examples/CorePlotGallery/src/ios/ThemeTableViewController.m @@ -1,6 +1,6 @@ // -// ThemeTableViewController.m -// CorePlotGallery +// ThemeTableViewController.m +// CorePlotGallery // #import "ThemeTableViewController.h" @@ -15,7 +15,7 @@ @interface ThemeTableViewController() -@property (nonatomic, readwrite, strong) CPTMutableStringArray themes; +@property (nonatomic, readwrite, strong, nonnull) CPTMutableStringArray *themes; @end @@ -27,7 +27,7 @@ @implementation ThemeTableViewController -(void)setupThemes { - CPTMutableStringArray themeList = [[NSMutableArray alloc] init]; + CPTMutableStringArray *themeList = [[NSMutableArray alloc] init]; [themeList addObject:kThemeTableViewControllerDefaultTheme]; [themeList addObject:kThemeTableViewControllerNoTheme]; @@ -41,12 +41,14 @@ -(void)setupThemes -(void)awakeFromNib { + [super awakeFromNib]; + [self setupThemes]; } --(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +-(nonnull instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil { - if ( (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) ) { + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { [self setupThemes]; } @@ -56,17 +58,17 @@ -(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBu #pragma mark - #pragma mark Table view data source --(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +-(NSInteger)numberOfSectionsInTableView:(nonnull UITableView *__unused)tableView { return 1; } --(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +-(NSInteger)tableView:(nonnull UITableView *__unused)tableView numberOfRowsInSection:(NSInteger __unused)section { return (NSInteger)self.themes.count; } --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +-(nonnull UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(nonnull NSIndexPath *)indexPath { static NSString *CellIdentifier = @"ThemeCell"; @@ -84,10 +86,10 @@ -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NS #pragma mark - #pragma mark Table view delegate --(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +-(void)tableView:(nonnull UITableView *__unused)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath { NSDictionary *themeInfo = @{ - PlotGalleryThemeNameKey: self.themes[(NSUInteger)indexPath.row] + PlotGalleryThemeNameKey: self.themes[(NSUInteger)indexPath.row] }; [[NSNotificationCenter defaultCenter] postNotificationName:PlotGalleryThemeDidChangeNotification diff --git a/examples/CorePlotGallery/src/ios/main.m b/examples/CorePlotGallery/src/ios/main.m index b1abaa361..7f96dbbda 100644 --- a/examples/CorePlotGallery/src/ios/main.m +++ b/examples/CorePlotGallery/src/ios/main.m @@ -1,6 +1,6 @@ // -// main.m -// CorePlotGallery +// main.m +// CorePlotGallery // #import "AppDelegate.h" @@ -8,6 +8,6 @@ int main(int argc, char *argv[]) { @autoreleasepool { - return UIApplicationMain( argc, argv, nil, NSStringFromClass([AppDelegate class]) ); + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } diff --git a/examples/CorePlotGallery/src/mac/Icon.icns b/examples/CorePlotGallery/src/mac/Base.lproj/Icon.icns similarity index 100% rename from examples/CorePlotGallery/src/mac/Icon.icns rename to examples/CorePlotGallery/src/mac/Base.lproj/Icon.icns diff --git a/examples/CorePlotGallery/src/mac/English.lproj/MainMenu.xib b/examples/CorePlotGallery/src/mac/Base.lproj/MainMenu.xib similarity index 77% rename from examples/CorePlotGallery/src/mac/English.lproj/MainMenu.xib rename to examples/CorePlotGallery/src/mac/Base.lproj/MainMenu.xib index 07afc80f5..349c7533b 100644 --- a/examples/CorePlotGallery/src/mac/English.lproj/MainMenu.xib +++ b/examples/CorePlotGallery/src/mac/Base.lproj/MainMenu.xib @@ -1,9 +1,9 @@ - - + + - - + + @@ -12,7 +12,7 @@ - + @@ -75,6 +75,13 @@ + + + + + + + @@ -194,51 +201,49 @@ + - + - + - + - - + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + @@ -249,6 +254,12 @@ + + + + + + @@ -263,7 +274,7 @@ - + @@ -280,6 +291,7 @@ + @@ -290,11 +302,12 @@ - - + + + diff --git a/examples/CorePlotGallery/src/mac/PlotGalleryController.h b/examples/CorePlotGallery/src/mac/PlotGalleryController.h index 8be0744f4..c8418c4a6 100644 --- a/examples/CorePlotGallery/src/mac/PlotGalleryController.h +++ b/examples/CorePlotGallery/src/mac/PlotGalleryController.h @@ -1,6 +1,6 @@ // -// PlotGalleryController.h -// CorePlotGallery +// PlotGalleryController.h +// CorePlotGallery // #import @@ -11,11 +11,13 @@ #import "PlotView.h" @interface PlotGalleryController : NSObject -@property (nonatomic, strong) PlotItem *plotItem; -@property (nonatomic, copy) NSString *currentThemeName; +@property (nonatomic, strong, nullable) PlotItem *plotItem; +@property (nonatomic, copy, nullable) NSString *currentThemeName; --(IBAction)themeSelectionDidChange:(id)sender; +-(IBAction)themeSelectionDidChange:(nonnull id)sender; @end diff --git a/examples/CorePlotGallery/src/mac/PlotGalleryController.m b/examples/CorePlotGallery/src/mac/PlotGalleryController.m index 45e501afc..be4239e94 100644 --- a/examples/CorePlotGallery/src/mac/PlotGalleryController.m +++ b/examples/CorePlotGallery/src/mac/PlotGalleryController.m @@ -1,29 +1,34 @@ // -// PlotGalleryController.m -// CorePlotGallery +// PlotGalleryController.m +// CorePlotGallery // #import "PlotGalleryController.h" #import "dlfcn.h" -//#define EMBED_NU 1 +#import "PlotViewItem.h" static const CGFloat CPT_SPLIT_VIEW_MIN_LHS_WIDTH = 150.0; static NSString *const kThemeTableViewControllerNoTheme = @"None"; static NSString *const kThemeTableViewControllerDefaultTheme = @"Default"; +static NSString *const kCollectionHeader = @"CPTCollectionHeader"; +static NSString *const kCollectionItem = @"PlotViewItem"; + @interface PlotGalleryController() -@property (nonatomic, readwrite, strong) IBOutlet NSSplitView *splitView; -@property (nonatomic, readwrite, strong) IBOutlet NSScrollView *scrollView; -@property (nonatomic, readwrite, strong) IBOutlet IKImageBrowserView *imageBrowser; -@property (nonatomic, readwrite, strong) IBOutlet NSPopUpButton *themePopUpButton; +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSSplitView *splitView; +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSScrollView *scrollView; +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSCollectionView *imageBrowser; +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSPopUpButton *themePopUpButton; -@property (nonatomic, readwrite, strong) IBOutlet PlotView *hostingView; +@property (nonatomic, readwrite, strong, nullable) IBOutlet PlotView *hostingView; @end +#pragma mark - + @implementation PlotGalleryController @synthesize splitView; @@ -51,53 +56,36 @@ -(void)setupThemes -(void)awakeFromNib { + [super awakeFromNib]; + [[PlotGallery sharedPlotGallery] sortByTitle]; - [self.splitView setDelegate:self]; + self.splitView.delegate = self; - [self.imageBrowser setDelegate:self]; - [self.imageBrowser setDataSource:self]; - [self.imageBrowser setCellsStyleMask:IKCellsStyleShadowed | IKCellsStyleTitled]; //| IKCellsStyleSubtitled]; + NSCollectionView *browser = self.imageBrowser; - [self.imageBrowser reloadData]; + browser.delegate = self; + browser.dataSource = self; - [self.hostingView setDelegate:self]; + [browser registerClass:[NSTextField class] + forSupplementaryViewOfKind:NSCollectionElementKindSectionHeader + withIdentifier:kCollectionHeader]; - [self setupThemes]; + [browser reloadData]; -#ifdef EMBED_NU - // Setup a Nu console without the help of the Nu include files or - // an explicit link of the Nu framework, which may not be installed - nuHandle = dlopen("/Library/Frameworks/Nu.framework/Nu", RTLD_LAZY); - - if ( nuHandle ) { - NSString *consoleStartup = - @"(progn \ - (load \"console\") \ - (set $console ((NuConsoleWindowController alloc) init)))"; - - Class nuClass = NSClassFromString(@"Nu"); - id parser = [nuClass performSelector:@selector(parser)]; - id code = [parser performSelector:@selector(parse:) withObject:consoleStartup]; - [parser performSelector:@selector(eval:) withObject:code]; - } -#endif + self.hostingView.delegate = self; + + [self setupThemes]; } -(void)dealloc { [self setPlotItem:nil]; - [splitView setDelegate:nil]; - [imageBrowser setDataSource:nil]; - [imageBrowser setDelegate:nil]; - [hostingView setDelegate:nil]; - -#ifdef EMBED_NU - if ( nuHandle ) { - dlclose(nuHandle); - } -#endif + splitView.delegate = nil; + imageBrowser.dataSource = nil; + imageBrowser.delegate = nil; + hostingView.delegate = nil; } -(void)setFrameSize:(NSSize)newSize @@ -110,7 +98,7 @@ -(void)setFrameSize:(NSSize)newSize #pragma mark - #pragma mark Theme Selection --(CPTTheme *)currentTheme +-(nullable CPTTheme *)currentTheme { CPTTheme *theme; @@ -127,99 +115,249 @@ -(CPTTheme *)currentTheme return theme; } --(IBAction)themeSelectionDidChange:(id)sender +-(IBAction)themeSelectionDidChange:(nonnull id)sender { self.currentThemeName = [sender titleOfSelectedItem]; - [self.plotItem renderInView:self.hostingView withTheme:[self currentTheme] animated:YES]; + + PlotView *hostView = self.hostingView; + if ( hostView ) { + [self.plotItem renderInView:hostView withTheme:[self currentTheme] animated:YES]; + } +} + +#pragma mark - +#pragma mark Export Images + +-(void)exportTVImageWithSize:(CGSize)size toURL:(NSURL *)url showPlots:(BOOL)showPlots showBackground:(BOOL)showBackground +{ + if ( url ) { + CGRect imageFrame = CGRectMake(0.0, 0.0, size.width, size.height); + + NSView *imageView = [[NSView alloc] initWithFrame:NSRectFromCGRect(imageFrame)]; + [imageView setWantsLayer:YES]; + + [self.plotItem renderInView:imageView withTheme:nil animated:NO]; + + if ( !showBackground ) { + for ( CPTGraphHostingView *view in imageView.subviews ) { + CPTGraph *graph = view.hostedGraph; + + graph.fill = [CPTFill fillWithColor:[CPTColor clearColor]]; + graph.axisSet = nil; + + graph.plotAreaFrame.fill = [CPTFill fillWithColor:[CPTColor clearColor]]; + graph.plotAreaFrame.borderLineStyle = nil; + + graph.plotAreaFrame.plotArea.fill = [CPTFill fillWithColor:[CPTColor clearColor]]; + graph.plotAreaFrame.plotArea.borderLineStyle = nil; + } + } + + if ( !showPlots ) { + for ( CPTGraphHostingView *view in imageView.subviews ) { + for ( CPTPlot *plot in view.hostedGraph.allPlots ) { + plot.hidden = YES; + } + } + } + + CGSize boundsSize = imageFrame.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]; + + NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; + CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; + + CGContextClearRect(context, CGRectMake(0.0, 0.0, boundsSize.width, boundsSize.height)); + CGContextSetAllowsAntialiasing(context, true); + CGContextSetShouldSmoothFonts(context, false); + [imageView.layer renderInContext:context]; + CGContextFlush(context); + + NSImage *image = [[NSImage alloc] initWithSize:NSSizeFromCGSize(boundsSize)]; + [image addRepresentation:layerImage]; + + NSData *tiffData = image.TIFFRepresentation; + NSBitmapImageRep *tiffRep = [NSBitmapImageRep imageRepWithData:tiffData]; + NSData *pngData = [tiffRep representationUsingType:NSPNGFileType properties:@{}]; + + [pngData writeToURL:url atomically:NO]; + } +} + +-(IBAction)exportTVImagesToPNG:(id __unused)sender +{ + NSOpenPanel *pngSavingDialog = [NSOpenPanel openPanel]; + + pngSavingDialog.canChooseFiles = NO; + pngSavingDialog.canChooseDirectories = YES; + pngSavingDialog.allowsMultipleSelection = NO; + + if ( [pngSavingDialog runModal] == NSModalResponseOK ) { + NSURL *url = pngSavingDialog.URL; + if ( url ) { +// top image + CGSize topShelfSize = CGSizeMake(1920.0, 720.0); + + NSURL *topURL = [NSURL URLWithString:@"PlotGalleryTopShelf.png" relativeToURL:url]; + [self exportTVImageWithSize:topShelfSize toURL:topURL showPlots:YES showBackground:YES]; + +// large icon image + CGSize largeIconSize = CGSizeMake(1280.0, 768.0); + + NSURL *largeBackURL = [NSURL URLWithString:@"PlotGalleryLargeIconBack.png" relativeToURL:url]; + [self exportTVImageWithSize:largeIconSize toURL:largeBackURL showPlots:NO showBackground:YES]; + + NSURL *largeFrontURL = [NSURL URLWithString:@"PlotGalleryLargeIconFront.png" relativeToURL:url]; + [self exportTVImageWithSize:largeIconSize toURL:largeFrontURL showPlots:YES showBackground:NO]; + +// small icon image + CGSize smallIconSize = CGSizeMake(400.0, 240.0); + + NSURL *smallBackURL = [NSURL URLWithString:@"PlotGallerySmallIconBack.png" relativeToURL:url]; + [self exportTVImageWithSize:smallIconSize toURL:smallBackURL showPlots:NO showBackground:YES]; + + NSURL *smallFrontURL = [NSURL URLWithString:@"PlotGallerySmallIconFront.png" relativeToURL:url]; + [self exportTVImageWithSize:smallIconSize toURL:smallFrontURL showPlots:YES showBackground:NO]; + } + } } #pragma mark - #pragma mark PlotItem Property --(void)setPlotItem:(PlotItem *)item +-(void)setPlotItem:(nullable PlotItem *)item { if ( plotItem != item ) { [plotItem killGraph]; plotItem = item; - [plotItem renderInView:self.hostingView withTheme:[self currentTheme] animated:YES]; + PlotView *hostView = self.hostingView; + if ( hostView ) { + [plotItem renderInView:hostView withTheme:[self currentTheme] animated:YES]; + } } } #pragma mark - -#pragma mark IKImageBrowserViewDataSource methods +#pragma mark NSCollectionViewDataSource methods --(NSUInteger)numberOfItemsInImageBrowser:(IKImageBrowserView *)browser +-(NSInteger)numberOfSectionsInCollectionView:(nonnull NSCollectionView *__unused)collectionView { - return [[PlotGallery sharedPlotGallery] count]; + return (NSInteger)[PlotGallery sharedPlotGallery].numberOfSections; } --(id)imageBrowser:(IKImageBrowserView *)browser itemAtIndex:(NSUInteger)index +-(NSInteger)collectionView:(nonnull NSCollectionView *__unused)collectionView + numberOfItemsInSection:(NSInteger)section { - return [[PlotGallery sharedPlotGallery] objectInSection:0 atIndex:index]; + return (NSInteger)[[PlotGallery sharedPlotGallery] numberOfRowsInSection:(NSUInteger)section]; } --(NSUInteger)numberOfGroupsInImageBrowser:(IKImageBrowserView *)aBrowser +-(nonnull NSCollectionViewItem *)collectionView:(nonnull NSCollectionView *)collectionView + itemForRepresentedObjectAtIndexPath:(nonnull NSIndexPath *)indexPath { - return [[PlotGallery sharedPlotGallery] numberOfSections]; + PlotViewItem *item = [collectionView makeItemWithIdentifier:kCollectionItem + forIndexPath:indexPath]; + + PlotItem *thePlotItem = [[PlotGallery sharedPlotGallery] objectInSection:(NSUInteger)indexPath.section + atIndex:(NSUInteger)indexPath.item]; + + item.plotItemTitle.stringValue = thePlotItem.title; + item.plotItemImage.image = thePlotItem.image; + + return item; } --(CPTDictionary)imageBrowser:(IKImageBrowserView *)aBrowser groupAtIndex:(NSUInteger)index +-(nonnull NSView *) collectionView:(nonnull NSCollectionView *)collectionView + viewForSupplementaryElementOfKind:(nonnull NSCollectionViewSupplementaryElementKind)kind + atIndexPath:(nonnull NSIndexPath *)indexPath { - NSString *groupTitle = [[PlotGallery sharedPlotGallery] sectionTitles][index]; - - NSUInteger offset = 0; + NSString *identifier = nil; - for ( NSUInteger i = 0; i < index; i++ ) { - offset += [[PlotGallery sharedPlotGallery] numberOfRowsInSection:i]; + if ( [kind isEqual:NSCollectionElementKindSectionHeader] ) { + identifier = kCollectionHeader; + } + else { + identifier = @""; } - NSValue *groupRange = [NSValue valueWithRange:NSMakeRange(offset, [[PlotGallery sharedPlotGallery] numberOfRowsInSection:index])]; + NSString *content = [PlotGallery sharedPlotGallery].sectionTitles[(NSUInteger)indexPath.section]; - return @{ - IKImageBrowserGroupStyleKey: @(IKGroupDisclosureStyle), - IKImageBrowserGroupTitleKey: groupTitle, - IKImageBrowserGroupRangeKey: groupRange - }; + NSView *view = [collectionView makeSupplementaryViewOfKind:kind withIdentifier:identifier forIndexPath:indexPath]; + if ( content && [view isKindOfClass:[NSTextField class]] ) { + NSTextField *titleTextField = (NSTextField *)view; + + titleTextField.editable = NO; + titleTextField.selectable = NO; + titleTextField.backgroundColor = [NSColor controlAccentColor]; + titleTextField.textColor = [NSColor headerTextColor]; + titleTextField.font = [NSFont boldSystemFontOfSize:14.0]; + titleTextField.bordered = YES; + titleTextField.stringValue = content; + } + + return view; } #pragma mark - -#pragma mark IKImageBrowserViewDelegate methods +#pragma mark NSCollectionViewDelegate methods --(void)imageBrowserSelectionDidChange:(IKImageBrowserView *)browser +-(void) collectionView:(nonnull NSCollectionView *__unused)collectionView + didSelectItemsAtIndexPaths:(nonnull NSSet *)indexPaths { - NSUInteger index = [[browser selectionIndexes] firstIndex]; + NSUInteger section = NSNotFound; + NSUInteger index = NSNotFound; + NSIndexPath *path = indexPaths.allObjects.firstObject; + + if ( path ) { + section = (NSUInteger)path.section; + index = (NSUInteger)path.item; + } if ( index != NSNotFound ) { - PlotItem *item = [[PlotGallery sharedPlotGallery] objectInSection:0 atIndex:index]; - self.plotItem = item; + self.plotItem = [[PlotGallery sharedPlotGallery] objectInSection:section atIndex:index]; } } #pragma mark - #pragma mark NSSplitViewDelegate methods --(CGFloat)splitView:(NSSplitView *)sv constrainMinCoordinate:(CGFloat)coord ofSubviewAt:(NSInteger)index +-(CGFloat) splitView:(nonnull NSSplitView *__unused)sv + constrainMinCoordinate:(CGFloat)coord + ofSubviewAt:(NSInteger __unused)index { return coord + CPT_SPLIT_VIEW_MIN_LHS_WIDTH; } --(CGFloat)splitView:(NSSplitView *)sv constrainMaxCoordinate:(CGFloat)coord ofSubviewAt:(NSInteger)index +-(CGFloat) splitView:(nonnull NSSplitView *__unused)sv + constrainMaxCoordinate:(CGFloat)coord + ofSubviewAt:(NSInteger __unused)index { return coord - CPT_SPLIT_VIEW_MIN_LHS_WIDTH; } --(void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize +-(void) splitView:(nonnull NSSplitView *)sender + resizeSubviewsWithOldSize:(NSSize __unused)oldSize { - // Lock the LHS width - NSRect frame = [sender frame]; - NSView *lhs = [sender subviews][0]; - NSRect lhsRect = [lhs frame]; - NSView *rhs = [sender subviews][1]; - NSRect rhsRect = [rhs frame]; +// Lock the LHS width + NSRect frame = sender.frame; + NSView *lhs = sender.subviews[0]; + NSRect lhsRect = lhs.frame; + NSView *rhs = sender.subviews[1]; + NSRect rhsRect = rhs.frame; - CGFloat dividerThickness = [sender dividerThickness]; + CGFloat dividerThickness = sender.dividerThickness; lhsRect.size.height = frame.size.height; @@ -227,8 +365,8 @@ -(void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize:(NSSize)oldSize rhsRect.size.height = frame.size.height; rhsRect.origin.x = lhsRect.size.width + dividerThickness; - [lhs setFrame:lhsRect]; - [rhs setFrame:rhsRect]; + lhs.frame = lhsRect; + rhs.frame = rhsRect; } @end diff --git a/examples/CorePlotGallery/src/mac/PlotView.h b/examples/CorePlotGallery/src/mac/PlotView.h index b2631d2dd..f4e9bc28a 100644 --- a/examples/CorePlotGallery/src/mac/PlotView.h +++ b/examples/CorePlotGallery/src/mac/PlotView.h @@ -1,6 +1,6 @@ // -// PlotView.h -// CorePlotGallery +// PlotView.h +// CorePlotGallery // #import @@ -11,7 +11,7 @@ @end -@interface PlotView : NSView -@property (nonatomic, weak) id delegate; +@interface PlotView : NSView +@property (nonatomic, weak, nullable) id delegate; @end diff --git a/examples/CorePlotGallery/src/mac/PlotView.m b/examples/CorePlotGallery/src/mac/PlotView.m index ffadad1d3..b769c4a9e 100644 --- a/examples/CorePlotGallery/src/mac/PlotView.m +++ b/examples/CorePlotGallery/src/mac/PlotView.m @@ -1,6 +1,6 @@ // -// PlotView.m -// CorePlotGallery +// PlotView.m +// CorePlotGallery // #import "PlotView.h" @@ -9,15 +9,15 @@ @implementation PlotView @synthesize delegate; --(instancetype)initWithFrame:(NSRect)frame +-(nonnull instancetype)initWithFrame:(NSRect)frame { - if ( (self = [super initWithFrame:frame]) ) { + if ((self = [super initWithFrame:frame])) { } return self; } --(void)drawRect:(NSRect)dirtyRect +-(void)drawRect:(NSRect __unused)dirtyRect { } diff --git a/examples/CorePlotGallery/src/mac/PlotViewItem.h b/examples/CorePlotGallery/src/mac/PlotViewItem.h new file mode 100644 index 000000000..c908c2f82 --- /dev/null +++ b/examples/CorePlotGallery/src/mac/PlotViewItem.h @@ -0,0 +1,13 @@ +// +// PlotViewItem.h +// CorePlotGallery +// + +#import + +@interface PlotViewItem : NSCollectionViewItem + +@property (nonatomic, readwrite, strong) IBOutlet NSImageView *plotItemImage; +@property (nonatomic, readwrite, strong) IBOutlet NSTextField *plotItemTitle; + +@end diff --git a/examples/CorePlotGallery/src/mac/PlotViewItem.m b/examples/CorePlotGallery/src/mac/PlotViewItem.m new file mode 100644 index 000000000..300f5e158 --- /dev/null +++ b/examples/CorePlotGallery/src/mac/PlotViewItem.m @@ -0,0 +1,13 @@ +// +// PlotViewItem.m +// CorePlotGallery +// + +#import "PlotViewItem.h" + +@implementation PlotViewItem + +@synthesize plotItemImage; +@synthesize plotItemTitle; + +@end diff --git a/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.h b/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.h index d5a7380d6..c4820dd23 100644 --- a/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.h +++ b/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.h @@ -1,12 +1,12 @@ // -// Plot_Gallery_MacAppDelegate.h -// CorePlotGallery +// Plot_Gallery_MacAppDelegate.h +// CorePlotGallery // #import @interface Plot_Gallery_MacAppDelegate : NSObject -@property (nonatomic, readwrite, strong) IBOutlet NSWindow *window; +@property (nonatomic, readwrite, strong, nullable) IBOutlet NSWindow *window; @end diff --git a/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.m b/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.m index a999dc691..b5c8479b6 100644 --- a/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.m +++ b/examples/CorePlotGallery/src/mac/Plot_Gallery_MacAppDelegate.m @@ -1,6 +1,6 @@ // -// Plot_Gallery_MacAppDelegate.m -// CorePlotGallery +// Plot_Gallery_MacAppDelegate.m +// CorePlotGallery // #import "Plot_Gallery_MacAppDelegate.h" @@ -9,11 +9,11 @@ @implementation Plot_Gallery_MacAppDelegate @synthesize window; --(void)applicationDidFinishLaunching:(NSNotification *)aNotification +-(void)applicationDidFinishLaunching:(nonnull NSNotification *__unused)aNotification { } --(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender +-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *__unused)sender { return YES; } diff --git a/examples/CorePlotGallery/src/mac/English.lproj/InfoPlist.strings b/examples/CorePlotGallery/src/mac/en.lproj/InfoPlist.strings similarity index 100% rename from examples/CorePlotGallery/src/mac/English.lproj/InfoPlist.strings rename to examples/CorePlotGallery/src/mac/en.lproj/InfoPlist.strings diff --git a/examples/CorePlotGallery/src/mac/en.lproj/MainMenu.strings b/examples/CorePlotGallery/src/mac/en.lproj/MainMenu.strings new file mode 100644 index 000000000..e11842f48 --- /dev/null +++ b/examples/CorePlotGallery/src/mac/en.lproj/MainMenu.strings @@ -0,0 +1,129 @@ + +/* Class = "NSMenuItem"; title = "Bring All to Front"; ObjectID = "5"; */ +"5.title" = "Bring All to Front"; + +/* Class = "NSMenuItem"; title = "Window"; ObjectID = "19"; */ +"19.title" = "Window"; + +/* Class = "NSMenuItem"; title = "Minimize"; ObjectID = "23"; */ +"23.title" = "Minimize"; + +/* Class = "NSMenu"; title = "Window"; ObjectID = "24"; */ +"24.title" = "Window"; + +/* Class = "NSMenu"; title = "AMainMenu"; ObjectID = "29"; */ +"29.title" = "AMainMenu"; + +/* Class = "NSMenuItem"; title = "Plot Gallery"; ObjectID = "56"; */ +"56.title" = "Plot Gallery"; + +/* Class = "NSMenu"; title = "Plot Gallery"; ObjectID = "57"; */ +"57.title" = "Plot Gallery"; + +/* Class = "NSMenuItem"; title = "About Plot Gallery"; ObjectID = "58"; */ +"58.title" = "About Plot Gallery"; + +/* Class = "NSMenuItem"; title = "Close"; ObjectID = "73"; */ +"73.title" = "Close"; + +/* Class = "NSMenuItem"; title = "Page Setup..."; ObjectID = "77"; */ +"77.title" = "Page Setup..."; + +/* Class = "NSMenuItem"; title = "Print…"; ObjectID = "78"; */ +"78.title" = "Print…"; + +/* Class = "NSMenu"; title = "File"; ObjectID = "81"; */ +"81.title" = "File"; + +/* Class = "NSMenuItem"; title = "File"; ObjectID = "83"; */ +"83.title" = "File"; + +/* Class = "NSMenuItem"; title = "Preferences…"; ObjectID = "129"; */ +"129.title" = "Preferences…"; + +/* Class = "NSMenu"; title = "Services"; ObjectID = "130"; */ +"130.title" = "Services"; + +/* Class = "NSMenuItem"; title = "Services"; ObjectID = "131"; */ +"131.title" = "Services"; + +/* Class = "NSMenuItem"; title = "Hide Plot Gallery"; ObjectID = "134"; */ +"134.title" = "Hide Plot Gallery"; + +/* Class = "NSMenuItem"; title = "Quit Plot Gallery"; ObjectID = "136"; */ +"136.title" = "Quit Plot Gallery"; + +/* Class = "NSMenuItem"; title = "Hide Others"; ObjectID = "145"; */ +"145.title" = "Hide Others"; + +/* Class = "NSMenuItem"; title = "Show All"; ObjectID = "150"; */ +"150.title" = "Show All"; + +/* Class = "NSMenuItem"; title = "Copy"; ObjectID = "197"; */ +"197.title" = "Copy"; + +/* Class = "NSMenuItem"; title = "Select All"; ObjectID = "198"; */ +"198.title" = "Select All"; + +/* Class = "NSMenuItem"; title = "Cut"; ObjectID = "199"; */ +"199.title" = "Cut"; + +/* Class = "NSMenuItem"; title = "Delete"; ObjectID = "202"; */ +"202.title" = "Delete"; + +/* Class = "NSMenuItem"; title = "Paste"; ObjectID = "203"; */ +"203.title" = "Paste"; + +/* Class = "NSMenu"; title = "Edit"; ObjectID = "205"; */ +"205.title" = "Edit"; + +/* Class = "NSMenuItem"; title = "Undo"; ObjectID = "207"; */ +"207.title" = "Undo"; + +/* Class = "NSMenuItem"; title = "Redo"; ObjectID = "215"; */ +"215.title" = "Redo"; + +/* Class = "NSMenuItem"; title = "Edit"; ObjectID = "217"; */ +"217.title" = "Edit"; + +/* Class = "NSMenuItem"; title = "Zoom"; ObjectID = "239"; */ +"239.title" = "Zoom"; + +/* Class = "NSMenuItem"; title = "View"; ObjectID = "295"; */ +"295.title" = "View"; + +/* Class = "NSMenu"; title = "View"; ObjectID = "296"; */ +"296.title" = "View"; + +/* Class = "NSMenuItem"; title = "Show Toolbar"; ObjectID = "297"; */ +"297.title" = "Show Toolbar"; + +/* Class = "NSMenuItem"; title = "Customize Toolbar…"; ObjectID = "298"; */ +"298.title" = "Customize Toolbar…"; + +/* Class = "NSWindow"; title = "Plot Gallery-Mac"; ObjectID = "371"; */ +"371.title" = "Plot Gallery-Mac"; + +/* Class = "NSMenuItem"; title = "Paste and Match Style"; ObjectID = "485"; */ +"485.title" = "Paste and Match Style"; + +/* Class = "NSMenuItem"; title = "Help"; ObjectID = "490"; */ +"490.title" = "Help"; + +/* Class = "NSMenu"; title = "Help"; ObjectID = "491"; */ +"491.title" = "Help"; + +/* Class = "NSMenuItem"; title = "Plot Gallery Help"; ObjectID = "492"; */ +"492.title" = "Plot Gallery Help"; + +/* Class = "NSMenu"; title = "OtherViews"; ObjectID = "558"; */ +"558.title" = "OtherViews"; + +/* Class = "NSToolbarItem"; label = "Theme"; ObjectID = "562"; */ +"562.label" = "Theme"; + +/* Class = "NSToolbarItem"; paletteLabel = "Theme"; ObjectID = "562"; */ +"562.paletteLabel" = "Theme"; + +/* Class = "NSMenuItem"; title = "Save TV Images…"; ObjectID = "JRn-xt-TSn"; */ +"JRn-xt-TSn.title" = "Save TV Images…"; diff --git a/examples/CorePlotGallery/src/mac/main.m b/examples/CorePlotGallery/src/mac/main.m index 90ccb7f4b..e0c7c6e57 100644 --- a/examples/CorePlotGallery/src/mac/main.m +++ b/examples/CorePlotGallery/src/mac/main.m @@ -1,6 +1,6 @@ // -// main.m -// CorePlotGallery +// main.m +// CorePlotGallery // #import diff --git a/examples/CorePlotGallery/src/plots/AxisDemo.h b/examples/CorePlotGallery/src/plots/AxisDemo.h index 46fc89979..05e4fb001 100644 --- a/examples/CorePlotGallery/src/plots/AxisDemo.h +++ b/examples/CorePlotGallery/src/plots/AxisDemo.h @@ -1,6 +1,6 @@ // -// AxisDemo.h -// Plot Gallery-Mac +// AxisDemo.h +// Plot Gallery-Mac // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/AxisDemo.m b/examples/CorePlotGallery/src/plots/AxisDemo.m index 6d64f699f..07730cda7 100644 --- a/examples/CorePlotGallery/src/plots/AxisDemo.m +++ b/examples/CorePlotGallery/src/plots/AxisDemo.m @@ -1,6 +1,6 @@ // -// AxisDemo.m -// Plot Gallery-Mac +// AxisDemo.m +// Plot Gallery-Mac // #import "AxisDemo.h" @@ -12,9 +12,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Axis Demo"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(instancetype)init return self; } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -146,7 +146,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP #pragma mark - Axis delegate --(void)axis:(CPTAxis *)axis labelWasSelected:(CPTAxisLabel *)label +-(void)axis:(nonnull CPTAxis *)axis labelWasSelected:(nonnull CPTAxisLabel *)label { NSLog(@"%@ label was selected at location %@", axis.title, label.tickLocation); } diff --git a/examples/CorePlotGallery/src/plots/CandlestickPlot.h b/examples/CorePlotGallery/src/plots/CandlestickPlot.h index 92e0c6424..e015ab15c 100644 --- a/examples/CorePlotGallery/src/plots/CandlestickPlot.h +++ b/examples/CorePlotGallery/src/plots/CandlestickPlot.h @@ -1,10 +1,12 @@ // -// CandlestickPlot.h -// CorePlotGallery +// CandlestickPlot.h +// CorePlotGallery // #import "PlotItem.h" -@interface CandlestickPlot : PlotItem +@interface CandlestickPlot : PlotItem @end diff --git a/examples/CorePlotGallery/src/plots/CandlestickPlot.m b/examples/CorePlotGallery/src/plots/CandlestickPlot.m index d52cba84d..961ddc972 100644 --- a/examples/CorePlotGallery/src/plots/CandlestickPlot.m +++ b/examples/CorePlotGallery/src/plots/CandlestickPlot.m @@ -1,6 +1,6 @@ // -// CandlestickPlot.m -// CorePlotGallery +// CandlestickPlot.m +// CorePlotGallery // #import "CandlestickPlot.h" @@ -9,8 +9,8 @@ @interface CandlestickPlot() -@property (nonatomic, readwrite, strong) CPTGraph *graph; -@property (nonatomic, readwrite, strong) NSArray *plotData; +@property (nonatomic, readwrite, strong, nullable) CPTGraph *graph; +@property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; @end @@ -24,11 +24,11 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"Candlestick Plot"; self.section = kFinancialPlots; @@ -39,15 +39,15 @@ -(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; double rOpen = 3.0 * arc4random() / (double)UINT32_MAX + 1.0; double rClose = (arc4random() / (double)UINT32_MAX - 0.5) * 0.125 + rOpen; - double rHigh = MAX( rOpen, MAX(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen) ); - double rLow = MIN( rOpen, MIN(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen) ); + double rHigh = MAX(rOpen, MAX(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen)); + double rLow = MIN(rOpen, MIN(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen)); [newData addObject: @{ @(CPTTradingRangePlotFieldX): @(x), @@ -62,14 +62,14 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { // 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. NSDate *refDate = [NSDate dateWithTimeIntervalSinceReferenceDate:oneDay / 2.0]; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -103,10 +103,14 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP xAxis.labelFormatter = timeFormatter; CPTLineCap *lineCap = [[CPTLineCap alloc] init]; - lineCap.lineStyle = xAxis.axisLineStyle; - lineCap.lineCapType = CPTLineCapTypeSweptArrow; - lineCap.size = CGSizeMake( self.titleSize * CPTFloat(0.5), self.titleSize * CPTFloat(0.625) ); - lineCap.fill = [CPTFill fillWithColor:xAxis.axisLineStyle.lineColor]; + lineCap.lineStyle = xAxis.axisLineStyle; + lineCap.lineCapType = CPTLineCapTypeSweptArrow; + lineCap.size = CGSizeMake(self.titleSize * CPTFloat(0.5), self.titleSize * CPTFloat(0.625)); + + CPTColor *lineColor = xAxis.axisLineStyle.lineColor; + if ( lineColor ) { + lineCap.fill = [CPTFill fillWithColor:lineColor]; + } xAxis.axisLineCapMax = lineCap; CPTXYAxis *yAxis = xyAxisSet.yAxis; @@ -168,8 +172,10 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP newGraph.legend.borderLineStyle = newGraph.plotAreaFrame.borderLineStyle; newGraph.legend.cornerRadius = 5.0; newGraph.legend.swatchCornerRadius = 5.0; - newGraph.legendAnchor = CPTRectAnchorBottom; - newGraph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(3.0) ); + newGraph.legend.swatchLayout = CPTLegendSwatchLayoutRight; + + newGraph.legendAnchor = CPTRectAnchorBottom; + newGraph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(3.0)); // Set plot ranges CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace; @@ -180,12 +186,12 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSDecimalNumber *num = [NSDecimalNumber zero]; @@ -209,10 +215,15 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI return num; } +-(nullable NSNumber *)barWidthForTradingRangePlot:(nonnull CPTTradingRangePlot *__unused)plot recordIndex:(NSUInteger __unused)idx +{ + return @(arc4random_uniform(85) + 15); +} + #pragma mark - #pragma mark Plot Delegate Methods --(void)tradingRangePlot:(CPTTradingRangePlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index +-(void)tradingRangePlot:(nonnull CPTTradingRangePlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"Bar for '%@' was selected at index %d.", plot.identifier, (int)index); } diff --git a/examples/CorePlotGallery/src/plots/ColoredBarChart.m b/examples/CorePlotGallery/src/plots/ColoredBarChart.m index 546302a25..e2a607c84 100644 --- a/examples/CorePlotGallery/src/plots/ColoredBarChart.m +++ b/examples/CorePlotGallery/src/plots/ColoredBarChart.m @@ -2,7 +2,7 @@ @interface ColoredBarChart() -@property (nonatomic, readwrite, strong) CPTNumberArray plotData; +@property (nonatomic, readwrite, strong, nonnull) CPTNumberArray *plotData; @end @@ -15,9 +15,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Colored Bar Chart"; self.section = kBarPlots; } @@ -27,8 +27,8 @@ -(instancetype)init -(void)generateData { - if ( self.plotData == nil ) { - CPTMutableNumberArray contentArray = [NSMutableArray array]; + 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)]; } @@ -36,9 +36,9 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -131,28 +131,29 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP theLegend.textStyle = whiteTextStyle; theLegend.numberOfRows = 1; - graph.legend = theLegend; - graph.legendAnchor = CPTRectAnchorTop; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(-2.625) ); + graph.legend = theLegend; + graph.legend.swatchLayout = CPTLegendSwatchLayoutTop; + graph.legendAnchor = CPTRectAnchorTop; + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(-2.625)); } #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange +-(nullable NSArray *)numbersForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange { - CPTNumberArray nums = nil; + CPTNumberArray *nums = nil; switch ( fieldEnum ) { case CPTBarPlotFieldBarLocation: nums = [NSMutableArray arrayWithCapacity:indexRange.length]; for ( NSUInteger i = indexRange.location; i < NSMaxRange(indexRange); i++ ) { - [(NSMutableArray < NSNumber * > *) nums addObject : @(i)]; + [(NSMutableArray *) nums addObject:@(i)]; } break; @@ -167,7 +168,7 @@ -(NSArray *)numbersForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordInd return nums; } --(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)index +-(nullable CPTFill *)barFillForBarPlot:(nonnull CPTBarPlot *__unused)barPlot recordIndex:(NSUInteger)index { CPTColor *color = nil; @@ -205,6 +206,7 @@ -(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)inde break; default: + color = [CPTColor blackColor]; break; } @@ -213,7 +215,12 @@ -(CPTFill *)barFillForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)inde return [CPTFill fillWithGradient:fillGradient]; } --(NSString *)legendTitleForBarPlot:(CPTBarPlot *)barPlot recordIndex:(NSUInteger)index +-(nullable NSNumber *)barWidthForBarPlot:(nonnull CPTBarPlot *__unused)barPlot recordIndex:(NSUInteger __unused)idx +{ + return @((double)(arc4random_uniform(50) + 25) / 100.0); +} + +-(nullable NSString *)legendTitleForBarPlot:(nonnull CPTBarPlot *__unused)barPlot recordIndex:(NSUInteger)index { return [NSString stringWithFormat:@"Bar %lu", (unsigned long)(index + 1)]; } diff --git a/examples/CorePlotGallery/src/plots/CompositePlot.h b/examples/CorePlotGallery/src/plots/CompositePlot.h index 8a1ef49ec..51fdabfe4 100644 --- a/examples/CorePlotGallery/src/plots/CompositePlot.h +++ b/examples/CorePlotGallery/src/plots/CompositePlot.h @@ -1,6 +1,6 @@ // -// CompositePlot.h -// CorePlotGallery +// CompositePlot.h +// CorePlotGallery // #import "PlotItem.h" @@ -10,11 +10,11 @@ CPTScatterPlotDelegate, CPTBarPlotDelegate> -@property (readwrite, strong, nonatomic) CPTMutableNumberArray dataForChart; -@property (readwrite, strong, nonatomic) NSMutableArray *dataForPlot; +@property (readwrite, strong, nonatomic, nonnull) CPTMutableNumberArray *dataForChart; +@property (readwrite, strong, nonatomic, nonnull) NSMutableArray *dataForPlot; --(void)renderScatterPlotInHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme; --(void)renderBarPlotInHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme; --(void)renderPieChartInHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme; +-(void)renderScatterPlotInHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme; +-(void)renderBarPlotInHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme; +-(void)renderPieChartInHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme; @end diff --git a/examples/CorePlotGallery/src/plots/CompositePlot.m b/examples/CorePlotGallery/src/plots/CompositePlot.m index e886e7ff2..9a3c140b8 100644 --- a/examples/CorePlotGallery/src/plots/CompositePlot.m +++ b/examples/CorePlotGallery/src/plots/CompositePlot.m @@ -1,6 +1,6 @@ // -// CompositePlot.m -// CorePlotGallery +// CompositePlot.m +// CorePlotGallery // #import "CompositePlot.h" @@ -9,13 +9,13 @@ @interface CompositePlot() @property (nonatomic, readwrite, assign) NSInteger selectedIndex; -@property (nonatomic, readwrite, strong) CPTGraphHostingView *scatterPlotView; -@property (nonatomic, readwrite, strong) CPTGraphHostingView *barChartView; -@property (nonatomic, readwrite, strong) CPTGraphHostingView *pieChartView; +@property (nonatomic, readwrite, strong, nullable) CPTGraphHostingView *scatterPlotView; +@property (nonatomic, readwrite, strong, nullable) CPTGraphHostingView *barChartView; +@property (nonatomic, readwrite, strong, nullable) CPTGraphHostingView *pieChartView; -@property (nonatomic, readwrite, strong) CPTXYGraph *scatterPlot; -@property (nonatomic, readwrite, strong) CPTXYGraph *barChart; -@property (nonatomic, readwrite, strong) CPTXYGraph *pieChart; +@property (nonatomic, readwrite, strong, nullable) CPTXYGraph *scatterPlot; +@property (nonatomic, readwrite, strong, nullable) CPTXYGraph *barChart; +@property (nonatomic, readwrite, strong, nullable) CPTXYGraph *pieChart; @end @@ -38,9 +38,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { selectedIndex = NSNotFound; self.title = @"Composite Plot"; @@ -53,33 +53,34 @@ -(instancetype)init #pragma mark - #pragma mark Plot construction methods -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else -(void)setFrameSize:(NSSize)newSize { - self.scatterPlotView.frame = NSMakeRect( 0.0, - 0.0, - newSize.width, - newSize.height * CPTFloat(0.5) ); + self.scatterPlotView.frame = NSMakeRect(0.0, + 0.0, + newSize.width, + newSize.height * CPTFloat(0.5)); - self.barChartView.frame = NSMakeRect( 0.0, - newSize.height * CPTFloat(0.5), - newSize.width * CPTFloat(0.5), - newSize.height * CPTFloat(0.5) ); + self.barChartView.frame = NSMakeRect(0.0, + newSize.height * CPTFloat(0.5), + newSize.width * CPTFloat(0.5), + newSize.height * CPTFloat(0.5)); - self.pieChartView.frame = NSMakeRect( newSize.width * CPTFloat(0.5), - newSize.height * CPTFloat(0.5), - newSize.width * CPTFloat(0.5), - newSize.height * CPTFloat(0.5) ); + self.pieChartView.frame = NSMakeRect(newSize.width * CPTFloat(0.5), + newSize.height * CPTFloat(0.5), + newSize.width * CPTFloat(0.5), + newSize.height * CPTFloat(0.5)); [self.scatterPlotView setNeedsDisplay:YES]; [self.barChartView setNeedsDisplay:YES]; [self.pieChartView setNeedsDisplay:YES]; } + #endif --(void)renderInView:(PlotGalleryNativeView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInView:(nonnull PlotGalleryNativeView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { [self killGraph]; @@ -87,7 +88,7 @@ -(void)renderInView:(PlotGalleryNativeView *)hostingView withTheme:(CPTTheme *)t CPTGraphHostingView *barView = [[CPTGraphHostingView alloc] init]; CPTGraphHostingView *pieView = [[CPTGraphHostingView alloc] init]; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE for ( UIView *view in @[scatterView, barView, pieView] ) { view.translatesAutoresizingMaskIntoConstraints = NO; [hostingView addSubview:view]; @@ -166,28 +167,27 @@ -(void)renderInView:(PlotGalleryNativeView *)hostingView withTheme:(CPTTheme *)t attribute:NSLayoutAttributeTop multiplier:1.0 constant:0.0]]; - #else - NSRect viewRect = [hostingView bounds]; + NSRect viewRect = hostingView.bounds; - scatterView.frame = NSMakeRect( 0.0, - 0.0, - viewRect.size.width, - viewRect.size.height * CPTFloat(0.5) ); + scatterView.frame = NSMakeRect(0.0, + 0.0, + viewRect.size.width, + viewRect.size.height * CPTFloat(0.5)); - barView.frame = NSMakeRect( 0.0, - viewRect.size.height * CPTFloat(0.5), - viewRect.size.width * CPTFloat(0.5), - viewRect.size.height * CPTFloat(0.5) ); + barView.frame = NSMakeRect(0.0, + viewRect.size.height * CPTFloat(0.5), + viewRect.size.width * CPTFloat(0.5), + viewRect.size.height * CPTFloat(0.5)); - pieView.frame = NSMakeRect( viewRect.size.width * CPTFloat(0.5), - viewRect.size.height * CPTFloat(0.5), - viewRect.size.width * CPTFloat(0.5), - viewRect.size.height * CPTFloat(0.5) ); + pieView.frame = NSMakeRect(viewRect.size.width * CPTFloat(0.5), + viewRect.size.height * CPTFloat(0.5), + viewRect.size.width * CPTFloat(0.5), + viewRect.size.height * CPTFloat(0.5)); for ( NSView *view in @[scatterView, barView, pieView] ) { [view setAutoresizesSubviews:YES]; - [view setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; + view.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; [hostingView addSubview:view]; } @@ -221,19 +221,20 @@ -(void)killGraph [super killGraph]; } --(void)renderScatterPlotInHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme +-(void)renderScatterPlotInHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme { // Create graph from theme -#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR +#if TARGET_OS_IPHONE || TARGET_OS_SIMULATOR CGRect bounds = self.scatterPlotView.bounds; #else CGRect bounds = NSRectToCGRect(self.scatterPlotView.bounds); #endif - self.scatterPlot = [[CPTXYGraph alloc] initWithFrame:bounds]; - [self addGraph:self.scatterPlot toHostingView:hostingView]; + CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:bounds]; + self.scatterPlot = newGraph; - [self applyTheme:theme toGraph:self.scatterPlot withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; + [self addGraph:newGraph toHostingView:hostingView]; + [self applyTheme:theme toGraph:newGraph withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; self.scatterPlot.plotAreaFrame.plotArea.delegate = self; @@ -249,9 +250,9 @@ -(void)renderScatterPlotInHostingView:(CPTGraphHostingView *)hostingView withThe x.majorIntervalLength = @0.5; x.orthogonalPosition = @2.0; x.minorTicksPerInterval = 2; - CPTPlotRangeArray exclusionRanges = @[[CPTPlotRange plotRangeWithLocation:@1.99 length:@0.02], - [CPTPlotRange plotRangeWithLocation:@0.99 length:@0.02], - [CPTPlotRange plotRangeWithLocation:@2.99 length:@0.02]]; + CPTPlotRangeArray *exclusionRanges = @[[CPTPlotRange plotRangeWithLocation:@1.99 length:@0.02], + [CPTPlotRange plotRangeWithLocation:@0.99 length:@0.02], + [CPTPlotRange plotRangeWithLocation:@2.99 length:@0.02]]; x.labelExclusionRanges = exclusionRanges; CPTXYAxis *y = axisSet.yAxis; @@ -328,17 +329,19 @@ -(void)renderScatterPlotInHostingView:(CPTGraphHostingView *)hostingView withThe self.dataForPlot = contentArray; } --(void)renderBarPlotInHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme +-(void)renderBarPlotInHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); #endif - self.barChart = [[CPTXYGraph alloc] initWithFrame:bounds]; - [self addGraph:self.barChart toHostingView:hostingView]; - [self applyTheme:theme toGraph:self.barChart withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; + CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:bounds]; + self.barChart = newGraph; + + [self addGraph:newGraph toHostingView:hostingView]; + [self applyTheme:theme toGraph:newGraph withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; self.barChart.plotAreaFrame.masksToBorder = NO; @@ -358,10 +361,10 @@ -(void)renderBarPlotInHostingView:(CPTGraphHostingView *)hostingView withTheme:( x.labelOffset = 2.0; x.labelRotation = CPTFloat(M_PI_4); x.labelingPolicy = CPTAxisLabelingPolicyNone; - CPTNumberArray customTickLocations = @[@1, @5, @10, @15]; - CPTStringArray xAxisLabels = @[@"Label A", @"Label B", @"Label C", @"Label D"]; - NSUInteger labelLocation = 0; - CPTMutableAxisLabelSet customLabels = [NSMutableSet setWithCapacity:[xAxisLabels count]]; + CPTNumberArray *customTickLocations = @[@1, @5, @10, @15]; + CPTStringArray *xAxisLabels = @[@"Label A", @"Label B", @"Label C", @"Label D"]; + NSUInteger labelLocation = 0; + CPTMutableAxisLabelSet *customLabels = [NSMutableSet setWithCapacity:xAxisLabels.count]; for ( NSNumber *tickLocation in customTickLocations ) { CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText:xAxisLabels[labelLocation++] textStyle:x.labelTextStyle]; newLabel.tickLocation = tickLocation; @@ -396,9 +399,9 @@ -(void)renderBarPlotInHostingView:(CPTGraphHostingView *)hostingView withTheme:( [self.barChart addPlot:barPlot toPlotSpace:plotSpace]; } --(void)renderPieChartInHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme +-(void)renderPieChartInHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE [hostingView layoutIfNeeded]; CGRect bounds = hostingView.bounds; @@ -406,9 +409,11 @@ -(void)renderPieChartInHostingView:(CPTGraphHostingView *)hostingView withTheme: CGRect bounds = NSRectToCGRect(hostingView.bounds); #endif - self.pieChart = [[CPTXYGraph alloc] initWithFrame:bounds]; - [self addGraph:self.pieChart toHostingView:hostingView]; - [self applyTheme:theme toGraph:self.pieChart withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; + CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:bounds]; + self.pieChart = newGraph; + + [self addGraph:newGraph toHostingView:hostingView]; + [self applyTheme:theme toGraph:newGraph withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; self.pieChart.plotAreaFrame.masksToBorder = NO; @@ -417,8 +422,8 @@ -(void)renderPieChartInHostingView:(CPTGraphHostingView *)hostingView withTheme: // Add pie chart CPTPieChart *piePlot = [[CPTPieChart alloc] init]; piePlot.dataSource = self; - piePlot.pieRadius = MIN( CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * self.pieChart.paddingLeft) / CPTFloat(2.0), - CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * self.pieChart.paddingTop) / CPTFloat(2.0) ); + piePlot.pieRadius = MIN(CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * self.pieChart.paddingLeft) / CPTFloat(2.0), + CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * self.pieChart.paddingTop) / CPTFloat(2.0)); piePlot.identifier = @"Pie Chart 1"; piePlot.startAngle = CPTFloat(M_PI_4); piePlot.sliceDirection = CPTPieDirectionCounterClockwise; @@ -432,7 +437,7 @@ -(void)renderPieChartInHostingView:(CPTGraphHostingView *)hostingView withTheme: #pragma mark - #pragma mark CPTBarPlot delegate --(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index +-(void)barPlot:(nonnull CPTBarPlot *__unused)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"barWasSelectedAtRecordIndex %d", (int)index); } @@ -440,9 +445,9 @@ -(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index #pragma mark - #pragma mark CPTScatterPlot delegate --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { - if ( [(NSString *)plot.identifier isEqualToString : @"Blue Plot"] ) { + if ( [(NSString *) plot.identifier isEqualToString:@"Blue Plot"] ) { self.selectedIndex = (NSInteger)index; } } @@ -450,7 +455,7 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS #pragma mark - #pragma mark Plot area delegate --(void)plotAreaWasSelected:(CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *)plotArea { CPTGraph *theGraph = plotArea.graph; @@ -462,10 +467,10 @@ -(void)plotAreaWasSelected:(CPTPlotArea *)plotArea #pragma mark - #pragma mark Plot Data Source --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { if ( [plot isKindOfClass:[CPTPieChart class]] ) { - return [self.dataForChart count]; + return self.dataForChart.count; } else if ( [plot isKindOfClass:[CPTBarPlot class]] ) { return 16; @@ -475,12 +480,12 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot } } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num = nil; if ( [plot isKindOfClass:[CPTPieChart class]] ) { - if ( index >= [self.dataForChart count] ) { + if ( index >= self.dataForChart.count ) { return nil; } @@ -498,7 +503,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI break; case CPTBarPlotFieldBarTip: - num = @( (index + 1) * (index + 1) ); + num = @((index + 1) * (index + 1)); if ( [plot.identifier isEqual:@"Bar Plot 2"] ) { num = @(num.integerValue - 10); } @@ -510,9 +515,9 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI num = self.dataForPlot[index][key]; // Green plot gets shifted above the blue - if ( [(NSString *)plot.identifier isEqualToString : @"Green Plot"] ) { + if ( [(NSString *) plot.identifier isEqualToString:@"Green Plot"] ) { if ( fieldEnum == CPTScatterPlotFieldY ) { - num = @([num doubleValue] + 1.0); + num = @(num.doubleValue + 1.0); } } } @@ -520,7 +525,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI return num; } --(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUInteger)index { CPTTextLayer *newLayer = nil; @@ -529,8 +534,8 @@ -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index static dispatch_once_t whiteOnceToken = 0; dispatch_once(&whiteOnceToken, ^{ - whiteText = [[CPTMutableTextStyle alloc] init]; - whiteText.color = [CPTColor whiteColor]; + whiteText = [[CPTMutableTextStyle alloc] init]; + whiteText.color = [CPTColor whiteColor]; whiteText.fontSize = self.titleSize * CPTFloat(0.5); }); @@ -538,8 +543,8 @@ -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index static dispatch_once_t blackOnceToken = 0; dispatch_once(&blackOnceToken, ^{ - redText = [[CPTMutableTextStyle alloc] init]; - redText.color = [CPTColor redColor]; + redText = [[CPTMutableTextStyle alloc] init]; + redText.color = [CPTColor redColor]; redText.fontSize = self.titleSize * CPTFloat(0.5); }); @@ -563,20 +568,20 @@ -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index return newLayer; } --(CPTPlotSymbol *)symbolForScatterPlot:(CPTScatterPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTPlotSymbol *)symbolForScatterPlot:(nonnull CPTScatterPlot *)plot recordIndex:(NSUInteger)index { static CPTPlotSymbol *redDot = nil; static dispatch_once_t onceToken = 0; CPTPlotSymbol *symbol = nil; // Use the default symbol - if ( [(NSString *)plot.identifier isEqualToString : @"Blue Plot"] && ( (NSInteger)index == self.selectedIndex ) ) { + if ( [(NSString *) plot.identifier isEqualToString:@"Blue Plot"] && ((NSInteger)index == self.selectedIndex)) { dispatch_once(&onceToken, ^{ - redDot = [[CPTPlotSymbol alloc] init]; + redDot = [[CPTPlotSymbol alloc] init]; redDot.symbolType = CPTPlotSymbolTypeEllipse; - redDot.size = CGSizeMake(10.0, 10.0); - redDot.fill = [CPTFill fillWithColor:[CPTColor redColor]]; - redDot.lineStyle = [CPTLineStyle lineStyle]; + redDot.size = CGSizeMake(10.0, 10.0); + redDot.fill = [CPTFill fillWithColor:[CPTColor redColor]]; + redDot.lineStyle = [CPTLineStyle lineStyle]; }); symbol = redDot; @@ -597,10 +602,10 @@ -(void)setSelectedIndex:(NSInteger)newIndex CPTScatterPlot *thePlot = (CPTScatterPlot *)[self.scatterPlot plotWithIdentifier:@"Blue Plot"]; if ( oldIndex != NSNotFound ) { - [thePlot reloadPlotSymbolsInIndexRange:NSMakeRange( (NSUInteger)oldIndex, 1 )]; + [thePlot reloadPlotSymbolsInIndexRange:NSMakeRange((NSUInteger)oldIndex, 1)]; } if ( newIndex != NSNotFound ) { - [thePlot reloadPlotSymbolsInIndexRange:NSMakeRange( (NSUInteger)newIndex, 1 )]; + [thePlot reloadPlotSymbolsInIndexRange:NSMakeRange((NSUInteger)newIndex, 1)]; } } } diff --git a/examples/CorePlotGallery/src/plots/ControlChart.m b/examples/CorePlotGallery/src/plots/ControlChart.m index c98248e49..cc8682410 100644 --- a/examples/CorePlotGallery/src/plots/ControlChart.m +++ b/examples/CorePlotGallery/src/plots/ControlChart.m @@ -9,7 +9,7 @@ @interface ControlChart() -@property (nonatomic, readwrite, strong) CPTNumberArray plotData; +@property (nonatomic, readwrite, strong, nonnull) CPTNumberArray *plotData; @property (nonatomic, readwrite, assign) double meanValue; @property (nonatomic, readwrite, assign) double standardError; @@ -26,9 +26,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Control Chart"; self.section = kLinePlots; } @@ -38,8 +38,8 @@ -(instancetype)init -(void)generateData { - if ( self.plotData == nil ) { - CPTMutableNumberArray contentArray = [NSMutableArray array]; + if ( self.plotData.count == 0 ) { + CPTMutableNumberArray *contentArray = [NSMutableArray array]; double sum = 0.0; @@ -55,17 +55,17 @@ -(void)generateData sum = 0.0; for ( NSNumber *value in contentArray ) { - double error = [value doubleValue] - self.meanValue; + double error = value.doubleValue - self.meanValue; sum += error * error; } - double stdDev = sqrt( ( 1.0 / (numberOfPoints - 1) ) * sum ); + double stdDev = sqrt((1.0 / (numberOfPoints - 1)) * sum); self.standardError = stdDev / sqrt(numberOfPoints); } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -207,13 +207,13 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP graph.legend.cornerRadius = 5.0; graph.legend.numberOfRows = 1; graph.legendAnchor = CPTRectAnchorBottom; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(4.0) ); + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(4.0)); } #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { if ( plot.identifier == kDataLine ) { return self.plotData.count; @@ -226,9 +226,9 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot } } --(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(double)doubleForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { - double number = NAN; + double number = (double)NAN; switch ( fieldEnum ) { case CPTScatterPlotFieldX: @@ -246,7 +246,7 @@ -(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:( break; case 2: - number = NAN; + number = (double)NAN; break; } } @@ -255,7 +255,7 @@ -(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:( case CPTScatterPlotFieldY: if ( plot.identifier == kDataLine ) { - number = [self.plotData[index] doubleValue]; + number = self.plotData[index].doubleValue; } else if ( plot.identifier == kCenterLine ) { number = self.meanValue; @@ -268,7 +268,7 @@ -(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:( break; case 2: - number = NAN; + number = (double)NAN; break; case 3: @@ -285,7 +285,7 @@ -(double)doubleForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:( break; case 2: - number = NAN; + number = (double)NAN; break; case 3: diff --git a/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.h b/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.h new file mode 100644 index 000000000..ac63057b9 --- /dev/null +++ b/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.h @@ -0,0 +1,13 @@ +// +// CurvedInterpolationDemo.h +// Plot_Gallery +// +// Created by malte on 16/03/16. +// +// + +#import "PlotItem.h" + +@interface CurvedInterpolationDemo : PlotItem + +@end diff --git a/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m b/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m new file mode 100644 index 000000000..d5e6f20e9 --- /dev/null +++ b/examples/CorePlotGallery/src/plots/CurvedInterpolationDemo.m @@ -0,0 +1,315 @@ +// +// CurvedInterpolationDemo.m +// Plot_Gallery +// +// Created by malte on 16/03/16. +// +// + +#import "CurvedInterpolationDemo.h" + +static const double bezierYShift = -1.0; +static const double catmullRomUniformPlotYShift = 0.0; +static const double catmullRomCentripetalYShift = 1.0; +static const double catmullRomChordalYShift = 2.0; +static const double hermiteCubicYShift = -2.0; + +static NSString *const bezierCurveIdentifier = @"Bezier"; +static NSString *const catmullRomUniformIdentifier = @"Catmull-Rom Uniform"; +static NSString *const catmullRomCentripetalIdentifier = @"Catmull-Rom Centripetal"; +static NSString *const catmullRomChordalIdentifier = @"Catmull-Rom Chordal"; +static NSString *const hermiteCubicIdentifier = @"Hermite Cubic"; + +@interface CurvedInterpolationDemo() + +@property (nonatomic, readwrite, strong) NSArray *> *plotData; + +@end + +@implementation CurvedInterpolationDemo + +@synthesize plotData = _plotData; + ++(void)load +{ + [super registerPlotItem:self]; +} + +-(instancetype)init +{ + if ((self = [super init])) { + self.title = @"Curved Interpolation Options Demo"; + self.section = kLinePlots; + } + + return self; +} + +-(void)generateData +{ + 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]; + + if ( xValues.count != yValues.count ) { + [[NSException exceptionWithName:NSInternalInconsistencyException reason:@"invalid const data" userInfo:nil] raise]; + } + NSMutableArray *> *generatedData = [NSMutableArray new]; + for ( NSUInteger i = 0; i < xValues.count; i++ ) { + NSNumber *x = xValues[i]; + NSNumber *y = yValues[i]; + if ( x && y ) { + [generatedData addObject:@{ + @"x": x, + @"y": y + }]; + } + } + self.plotData = generatedData; + } +} + +-(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL __unused)animated +{ +#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE + CGRect bounds = hostingView.bounds; +#else + CGRect bounds = NSRectToCGRect(hostingView.bounds); +#endif + + CPTGraph *graph = [[CPTXYGraph alloc] initWithFrame:bounds]; + [self addGraph:graph toHostingView:hostingView]; + [self applyTheme:theme toGraph:graph withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; + + graph.plotAreaFrame.paddingLeft += self.titleSize * CPTFloat(2.25); + graph.plotAreaFrame.paddingTop += self.titleSize; + graph.plotAreaFrame.paddingRight += self.titleSize; + graph.plotAreaFrame.paddingBottom += self.titleSize; + graph.plotAreaFrame.masksToBorder = NO; + +// Setup scatter plot space + CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace; + plotSpace.allowsUserInteraction = YES; + plotSpace.delegate = self; + +// Grid line styles + CPTMutableLineStyle *majorGridLineStyle = [CPTMutableLineStyle lineStyle]; + majorGridLineStyle.lineWidth = 0.75; + majorGridLineStyle.lineColor = [[CPTColor colorWithGenericGray:CPTFloat(0.2)] colorWithAlphaComponent:CPTFloat(0.75)]; + + CPTMutableLineStyle *minorGridLineStyle = [CPTMutableLineStyle lineStyle]; + minorGridLineStyle.lineWidth = 0.25; + minorGridLineStyle.lineColor = [[CPTColor whiteColor] colorWithAlphaComponent:CPTFloat(0.1)]; + + CPTMutableLineStyle *redLineStyle = [CPTMutableLineStyle lineStyle]; + redLineStyle.lineWidth = 10.0; + redLineStyle.lineColor = [[CPTColor redColor] colorWithAlphaComponent:0.5]; + + CPTLineCap *lineCap = [CPTLineCap sweptArrowPlotLineCap]; + lineCap.size = CGSizeMake(self.titleSize * CPTFloat(0.625), self.titleSize * CPTFloat(0.625)); + +// Axes +// Label x axis with a fixed interval policy + CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet; + CPTXYAxis *x = axisSet.xAxis; + x.majorIntervalLength = @0.1; + x.minorTicksPerInterval = 4; + x.majorGridLineStyle = majorGridLineStyle; + x.minorGridLineStyle = minorGridLineStyle; + x.axisConstraints = [CPTConstraints constraintWithRelativeOffset:0.5]; + + lineCap.lineStyle = x.axisLineStyle; + CPTColor *lineColor = lineCap.lineStyle.lineColor; + if ( lineColor ) { + lineCap.fill = [CPTFill fillWithColor:lineColor]; + } + x.axisLineCapMax = lineCap; + + x.title = @"X Axis"; + x.titleOffset = self.titleSize * CPTFloat(1.25); + +// Label y with an automatic label policy. + CPTXYAxis *y = axisSet.yAxis; + y.labelingPolicy = CPTAxisLabelingPolicyAutomatic; + y.minorTicksPerInterval = 4; + y.preferredNumberOfMajorTicks = 8; + y.majorGridLineStyle = majorGridLineStyle; + y.minorGridLineStyle = minorGridLineStyle; + y.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0]; + y.labelOffset = self.titleSize * CPTFloat(0.25); + + lineCap.lineStyle = y.axisLineStyle; + lineColor = lineCap.lineStyle.lineColor; + if ( lineColor ) { + lineCap.fill = [CPTFill fillWithColor:lineColor]; + } + y.axisLineCapMax = lineCap; + y.axisLineCapMin = lineCap; + + y.title = @"Y Axis"; + y.titleOffset = self.titleSize * CPTFloat(1.25); + +// Set axes + graph.axisSet.axes = @[x, y]; + +// Create the plots +// Bezier + CPTScatterPlot *bezierPlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; + bezierPlot.identifier = bezierCurveIdentifier; +// Catmull-Rom + CPTScatterPlot *cmUniformPlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; + cmUniformPlot.identifier = catmullRomUniformIdentifier; + CPTScatterPlot *cmCentripetalPlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; + cmCentripetalPlot.identifier = catmullRomCentripetalIdentifier; + CPTScatterPlot *cmChordalPlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; + cmChordalPlot.identifier = catmullRomChordalIdentifier; +// Hermite Cubic + CPTScatterPlot *hermitePlot = [[CPTScatterPlot alloc] initWithFrame:CGRectZero]; + hermitePlot.identifier = hermiteCubicIdentifier; + +// set interpolation types + bezierPlot.interpolation = cmUniformPlot.interpolation = cmCentripetalPlot.interpolation = cmChordalPlot.interpolation = hermitePlot.interpolation = CPTScatterPlotInterpolationCurved; + + bezierPlot.curvedInterpolationOption = CPTScatterPlotCurvedInterpolationNormal; + cmUniformPlot.curvedInterpolationOption = CPTScatterPlotCurvedInterpolationCatmullRomUniform; + cmChordalPlot.curvedInterpolationOption = CPTScatterPlotCurvedInterpolationCatmullRomChordal; + cmCentripetalPlot.curvedInterpolationOption = CPTScatterPlotCurvedInterpolationCatmullRomCentripetal; + hermitePlot.curvedInterpolationOption = CPTScatterPlotCurvedInterpolationHermiteCubic; + +// style plots + CPTMutableLineStyle *lineStyle = [bezierPlot.dataLineStyle mutableCopy]; + lineStyle.lineWidth = 2.0; + lineStyle.lineColor = [CPTColor greenColor]; + + bezierPlot.dataLineStyle = lineStyle; + + lineStyle.lineColor = [CPTColor redColor]; + cmUniformPlot.dataLineStyle = lineStyle; + + lineStyle.lineColor = [CPTColor orangeColor]; + cmCentripetalPlot.dataLineStyle = lineStyle; + + lineStyle.lineColor = [CPTColor yellowColor]; + cmChordalPlot.dataLineStyle = lineStyle; + + lineStyle.lineColor = [CPTColor cyanColor]; + hermitePlot.dataLineStyle = lineStyle; + +// set data source and add plots + bezierPlot.dataSource = cmUniformPlot.dataSource = cmCentripetalPlot.dataSource = cmChordalPlot.dataSource = hermitePlot.dataSource = self; + + [graph addPlot:bezierPlot]; + [graph addPlot:cmUniformPlot]; + [graph addPlot:cmCentripetalPlot]; + [graph addPlot:cmChordalPlot]; + [graph addPlot:hermitePlot]; + +// Auto scale the plot space to fit the plot data + [plotSpace scaleToFitPlots:[graph allPlots]]; + CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy]; + CPTMutablePlotRange *yRange = [plotSpace.yRange mutableCopy]; + +// Expand the ranges to put some space around the plot + [xRange expandRangeByFactor:@1.2]; + [yRange expandRangeByFactor:@1.2]; + plotSpace.xRange = xRange; + plotSpace.yRange = yRange; + + [xRange expandRangeByFactor:@1.025]; + xRange.location = plotSpace.xRange.location; + [yRange expandRangeByFactor:@1.05]; + x.visibleAxisRange = xRange; + y.visibleAxisRange = yRange; + + [xRange expandRangeByFactor:@3.0]; + [yRange expandRangeByFactor:@3.0]; + plotSpace.globalXRange = xRange; + plotSpace.globalYRange = yRange; + +// Add plot symbols + CPTMutableLineStyle *symbolLineStyle = [CPTMutableLineStyle lineStyle]; + symbolLineStyle.lineColor = [[CPTColor blackColor] colorWithAlphaComponent:0.5]; + CPTPlotSymbol *plotSymbol = [CPTPlotSymbol ellipsePlotSymbol]; + plotSymbol.fill = [CPTFill fillWithColor:[[CPTColor blueColor] colorWithAlphaComponent:0.5]]; + plotSymbol.lineStyle = symbolLineStyle; + plotSymbol.size = CGSizeMake(5.0, 5.0); + bezierPlot.plotSymbol = cmUniformPlot.plotSymbol = cmCentripetalPlot.plotSymbol = cmChordalPlot.plotSymbol = hermitePlot.plotSymbol = plotSymbol; + +// Add legend + graph.legend = [CPTLegend legendWithGraph:graph]; + graph.legend.numberOfRows = 2; + graph.legend.textStyle = x.titleTextStyle; + graph.legend.fill = [CPTFill fillWithColor:[CPTColor darkGrayColor]]; + graph.legend.borderLineStyle = x.axisLineStyle; + graph.legend.cornerRadius = 5.0; + graph.legendAnchor = CPTRectAnchorBottom; + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(2.0)); +} + +#pragma mark - +#pragma mark Plot Data Source Methods + +-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *__unused)plot +{ + return self.plotData.count; +} + +-(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +{ + NSString *identifier = (NSString *)plot.identifier; + + if ( fieldEnum == CPTScatterPlotFieldX ) { + return self.plotData[index][@"x"]; + } + else { + NSNumber *baseY = self.plotData[index][@"y"]; + double shift = 0.0; + if ( [identifier isEqualToString:catmullRomUniformIdentifier] ) { + shift = catmullRomUniformPlotYShift; + } + else if ( [identifier isEqualToString:catmullRomCentripetalIdentifier] ) { + shift = catmullRomCentripetalYShift; + } + else if ( [identifier isEqualToString:catmullRomChordalIdentifier] ) { + shift = catmullRomChordalYShift; + } + else if ( [identifier isEqualToString:hermiteCubicIdentifier] ) { + shift = hermiteCubicYShift; + } + else if ( [identifier isEqualToString:bezierCurveIdentifier] ) { + shift = bezierYShift; + } + return @(baseY.doubleValue + shift); + } +} + +#pragma mark - +#pragma mark Plot Space Delegate Methods + +-(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +{ + CPTGraph *theGraph = space.graph; + CPTXYAxisSet *axisSet = (CPTXYAxisSet *)theGraph.axisSet; + + CPTMutablePlotRange *changedRange = [newRange mutableCopy]; + + switch ( coordinate ) { + case CPTCoordinateX: + [changedRange expandRangeByFactor:@1.025]; + changedRange.location = newRange.location; + axisSet.xAxis.visibleAxisRange = changedRange; + break; + + case CPTCoordinateY: + [changedRange expandRangeByFactor:@1.05]; + axisSet.yAxis.visibleAxisRange = changedRange; + break; + + default: + break; + } + + return newRange; +} + +@end diff --git a/examples/CorePlotGallery/src/plots/CurvedScatterPlot.h b/examples/CorePlotGallery/src/plots/CurvedScatterPlot.h index 8073492c1..d88ebf2a3 100644 --- a/examples/CorePlotGallery/src/plots/CurvedScatterPlot.h +++ b/examples/CorePlotGallery/src/plots/CurvedScatterPlot.h @@ -1,8 +1,8 @@ // -// CurvedScatterPlot.h -// Plot_Gallery_iOS +// CurvedScatterPlot.h +// Plot_Gallery_iOS // -// Created by Nino Ag on 23/10/11. +// Created by Nino Ag on 23/10/11. #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m b/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m index d962f902c..27e300d0f 100644 --- a/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/CurvedScatterPlot.m @@ -1,8 +1,8 @@ // -// CurvedScatterPlot.m -// Plot_Gallery_iOS +// CurvedScatterPlot.m +// Plot_Gallery_iOS // -// Created by Nino Ag on 23/10/11. +// Created by Nino Ag on 23/10/11. #import "CurvedScatterPlot.h" @@ -12,11 +12,11 @@ @interface CurvedScatterPlot() -@property (nonatomic, readwrite, strong) CPTPlotSpaceAnnotation *symbolTextAnnotation; +@property (nonatomic, readwrite, strong, nullable) CPTPlotSpaceAnnotation *symbolTextAnnotation; -@property (nonatomic, readwrite, strong) NSArray *> *plotData; -@property (nonatomic, readwrite, strong) NSArray *> *plotData1; -@property (nonatomic, readwrite, strong) NSArray *> *plotData2; +@property (nonatomic, readwrite, strong, nonnull) NSArray *> *plotData; +@property (nonatomic, readwrite, strong, nonnull) NSArray *> *plotData1; +@property (nonatomic, readwrite, strong, nonnull) NSArray *> *plotData2; @end @@ -32,9 +32,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Curved Scatter Plot"; self.section = kLinePlots; } @@ -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++ ) { @@ -83,18 +83,18 @@ -(void)generateData NSDictionary *point1 = dataArray[i - 1]; NSDictionary *point2 = dataArray[i]; - double x1 = [point1[@"x"] doubleValue]; - double x2 = [point2[@"x"] doubleValue]; + double x1 = point1[@"x"].doubleValue; + double x2 = point2[@"x"].doubleValue; double dx = x2 - x1; double xLoc = (x1 + x2) * 0.5; - double y1 = [point1[@"y"] doubleValue]; - double y2 = [point2[@"y"] doubleValue]; + double y1 = point1[@"y"].doubleValue; + double y2 = point2[@"y"].doubleValue; double dy = y2 - y1; [contentArray addObject: @{ @"x": @(xLoc), - @"y": @( (dy / dx) / 20.0 ) } + @"y": @((dy / dx) / 20.0) } ]; } @@ -110,18 +110,18 @@ -(void)generateData NSDictionary *point1 = dataArray[i - 1]; NSDictionary *point2 = dataArray[i]; - double x1 = [point1[@"x"] doubleValue]; - double x2 = [point2[@"x"] doubleValue]; + double x1 = point1[@"x"].doubleValue; + double x2 = point2[@"x"].doubleValue; double dx = x2 - x1; double xLoc = (x1 + x2) * 0.5; - double y1 = [point1[@"y"] doubleValue]; - double y2 = [point2[@"y"] doubleValue]; + double y1 = point1[@"y"].doubleValue; + double y2 = point2[@"y"].doubleValue; double dy = y2 - y1; [contentArray addObject: @{ @"x": @(xLoc), - @"y": @( (dy / dx) / 20.0 ) } + @"y": @((dy / dx) / 20.0) } ]; } @@ -129,9 +129,9 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -169,7 +169,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP redLineStyle.lineColor = [[CPTColor redColor] colorWithAlphaComponent:0.5]; CPTLineCap *lineCap = [CPTLineCap sweptArrowPlotLineCap]; - lineCap.size = CGSizeMake( self.titleSize * CPTFloat(0.625), self.titleSize * CPTFloat(0.625) ); + lineCap.size = CGSizeMake(self.titleSize * CPTFloat(0.625), self.titleSize * CPTFloat(0.625)); // Axes // Label x axis with a fixed interval policy @@ -182,8 +182,11 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP x.axisConstraints = [CPTConstraints constraintWithRelativeOffset:0.5]; lineCap.lineStyle = x.axisLineStyle; - lineCap.fill = [CPTFill fillWithColor:lineCap.lineStyle.lineColor]; - x.axisLineCapMax = lineCap; + CPTColor *lineColor = lineCap.lineStyle.lineColor; + if ( lineColor ) { + lineCap.fill = [CPTFill fillWithColor:lineColor]; + } + x.axisLineCapMax = lineCap; x.title = @"X Axis"; x.titleOffset = self.titleSize * CPTFloat(1.25); @@ -197,11 +200,16 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP y.minorGridLineStyle = minorGridLineStyle; y.axisConstraints = [CPTConstraints constraintWithLowerOffset:0.0]; y.labelOffset = self.titleSize * CPTFloat(0.25); + y.alternatingBandFills = @[[[CPTColor whiteColor] colorWithAlphaComponent:CPTFloat(0.1)], [NSNull null]]; + y.alternatingBandAnchor = @0.0; lineCap.lineStyle = y.axisLineStyle; - lineCap.fill = [CPTFill fillWithColor:lineCap.lineStyle.lineColor]; - y.axisLineCapMax = lineCap; - y.axisLineCapMin = lineCap; + lineColor = lineCap.lineStyle.lineColor; + if ( lineColor ) { + lineCap.fill = [CPTFill fillWithColor:lineColor]; + } + y.axisLineCapMax = lineCap; + y.axisLineCapMin = lineCap; y.title = @"Y Axis"; y.titleOffset = self.titleSize * CPTFloat(1.25); @@ -232,7 +240,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP firstPlot.dataLineStyle = lineStyle; firstPlot.dataSource = self; -// [graph addPlot:firstPlot]; +// [graph addPlot:firstPlot]; // Second derivative CPTScatterPlot *secondPlot = [[CPTScatterPlot alloc] init]; @@ -241,19 +249,14 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP secondPlot.dataLineStyle = lineStyle; secondPlot.dataSource = self; -// [graph addPlot:secondPlot]; +// [graph addPlot:secondPlot]; // Auto scale the plot space to fit the plot data - [plotSpace scaleToFitPlots:[graph allPlots]]; + [plotSpace scaleToFitEntirePlots:[graph allPlots]]; CPTMutablePlotRange *xRange = [plotSpace.xRange mutableCopy]; CPTMutablePlotRange *yRange = [plotSpace.yRange mutableCopy]; // Expand the ranges to put some space around the plot - [xRange expandRangeByFactor:@1.2]; - [yRange expandRangeByFactor:@1.2]; - plotSpace.xRange = xRange; - plotSpace.yRange = yRange; - [xRange expandRangeByFactor:@1.025]; xRange.location = plotSpace.xRange.location; [yRange expandRangeByFactor:@1.05]; @@ -288,13 +291,13 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP graph.legend.borderLineStyle = x.axisLineStyle; graph.legend.cornerRadius = 5.0; graph.legendAnchor = CPTRectAnchorBottom; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(2.0) ); + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(2.0)); } #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { NSUInteger numRecords = 0; NSString *identifier = (NSString *)plot.identifier; @@ -312,7 +315,7 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot return numRecords; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num = nil; NSString *identifier = (NSString *)plot.identifier; @@ -333,7 +336,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI #pragma mark - #pragma mark Plot Space Delegate Methods --(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *)space willChangePlotRangeTo:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate { CPTGraph *theGraph = space.graph; CPTXYAxisSet *axisSet = (CPTXYAxisSet *)theGraph.axisSet; @@ -362,7 +365,7 @@ -(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotR #pragma mark - #pragma mark CPTScatterPlot delegate methods --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { CPTXYGraph *graph = (self.graphs)[0]; @@ -384,12 +387,12 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS NSNumber *x = dataPoint[@"x"]; NSNumber *y = dataPoint[@"y"]; - CPTNumberArray anchorPoint = @[x, y]; + CPTNumberArray *anchorPoint = @[x, y]; // Add annotation // First make a string for the y value NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - [formatter setMaximumFractionDigits:2]; + formatter.maximumFractionDigits = 2; NSString *yString = [formatter stringFromNumber:y]; // Now add the annotation to the plot area @@ -409,20 +412,22 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS annotation.contentAnchorPoint = CGPointMake(0.5, 0.0); annotation.displacement = CGPointMake(0.0, 10.0); [graph.plotAreaFrame.plotArea addAnnotation:annotation]; + + self.symbolTextAnnotation = annotation; } } --(void)scatterPlotDataLineWasSelected:(CPTScatterPlot *)plot +-(void)scatterPlotDataLineWasSelected:(nonnull CPTScatterPlot *)plot { NSLog(@"scatterPlotDataLineWasSelected: %@", plot); } --(void)scatterPlotDataLineTouchDown:(CPTScatterPlot *)plot +-(void)scatterPlotDataLineTouchDown:(nonnull CPTScatterPlot *)plot { NSLog(@"scatterPlotDataLineTouchDown: %@", plot); } --(void)scatterPlotDataLineTouchUp:(CPTScatterPlot *)plot +-(void)scatterPlotDataLineTouchUp:(nonnull CPTScatterPlot *)plot { NSLog(@"scatterPlotDataLineTouchUp: %@", plot); } @@ -430,13 +435,13 @@ -(void)scatterPlotDataLineTouchUp:(CPTScatterPlot *)plot #pragma mark - #pragma mark Plot area delegate method --(void)plotAreaWasSelected:(CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *__unused)plotArea { // Remove the annotation CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; if ( annotation ) { - CPTXYGraph *graph = [self.graphs objectAtIndex:0]; + CPTXYGraph *graph = (self.graphs)[0]; [graph.plotAreaFrame.plotArea removeAnnotation:annotation]; self.symbolTextAnnotation = nil; diff --git a/examples/CorePlotGallery/src/plots/DatePlot.h b/examples/CorePlotGallery/src/plots/DatePlot.h index 717841aa3..bc4c14c59 100644 --- a/examples/CorePlotGallery/src/plots/DatePlot.h +++ b/examples/CorePlotGallery/src/plots/DatePlot.h @@ -1,6 +1,6 @@ // -// DatePlot.h -// Plot Gallery-Mac +// DatePlot.h +// Plot Gallery-Mac // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/DatePlot.m b/examples/CorePlotGallery/src/plots/DatePlot.m index a55090831..3bc85e487 100644 --- a/examples/CorePlotGallery/src/plots/DatePlot.m +++ b/examples/CorePlotGallery/src/plots/DatePlot.m @@ -1,28 +1,40 @@ // -// DatePlot.m -// Plot Gallery-Mac +// DatePlot.m +// Plot Gallery-Mac // #import "DatePlot.h" +typedef NSDictionary CPTPlotData; + +typedef NSArray CPTPlotDataArray; +typedef NSMutableArray CPTMutablePlotDataArray; + +static const NSUInteger kNumPoints = 10; +static const NSTimeInterval oneDay = 24 * 60 * 60; + @interface DatePlot() -@property (nonatomic, readwrite, strong) NSArray *plotData; +@property (nonatomic, readwrite, strong, nonnull) CPTPlotDataArray *plotData; +@property (nonatomic, readwrite, strong, nullable) CPTPlotSpaceAnnotation *markerAnnotation; @end +#pragma mark - + @implementation DatePlot @synthesize plotData; +@synthesize markerAnnotation; +(void)load { [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Date Plot"; self.section = kLinePlots; } @@ -32,13 +44,11 @@ -(instancetype)init -(void)generateData { - if ( !self.plotData ) { - const NSTimeInterval oneDay = 24 * 60 * 60; - + if ( self.plotData.count == 0 ) { // Add some data - NSMutableArray *newData = [NSMutableArray array]; + CPTMutablePlotDataArray *newData = [NSMutableArray array]; - for ( NSUInteger i = 0; i < 5; i++ ) { + for ( NSUInteger i = 0; i < kNumPoints; i++ ) { NSTimeInterval xVal = oneDay * i; double yVal = 1.2 * arc4random() / (double)UINT32_MAX + 1.2; @@ -53,27 +63,25 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { // 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. NSDateComponents *dateComponents = [[NSDateComponents alloc] init]; - [dateComponents setMonth:10]; - [dateComponents setDay:29]; - [dateComponents setYear:2009]; - [dateComponents setHour:12]; - [dateComponents setMinute:0]; - [dateComponents setSecond:0]; + dateComponents.month = 10; + dateComponents.day = 29; + dateComponents.year = 2009; + dateComponents.hour = 12; + dateComponents.minute = 0; + dateComponents.second = 0; NSCalendar *gregorian = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; NSDate *refDate = [gregorian dateFromComponents:dateComponents]; - NSTimeInterval oneDay = 24 * 60 * 60; - -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -83,11 +91,20 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP [self addGraph:graph toHostingView:hostingView]; [self applyTheme:theme toGraph:graph withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; + graph.plotAreaFrame.paddingLeft = 36.0; + graph.plotAreaFrame.paddingTop = 12.0; + graph.plotAreaFrame.paddingRight = 12.0; + graph.plotAreaFrame.paddingBottom = 12.0; + // Setup scatter plot space CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace; - NSTimeInterval xLow = 0.0; - plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(xLow) length:@(oneDay * 5.0)]; - plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@3.0]; + + NSTimeInterval xLow = 0.0; + plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(xLow) length:@(oneDay * (kNumPoints - 1))]; + plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@2.0]; + + plotSpace.allowsUserInteraction = YES; + plotSpace.delegate = self; // Axes CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet; @@ -107,6 +124,24 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP y.minorTicksPerInterval = 5; y.orthogonalPosition = @(oneDay); + CPTMutableLineStyle *blueLineStyle = [CPTMutableLineStyle lineStyle]; + blueLineStyle.lineColor = [CPTColor blueColor]; + blueLineStyle.lineWidth = 2.0; + + CPTXYAxis *iAxis = [[CPTXYAxis alloc] initWithFrame:CGRectZero]; + iAxis.title = nil; + iAxis.labelFormatter = nil; + iAxis.axisLineStyle = blueLineStyle; + + iAxis.coordinate = CPTCoordinateY; + iAxis.plotSpace = graph.defaultPlotSpace; + iAxis.majorTickLineStyle = nil; + iAxis.minorTickLineStyle = nil; + iAxis.orthogonalPosition = @0.0; + iAxis.hidden = YES; + + graph.axisSet.axes = @[x, y, iAxis]; + // Create a plot that uses the data source method CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] init]; dataSourceLinePlot.identifier = @"Date Plot"; @@ -118,19 +153,125 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP dataSourceLinePlot.dataSource = self; [graph addPlot:dataSourceLinePlot]; + + // Setup a style for the annotation + CPTMutableTextStyle *hitAnnotationTextStyle = [CPTMutableTextStyle textStyle]; + hitAnnotationTextStyle.color = [CPTColor blackColor]; + hitAnnotationTextStyle.fontName = @"Helvetica-Bold"; + hitAnnotationTextStyle.fontSize = self.titleSize * CPTFloat(0.5); + + CPTTextLayer *textLayer = [[CPTTextLayer alloc] initWithText:@"Annotation" style:hitAnnotationTextStyle]; + textLayer.borderLineStyle = blueLineStyle; + textLayer.fill = [CPTFill fillWithColor:[CPTColor whiteColor]]; + textLayer.cornerRadius = 3.0; + textLayer.paddingLeft = 2.0; + textLayer.paddingTop = 2.0; + textLayer.paddingRight = 2.0; + textLayer.paddingBottom = 2.0; + textLayer.hidden = YES; + + CPTPlotSpaceAnnotation *annotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:plotSpace anchorPlotPoint:@[@0, @0]]; + annotation.contentLayer = textLayer; + + [graph addAnnotation:annotation]; + + self.markerAnnotation = annotation; } #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { return self.plotData[index][@(fieldEnum)]; } +#pragma mark - +#pragma mark Plot Space Delegate Methods + +-(CGPoint)plotSpace:(CPTPlotSpace *__unused)space willDisplaceBy:(CGPoint __unused)displacement +{ + return CPTPointMake(0.0, 0.0); +} + +-(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *__unused)newRange forCoordinate:(CPTCoordinate)coordinate +{ + CPTPlotRange *updatedRange = nil; + + CPTXYPlotSpace *xySpace = (CPTXYPlotSpace *)space; + + switch ( coordinate ) { + case CPTCoordinateX: + updatedRange = xySpace.xRange; + break; + + case CPTCoordinateY: + updatedRange = xySpace.yRange; + break; + + default: + break; + } + + return updatedRange; +} + +-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint __unused)point +{ + CPTXYPlotSpace *xySpace = (CPTXYPlotSpace *)space; + + CPTGraph *graph = space.graph; + + CPTXYAxisSet *axisSet = (CPTXYAxisSet *)graph.axisSet; + + CPTAxisArray *axes = axisSet.axes; + CPTXYAxis *iAxis = axes.lastObject; + + CPTNumberArray *plotPoint = [space plotPointForEvent:event]; + + CPTPlotSpaceAnnotation *annotation = self.markerAnnotation; + + CPTTextLayer *textLayer = (CPTTextLayer *)annotation.contentLayer; + + NSNumber *xNumber = plotPoint[CPTCoordinateX]; + + if ( [xySpace.xRange containsNumber:xNumber] ) { + NSUInteger x = (NSUInteger)lround(xNumber.doubleValue / oneDay); + + xNumber = @(x * oneDay); + + NSString *dateValue = [axisSet.xAxis.labelFormatter stringForObjectValue:xNumber]; + NSNumber *plotValue = self.plotData[x][@(CPTCoordinateY)]; + + textLayer.text = [NSString stringWithFormat:@"%@ → %@", dateValue, [NSString stringWithFormat:@"%1.3f", plotValue.doubleValue]]; + textLayer.hidden = NO; + + annotation.anchorPlotPoint = @[xNumber, xySpace.yRange.maxLimit]; + + iAxis.orthogonalPosition = xNumber; + iAxis.hidden = NO; + } + else { + textLayer.hidden = YES; + iAxis.hidden = YES; + } + + return NO; +} + +-(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)point +{ + return [self plotSpace:space shouldHandlePointingDeviceDownEvent:event atPoint:point]; +} + +-(BOOL)plotSpace:(CPTPlotSpace *__unused)space shouldHandlePointingDeviceUpEvent:(CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)point +{ + return NO; +} + @end diff --git a/examples/CorePlotGallery/src/plots/DonutChart.h b/examples/CorePlotGallery/src/plots/DonutChart.h index 0514a4ec7..bab4de00a 100644 --- a/examples/CorePlotGallery/src/plots/DonutChart.h +++ b/examples/CorePlotGallery/src/plots/DonutChart.h @@ -1,5 +1,8 @@ #import "PlotItem.h" -@interface DonutChart : PlotItem +@interface DonutChart : PlotItem @end diff --git a/examples/CorePlotGallery/src/plots/DonutChart.m b/examples/CorePlotGallery/src/plots/DonutChart.m index aefde8567..a56ec42fb 100644 --- a/examples/CorePlotGallery/src/plots/DonutChart.m +++ b/examples/CorePlotGallery/src/plots/DonutChart.m @@ -5,7 +5,7 @@ @interface DonutChart() -@property (nonatomic, readwrite, strong) CPTNumberArray plotData; +@property (nonatomic, readwrite, strong, nonnull) CPTNumberArray *plotData; @end @@ -18,9 +18,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Donut Chart"; self.section = kPieCharts; } @@ -30,14 +30,14 @@ -(instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { self.plotData = @[@20.0, @30.0, @60.0]; } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -59,8 +59,8 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP whiteShadow.shadowColor = [[CPTColor whiteColor] colorWithAlphaComponent:0.25]; // Add pie chart - const CGFloat outerRadius = MIN( CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * graph.paddingLeft) / CPTFloat(2.0), - CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * graph.paddingTop) / CPTFloat(2.0) ); + const CGFloat outerRadius = MIN(CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * graph.paddingLeft) / CPTFloat(2.0), + CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * graph.paddingTop) / CPTFloat(2.0)); const CGFloat innerRadius = outerRadius / CPTFloat(2.0); CPTPieChart *piePlot = [[CPTPieChart alloc] init]; @@ -92,7 +92,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP // Add another pie chart piePlot = [[CPTPieChart alloc] init]; piePlot.dataSource = self; - piePlot.pieRadius = CPTFloat( animated ? 0.0 : (innerRadius - 5.0) ); + piePlot.pieRadius = (animated ? CPTFloat(0.0) : (innerRadius - CPTFloat(5.0))); piePlot.identifier = innerChartName; piePlot.borderLineStyle = whiteLineStyle; piePlot.startAngle = CPTFloat(M_PI_4); @@ -113,7 +113,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP } } --(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index +-(void)pieChart:(nonnull CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"%@ slice was selected at index %lu. Value = %@", plot.identifier, (unsigned long)index, self.plotData[index]); } @@ -121,12 +121,12 @@ -(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)in #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num; @@ -140,21 +140,21 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI return num; } --(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *)plot recordIndex:(NSUInteger)index { static CPTMutableTextStyle *whiteText = nil; static dispatch_once_t onceToken = 0; CPTTextLayer *newLayer = nil; - if ( [(NSString *)plot.identifier isEqualToString : outerChartName] ) { + if ( [(NSString *) plot.identifier isEqualToString:outerChartName] ) { dispatch_once(&onceToken, ^{ - whiteText = [[CPTMutableTextStyle alloc] init]; - whiteText.color = [CPTColor whiteColor]; + whiteText = [[CPTMutableTextStyle alloc] init]; + whiteText.color = [CPTColor whiteColor]; whiteText.fontSize = self.titleSize * CPTFloat(0.5); }); - newLayer = [[CPTTextLayer alloc] initWithText:[NSString stringWithFormat:@"%.0f", [self.plotData[index] floatValue]] style:whiteText]; + newLayer = [[CPTTextLayer alloc] initWithText:[NSString stringWithFormat:@"%.0f", self.plotData[index].doubleValue] style:whiteText]; newLayer.fill = [CPTFill fillWithColor:[CPTColor darkGrayColor]]; newLayer.cornerRadius = 5.0; newLayer.paddingLeft = 3.0; @@ -167,11 +167,11 @@ -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index return newLayer; } --(CGFloat)radialOffsetForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index +-(CGFloat)radialOffsetForPieChart:(nonnull CPTPieChart *)pieChart recordIndex:(NSUInteger)index { CGFloat result = 0.0; - if ( [(NSString *)pieChart.identifier isEqualToString : outerChartName] ) { + if ( [(NSString *) pieChart.identifier isEqualToString:outerChartName] ) { result = (index == 0 ? 15.0 : 0.0); } return result; @@ -180,27 +180,27 @@ -(CGFloat)radialOffsetForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUIntege #pragma mark - #pragma mark Animation Delegate --(void)animationDidStart:(id)operation +-(void)animationDidStart:(nonnull id)operation { NSLog(@"animationDidStart: %@", operation); } --(void)animationDidFinish:(CPTAnimationOperation *)operation +-(void)animationDidFinish:(nonnull CPTAnimationOperation *)operation { NSLog(@"animationDidFinish: %@", operation); } --(void)animationCancelled:(CPTAnimationOperation *)operation +-(void)animationCancelled:(nonnull CPTAnimationOperation *)operation { NSLog(@"animationCancelled: %@", operation); } --(void)animationWillUpdate:(CPTAnimationOperation *)operation +-(void)animationWillUpdate:(nonnull CPTAnimationOperation *__unused)operation { NSLog(@"animationWillUpdate:"); } --(void)animationDidUpdate:(CPTAnimationOperation *)operation +-(void)animationDidUpdate:(nonnull CPTAnimationOperation *__unused)operation { NSLog(@"animationDidUpdate:"); } diff --git a/examples/CorePlotGallery/src/plots/FunctionPlot.m b/examples/CorePlotGallery/src/plots/FunctionPlot.m index 0adea48f8..839ca3d52 100644 --- a/examples/CorePlotGallery/src/plots/FunctionPlot.m +++ b/examples/CorePlotGallery/src/plots/FunctionPlot.m @@ -6,11 +6,7 @@ @interface FunctionPlot() @property (nonatomic, readwrite, strong) NSMutableSet *dataSources; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE --(UIFont *)italicFontForFont:(UIFont *)oldFont; -#else --(NSFont *)italicFontForFont:(NSFont *)oldFont; -#endif +-(nullable CPTNativeFont *)italicFontForFont:(nonnull CPTNativeFont *)oldFont; @end @@ -29,9 +25,9 @@ +(void)load #pragma mark - --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { dataSources = [[NSMutableSet alloc] init]; self.title = @"Math Function Plot"; @@ -48,9 +44,9 @@ -(void)killGraph [super killGraph]; } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -116,13 +112,13 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP 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); }; @@ -130,7 +126,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP break; case 2: - titleString = @"y = tan(x)"; + titleString = NSLocalizedString(@"y = tan(x)", @"y = tan(x)"); function = &tan; lineColor = [CPTColor blueColor]; break; @@ -139,29 +135,24 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP CPTScatterPlot *linePlot = [[CPTScatterPlot alloc] init]; linePlot.identifier = [NSString stringWithFormat:@"Function Plot %lu", (unsigned long)(plotNum + 1)]; - CPTDictionary textAttributes = x.titleTextStyle.attributes; + CPTDictionary *textAttributes = x.titleTextStyle.attributes; NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:titleString attributes:textAttributes]; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE - UIFont *italicFont = [self italicFontForFont:textAttributes[NSFontAttributeName]]; -#else - NSFont *italicFont = [self italicFontForFont:textAttributes[NSFontAttributeName]]; -#endif + CPTNativeFont *fontAttribute = textAttributes[NSFontAttributeName]; + if ( fontAttribute ) { + CPTNativeFont *italicFont = [self italicFontForFont:fontAttribute]; - [title addAttribute:NSFontAttributeName - value:italicFont - range:NSMakeRange(0, 1)]; - [title addAttribute:NSFontAttributeName - value:italicFont - range:NSMakeRange(8, 1)]; + [title addAttribute:NSFontAttributeName + value:italicFont + range:NSMakeRange(0, 1)]; + [title addAttribute:NSFontAttributeName + value:italicFont + range:NSMakeRange(8, 1)]; + } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE - UIFont *labelFont = [UIFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; -#else - NSFont *labelFont = [NSFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; -#endif + CPTNativeFont *labelFont = [CPTNativeFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; [title addAttribute:NSFontAttributeName value:labelFont range:NSMakeRange(0, title.length)]; @@ -204,18 +195,18 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP graph.legend.numberOfRows = 1; graph.legend.delegate = self; graph.legendAnchor = CPTRectAnchorBottom; - graph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(1.25) ); + graph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(1.25)); } #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE --(UIFont *)italicFontForFont:(UIFont *)oldFont +-(nullable UIFont *)italicFontForFont:(nonnull UIFont *)oldFont { NSString *italicName = nil; - CPTStringArray fontNames = [UIFont fontNamesForFamilyName:oldFont.familyName]; + CPTStringArray *fontNames = [UIFont fontNamesForFamilyName:oldFont.familyName]; for ( NSString *fontName in fontNames ) { - NSString *upperCaseFontName = [fontName uppercaseString]; + NSString *upperCaseFontName = fontName.uppercaseString; if ( [upperCaseFontName rangeOfString:@"ITALIC"].location != NSNotFound ) { italicName = fontName; break; @@ -223,7 +214,7 @@ -(UIFont *)italicFontForFont:(UIFont *)oldFont } if ( !italicName ) { for ( NSString *fontName in fontNames ) { - NSString *upperCaseFontName = [fontName uppercaseString]; + NSString *upperCaseFontName = fontName.uppercaseString; if ( [upperCaseFontName rangeOfString:@"OBLIQUE"].location != NSNotFound ) { italicName = fontName; break; @@ -240,16 +231,17 @@ -(UIFont *)italicFontForFont:(UIFont *)oldFont } #else --(NSFont *)italicFontForFont:(NSFont *)oldFont +-(nullable NSFont *)italicFontForFont:(nonnull NSFont *)oldFont { return [[NSFontManager sharedFontManager] convertFont:oldFont toHaveTrait:NSFontItalicTrait]; } + #endif #pragma mark - Legend delegate --(void)legend:(CPTLegend *)legend legendEntryForPlot:(CPTPlot *)plot wasSelectedAtIndex:(NSUInteger)idx +-(void)legend:(nonnull CPTLegend *__unused)legend legendEntryForPlot:(nonnull CPTPlot *)plot wasSelectedAtIndex:(NSUInteger __unused)idx { plot.hidden = !plot.hidden; } diff --git a/examples/CorePlotGallery/src/plots/GradientScatterPlot.h b/examples/CorePlotGallery/src/plots/GradientScatterPlot.h index 299b8cce3..627e9eb99 100644 --- a/examples/CorePlotGallery/src/plots/GradientScatterPlot.h +++ b/examples/CorePlotGallery/src/plots/GradientScatterPlot.h @@ -1,6 +1,6 @@ // -// GradientScatterPlot.h -// CorePlotGallery +// GradientScatterPlot.h +// CorePlotGallery // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/GradientScatterPlot.m b/examples/CorePlotGallery/src/plots/GradientScatterPlot.m index e54109f59..db1004011 100644 --- a/examples/CorePlotGallery/src/plots/GradientScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/GradientScatterPlot.m @@ -1,14 +1,14 @@ // -// GradientScatterPlot.m -// CorePlotGallery +// GradientScatterPlot.m +// CorePlotGallery // #import "GradientScatterPlot.h" @interface GradientScatterPlot() -@property (nonatomic, readwrite, strong) CPTPlotSpaceAnnotation *symbolTextAnnotation; -@property (nonatomic, readwrite, strong) NSArray *plotData; +@property (nonatomic, readwrite, strong, nullable) CPTPlotSpaceAnnotation *symbolTextAnnotation; +@property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; @end @@ -22,9 +22,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Gradient Scatter Plot"; self.section = kLinePlots; } @@ -34,7 +34,7 @@ -(instancetype)init -(void)killGraph { - if ( [self.graphs count] ) { + if ( self.graphs.count ) { CPTGraph *graph = (self.graphs)[0]; CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; @@ -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); @@ -61,9 +61,9 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -190,27 +190,23 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); NSNumber *num = self.plotData[index][key]; - if ( fieldEnum == CPTScatterPlotFieldY ) { - num = @([num doubleValue]); - } - return num; } #pragma mark - #pragma mark Plot Space Delegate Methods --(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *__unused)space willChangePlotRangeTo:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate { // Impose a limit on how far user can scroll in x if ( coordinate == CPTCoordinateX ) { @@ -226,7 +222,7 @@ -(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotR #pragma mark - #pragma mark CPTScatterPlot delegate method --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { CPTGraph *graph = (self.graphs)[0]; @@ -249,12 +245,12 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS NSNumber *x = dataPoint[@"x"]; NSNumber *y = dataPoint[@"y"]; - CPTNumberArray anchorPoint = @[x, y]; + CPTNumberArray *anchorPoint = @[x, y]; // Add annotation // First make a string for the y value NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - [formatter setMaximumFractionDigits:2]; + formatter.maximumFractionDigits = 2; NSString *yString = [formatter stringFromNumber:y]; // Now add the annotation to the plot area @@ -272,13 +268,13 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS #pragma mark - #pragma mark Plot area delegate method --(void)plotAreaWasSelected:(CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *__unused)plotArea { // Remove the annotation CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; if ( annotation ) { - CPTXYGraph *graph = [self.graphs objectAtIndex:0]; + CPTXYGraph *graph = (self.graphs)[0]; [graph.plotAreaFrame.plotArea removeAnnotation:annotation]; self.symbolTextAnnotation = nil; diff --git a/examples/CorePlotGallery/src/plots/ImageDemo.h b/examples/CorePlotGallery/src/plots/ImageDemo.h index 714a09bd4..bc8886a20 100644 --- a/examples/CorePlotGallery/src/plots/ImageDemo.h +++ b/examples/CorePlotGallery/src/plots/ImageDemo.h @@ -1,6 +1,6 @@ // -// ImageDemo.h -// Plot Gallery +// ImageDemo.h +// Plot Gallery // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/ImageDemo.m b/examples/CorePlotGallery/src/plots/ImageDemo.m index c6b69b8dc..df304a094 100644 --- a/examples/CorePlotGallery/src/plots/ImageDemo.m +++ b/examples/CorePlotGallery/src/plots/ImageDemo.m @@ -1,6 +1,6 @@ // -// ImageDemo.m -// Plot Gallery +// ImageDemo.m +// Plot Gallery // #import "ImageDemo.h" @@ -12,9 +12,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Image Demo"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(instancetype)init return self; } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; diff --git a/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.h b/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.h index 73cafa63d..cd498bfe3 100644 --- a/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.h +++ b/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.h @@ -1,6 +1,6 @@ // -// LabelingPolicyDemo.h -// Plot Gallery +// LabelingPolicyDemo.h +// Plot Gallery // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.m b/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.m index ab2ffc431..5be94fe80 100644 --- a/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.m +++ b/examples/CorePlotGallery/src/plots/LabelingPolicyDemo.m @@ -1,6 +1,6 @@ // -// LabelingPolicyDemo.m -// Plot Gallery +// LabelingPolicyDemo.m +// Plot Gallery // #import "LabelingPolicyDemo.h" @@ -12,9 +12,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Axis Labeling Policies"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(instancetype)init return self; } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { const CGFloat majorTickLength = 12.0; const CGFloat minorTickLength = 8.0; @@ -70,9 +70,9 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP axisTitleTextStyle.fontName = @"Helvetica-Bold"; // Tick locations - CPTNumberSet majorTickLocations = [NSSet setWithObjects:@0, @30, @50, @85, @100, nil]; + CPTNumberSet *majorTickLocations = [NSSet setWithObjects:@0, @30, @50, @85, @100, nil]; - CPTMutableNumberSet minorTickLocations = [NSMutableSet set]; + CPTMutableNumberSet *minorTickLocations = [NSMutableSet set]; for ( NSUInteger loc = 0; loc <= 100; loc += 10 ) { [minorTickLocations addObject:@(loc)]; } @@ -95,7 +95,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP axisNone.majorTickLocations = majorTickLocations; axisNone.minorTickLocations = minorTickLocations; - CPTMutableAxisLabelSet newAxisLabels = [NSMutableSet set]; + CPTMutableAxisLabelSet *newAxisLabels = [NSMutableSet set]; for ( NSUInteger i = 0; i <= 5; i++ ) { CPTAxisLabel *newLabel = [[CPTAxisLabel alloc] initWithText:[NSString stringWithFormat:@"Label %lu", (unsigned long)i] textStyle:axisNone.labelTextStyle]; diff --git a/examples/CorePlotGallery/src/plots/LineCapDemo.h b/examples/CorePlotGallery/src/plots/LineCapDemo.h index 196e5502f..479f2f7eb 100644 --- a/examples/CorePlotGallery/src/plots/LineCapDemo.h +++ b/examples/CorePlotGallery/src/plots/LineCapDemo.h @@ -1,6 +1,6 @@ // -// LineCapDemo.h -// Plot Gallery +// LineCapDemo.h +// Plot Gallery // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/LineCapDemo.m b/examples/CorePlotGallery/src/plots/LineCapDemo.m index e00880c24..c5b5eb68f 100644 --- a/examples/CorePlotGallery/src/plots/LineCapDemo.m +++ b/examples/CorePlotGallery/src/plots/LineCapDemo.m @@ -1,6 +1,6 @@ // -// LineCapDemo.m -// Plot Gallery +// LineCapDemo.m +// Plot Gallery // #import "LineCapDemo.h" @@ -12,9 +12,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Line Caps"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(instancetype)init return self; } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { #if TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; @@ -60,7 +60,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP lineCap.fill = [CPTFill fillWithColor:[CPTColor blueColor]]; // Axes - CPTMutableAxisArray axes = [[NSMutableArray alloc] init]; + CPTMutableAxisArray *axes = [[NSMutableArray alloc] init]; CPTLineCapType lineCapType = CPTLineCapTypeNone; while ( lineCapType < CPTLineCapTypeCustom ) { diff --git a/examples/CorePlotGallery/src/plots/OHLCPlot.h b/examples/CorePlotGallery/src/plots/OHLCPlot.h index 5f25f97ef..a29b0936a 100644 --- a/examples/CorePlotGallery/src/plots/OHLCPlot.h +++ b/examples/CorePlotGallery/src/plots/OHLCPlot.h @@ -1,10 +1,11 @@ // -// OHLCPlot.h -// CorePlotGallery +// OHLCPlot.h +// CorePlotGallery // #import "PlotItem.h" -@interface OHLCPlot : PlotItem +@interface OHLCPlot : PlotItem @end diff --git a/examples/CorePlotGallery/src/plots/OHLCPlot.m b/examples/CorePlotGallery/src/plots/OHLCPlot.m index 415d757f0..7761c4069 100644 --- a/examples/CorePlotGallery/src/plots/OHLCPlot.m +++ b/examples/CorePlotGallery/src/plots/OHLCPlot.m @@ -1,6 +1,6 @@ // -// OHLCPlot.m -// CorePlotGallery +// OHLCPlot.m +// CorePlotGallery // #import "OHLCPlot.h" @@ -9,8 +9,8 @@ @interface OHLCPlot() -@property (nonatomic, readwrite, strong) CPTGraph *graph; -@property (nonatomic, readwrite, strong) NSArray *plotData; +@property (nonatomic, readwrite, strong, nullable) CPTGraph *graph; +@property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; @end @@ -24,11 +24,11 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"OHLC Plot"; self.section = kFinancialPlots; @@ -39,15 +39,15 @@ -(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; double rOpen = 3.0 * arc4random() / (double)UINT32_MAX + 1.0; double rClose = (arc4random() / (double)UINT32_MAX - 0.5) * 0.125 + rOpen; - double rHigh = MAX( rOpen, MAX(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen) ); - double rLow = MIN( rOpen, MIN(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen) ); + double rHigh = MAX(rOpen, MAX(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen)); + double rLow = MIN(rOpen, MIN(rClose, (arc4random() / (double)UINT32_MAX - 0.5) * 0.5 + rOpen)); [newData addObject: @{ @(CPTTradingRangePlotFieldX): @(x), @@ -62,14 +62,14 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { // 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. NSDate *refDate = [NSDate dateWithTimeIntervalSinceReferenceDate:oneDay / 2.0]; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -105,7 +105,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP CPTLineCap *lineCap = [[CPTLineCap alloc] init]; lineCap.lineStyle = xAxis.axisLineStyle; lineCap.lineCapType = CPTLineCapTypeOpenArrow; - lineCap.size = CGSizeMake( self.titleSize * CPTFloat(0.5), self.titleSize * CPTFloat(0.5) ); + lineCap.size = CGSizeMake(self.titleSize * CPTFloat(0.5), self.titleSize * CPTFloat(0.5)); xAxis.axisLineCapMax = lineCap; CPTXYAxis *yAxis = xyAxisSet.yAxis; @@ -170,7 +170,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP newGraph.legend.cornerRadius = 5.0; newGraph.legend.swatchCornerRadius = 5.0; newGraph.legendAnchor = CPTRectAnchorBottom; - newGraph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(3.0) ); + newGraph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(3.0)); // Set plot ranges CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace; @@ -181,12 +181,12 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSDecimalNumber *num = [NSDecimalNumber zero]; @@ -213,7 +213,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI #pragma mark - #pragma mark Plot Delegate Methods --(void)tradingRangePlot:(CPTTradingRangePlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index +-(void)tradingRangePlot:(nonnull CPTTradingRangePlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"Bar for '%@' was selected at index %d.", plot.identifier, (int)index); } diff --git a/examples/CorePlotGallery/src/plots/PlotSpaceDemo.h b/examples/CorePlotGallery/src/plots/PlotSpaceDemo.h index 9c11d2ba9..b384b8bea 100644 --- a/examples/CorePlotGallery/src/plots/PlotSpaceDemo.h +++ b/examples/CorePlotGallery/src/plots/PlotSpaceDemo.h @@ -1,6 +1,6 @@ // -// PlotSpaceDemo.h -// Plot Gallery +// PlotSpaceDemo.h +// Plot Gallery // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/PlotSpaceDemo.m b/examples/CorePlotGallery/src/plots/PlotSpaceDemo.m index f9cb8efde..c192afd12 100644 --- a/examples/CorePlotGallery/src/plots/PlotSpaceDemo.m +++ b/examples/CorePlotGallery/src/plots/PlotSpaceDemo.m @@ -1,6 +1,6 @@ // -// PlotSpaceDemo.m -// Plot Gallery +// PlotSpaceDemo.m +// Plot Gallery // #import "PlotSpaceDemo.h" @@ -12,9 +12,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Plot Space Demo"; self.section = kDemoPlots; } @@ -22,7 +22,7 @@ -(instancetype)init return self; } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { const CGFloat majorTickLength = 12.0; const CGFloat minorTickLength = 8.0; diff --git a/examples/CorePlotGallery/src/plots/RangePlot.h b/examples/CorePlotGallery/src/plots/RangePlot.h index 6ba3e717a..53327e4fa 100644 --- a/examples/CorePlotGallery/src/plots/RangePlot.h +++ b/examples/CorePlotGallery/src/plots/RangePlot.h @@ -1,10 +1,12 @@ // -// RangePlot.h -// CorePlotGallery +// RangePlot.h +// CorePlotGallery // #import "PlotItem.h" -@interface RangePlot : PlotItem +@interface RangePlot : PlotItem @end diff --git a/examples/CorePlotGallery/src/plots/RangePlot.m b/examples/CorePlotGallery/src/plots/RangePlot.m index 175d887f8..779a94ee0 100644 --- a/examples/CorePlotGallery/src/plots/RangePlot.m +++ b/examples/CorePlotGallery/src/plots/RangePlot.m @@ -1,6 +1,6 @@ // -// RangePlot.m -// CorePlotGallery +// RangePlot.m +// CorePlotGallery // #import "RangePlot.h" @@ -9,10 +9,10 @@ @interface RangePlot() -@property (nonatomic, readwrite, strong) CPTGraph *graph; -@property (nonatomic, readwrite, strong) NSArray *plotData; -@property (nonatomic, readwrite, strong) CPTFill *areaFill; -@property (nonatomic, readwrite, strong) CPTLineStyle *barLineStyle; +@property (nonatomic, readwrite, strong, nullable) CPTGraph *graph; +@property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; +@property (nonatomic, readwrite, strong, nonnull) CPTFill *areaFill; +@property (nonatomic, readwrite, strong, nonnull) CPTLineStyle *barLineStyle; @end @@ -28,11 +28,11 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { graph = nil; - plotData = nil; + plotData = @[]; self.title = @"Range Plot"; self.section = kFinancialPlots; @@ -43,7 +43,7 @@ -(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); @@ -68,25 +68,26 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { // 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. NSDate *refDate = [NSDate dateWithTimeIntervalSinceReferenceDate:oneDay / 2.0]; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); #endif CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:bounds]; + self.graph = newGraph; + [self addGraph:newGraph toHostingView:hostingView]; [self applyTheme:theme toGraph:newGraph withDefault:[CPTTheme themeNamed:kCPTDarkGradientTheme]]; newGraph.plotAreaFrame.masksToBorder = NO; - self.graph = newGraph; // Instructions CPTMutableTextStyle *textStyle = [CPTMutableTextStyle textStyle]; @@ -94,7 +95,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP textStyle.fontName = @"Helvetica"; textStyle.fontSize = self.titleSize * CPTFloat(0.5); -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CPTTextLayer *textLayer = [[CPTTextLayer alloc] initWithText:@"Touch to Toggle Range Plot Style" style:textStyle]; #else CPTTextLayer *textLayer = [[CPTTextLayer alloc] initWithText:@"Click to Toggle Range Plot Style" style:textStyle]; @@ -169,19 +170,20 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP newGraph.legend.borderLineStyle = x.axisLineStyle; newGraph.legend.cornerRadius = 5.0; newGraph.legend.swatchCornerRadius = 3.0; + newGraph.legend.swatchLayout = CPTLegendSwatchLayoutBottom; newGraph.legendAnchor = CPTRectAnchorTop; - newGraph.legendDisplacement = CGPointMake( 0.0, self.titleSize * CPTFloat(-2.0) - CPTFloat(12.0) ); + newGraph.legendDisplacement = CGPointMake(0.0, self.titleSize * CPTFloat(-2.0) - CPTFloat(12.0)); } #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { return self.plotData[index][@(fieldEnum)]; } @@ -189,7 +191,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI #pragma mark - #pragma mark Plot Space Delegate Methods --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)event atPoint:(CGPoint)point +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceUpEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)point { CPTRangePlot *rangePlot = (CPTRangePlot *)[self.graph plotWithIdentifier:@"Range Plot"]; @@ -208,10 +210,15 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)eve return NO; } +-(nullable NSNumber *)barWidthForRangePlot:(nonnull CPTRangePlot *__unused)plot recordIndex:(NSUInteger __unused)idx +{ + return @(arc4random_uniform(85) + 15); +} + #pragma mark - #pragma mark Plot Delegate Methods --(void)rangePlot:(CPTRangePlot *)plot rangeWasSelectedAtRecordIndex:(NSUInteger)index +-(void)rangePlot:(nonnull CPTRangePlot *)plot rangeWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"Range for '%@' was selected at index %d.", plot.identifier, (int)index); } diff --git a/examples/CorePlotGallery/src/plots/RealTimePlot.h b/examples/CorePlotGallery/src/plots/RealTimePlot.h index 0684082cd..dff911140 100644 --- a/examples/CorePlotGallery/src/plots/RealTimePlot.h +++ b/examples/CorePlotGallery/src/plots/RealTimePlot.h @@ -1,12 +1,12 @@ // -// RealTimePlot.h -// CorePlotGallery +// RealTimePlot.h +// CorePlotGallery // #import "PlotItem.h" @interface RealTimePlot : PlotItem --(void)newData:(NSTimer *)theTimer; +-(void)newData:(nonnull NSTimer *)theTimer; @end diff --git a/examples/CorePlotGallery/src/plots/RealTimePlot.m b/examples/CorePlotGallery/src/plots/RealTimePlot.m index 85ff7bb6a..053fdda2b 100644 --- a/examples/CorePlotGallery/src/plots/RealTimePlot.m +++ b/examples/CorePlotGallery/src/plots/RealTimePlot.m @@ -1,6 +1,6 @@ // -// RealTimePlot.m -// CorePlotGallery +// RealTimePlot.m +// CorePlotGallery // #import "RealTimePlot.h" @@ -13,9 +13,9 @@ @interface RealTimePlot() -@property (nonatomic, readwrite, strong) CPTMutableNumberArray plotData; +@property (nonatomic, readwrite, strong, nonnull) CPTMutableNumberArray *plotData; @property (nonatomic, readwrite, assign) NSUInteger currentIndex; -@property (nonatomic, readwrite, strong) NSTimer *dataTimer; +@property (nonatomic, readwrite, strong, nullable) NSTimer *dataTimer; @end @@ -30,9 +30,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { plotData = [[NSMutableArray alloc] initWithCapacity:kMaxDataPoints]; dataTimer = nil; @@ -57,9 +57,9 @@ -(void)generateData self.currentIndex = 0; } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -137,12 +137,13 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP [self.dataTimer invalidate]; if ( animated ) { - self.dataTimer = [NSTimer timerWithTimeInterval:1.0 / kFrameRate - target:self - selector:@selector(newData:) - userInfo:nil - repeats:YES]; - [[NSRunLoop mainRunLoop] addTimer:self.dataTimer forMode:NSRunLoopCommonModes]; + NSTimer *newTimer = [NSTimer timerWithTimeInterval:1.0 / kFrameRate + target:self + selector:@selector(newData:) + userInfo:nil + repeats:YES]; + self.dataTimer = newTimer; + [[NSRunLoop mainRunLoop] addTimer:newTimer forMode:NSRunLoopCommonModes]; } else { self.dataTimer = nil; @@ -157,7 +158,7 @@ -(void)dealloc #pragma mark - #pragma mark Timer callback --(void)newData:(NSTimer *)theTimer +-(void)newData:(nonnull NSTimer *__unused)theTimer { CPTGraph *theGraph = (self.graphs)[0]; CPTPlot *thePlot = [theGraph plotWithIdentifier:kPlotIdentifier]; @@ -171,7 +172,7 @@ -(void)newData:(NSTimer *)theTimer CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)theGraph.defaultPlotSpace; NSUInteger location = (self.currentIndex >= kMaxDataPoints ? self.currentIndex - kMaxDataPoints + 2 : 0); - CPTPlotRange *oldRange = [CPTPlotRange plotRangeWithLocation:@( (location > 0) ? (location - 1) : 0 ) + CPTPlotRange *oldRange = [CPTPlotRange plotRangeWithLocation:@((location > 0) ? (location - 1) : 0) length:@(kMaxDataPoints - 2)]; CPTPlotRange *newRange = [CPTPlotRange plotRangeWithLocation:@(location) length:@(kMaxDataPoints - 2)]; @@ -183,7 +184,7 @@ -(void)newData:(NSTimer *)theTimer duration:CPTFloat(1.0 / kFrameRate)]; self.currentIndex++; - [self.plotData addObject:@( (1.0 - kAlpha) * [[self.plotData lastObject] doubleValue] + kAlpha * arc4random() / (double)UINT32_MAX )]; + [self.plotData addObject:@((1.0 - kAlpha) * self.plotData.lastObject.doubleValue + kAlpha * arc4random() / (double)UINT32_MAX)]; [thePlot insertDataAtIndex:self.plotData.count - 1 numberOfRecords:1]; } } @@ -191,12 +192,12 @@ -(void)newData:(NSTimer *)theTimer #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num = nil; diff --git a/examples/CorePlotGallery/src/plots/SimplePieChart.h b/examples/CorePlotGallery/src/plots/SimplePieChart.h index cb35ffaf2..569890585 100644 --- a/examples/CorePlotGallery/src/plots/SimplePieChart.h +++ b/examples/CorePlotGallery/src/plots/SimplePieChart.h @@ -1,6 +1,6 @@ // -// SimplePieChart.h -// CorePlotGallery +// SimplePieChart.h +// CorePlotGallery // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/SimplePieChart.m b/examples/CorePlotGallery/src/plots/SimplePieChart.m index 6bb29fd2c..76e5c79ac 100644 --- a/examples/CorePlotGallery/src/plots/SimplePieChart.m +++ b/examples/CorePlotGallery/src/plots/SimplePieChart.m @@ -1,13 +1,13 @@ // -// SimplePieChart.m -// CorePlotGallery +// SimplePieChart.m +// CorePlotGallery // #import "SimplePieChart.h" @interface SimplePieChart() -@property (nonatomic, readwrite, strong) CPTNumberArray plotData; +@property (nonatomic, readwrite, strong, nonnull) CPTNumberArray *plotData; @property (nonatomic, readwrite) NSUInteger offsetIndex; @property (nonatomic, readwrite) CGFloat sliceOffset; @@ -24,9 +24,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Simple Pie Chart"; self.section = kPieCharts; @@ -38,14 +38,14 @@ -(instancetype)init -(void)generateData { - if ( self.plotData == nil ) { + if ( self.plotData.count == 0 ) { self.plotData = @[@20.0, @30.0, @60.0]; } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -68,8 +68,8 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP // Add pie chart CPTPieChart *piePlot = [[CPTPieChart alloc] init]; piePlot.dataSource = self; - piePlot.pieRadius = MIN( CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * graph.paddingLeft) / CPTFloat(2.0), - CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * graph.paddingTop) / CPTFloat(2.0) ); + piePlot.pieRadius = MIN(CPTFloat(0.7) * (hostingView.frame.size.height - CPTFloat(2.0) * graph.paddingLeft) / CPTFloat(2.0), + CPTFloat(0.7) * (hostingView.frame.size.width - CPTFloat(2.0) * graph.paddingTop) / CPTFloat(2.0)); piePlot.identifier = self.title; piePlot.startAngle = CPTFloat(M_PI_4); piePlot.sliceDirection = CPTPieDirectionCounterClockwise; @@ -105,18 +105,18 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP graph.legendDisplacement = CGPointMake(-graph.paddingRight - CPTFloat(10.0), 0.0); } --(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index +-(nullable CPTLayer *)dataLabelForPlot:(nonnull CPTPlot *__unused)plot recordIndex:(NSUInteger)index { static CPTMutableTextStyle *whiteText = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - whiteText = [[CPTMutableTextStyle alloc] init]; - whiteText.color = [CPTColor whiteColor]; + whiteText = [[CPTMutableTextStyle alloc] init]; + whiteText.color = [CPTColor whiteColor]; whiteText.fontSize = self.titleSize * CPTFloat(0.5); }); - CPTTextLayer *newLayer = [[CPTTextLayer alloc] initWithText:[NSString stringWithFormat:@"%1.0f", [self.plotData[index] floatValue]] + CPTTextLayer *newLayer = [[CPTTextLayer alloc] initWithText:[NSString stringWithFormat:@"%1.0f", self.plotData[index].doubleValue] style:whiteText]; return newLayer; } @@ -124,19 +124,19 @@ -(CPTLayer *)dataLabelForPlot:(CPTPlot *)plot recordIndex:(NSUInteger)index #pragma mark - #pragma mark CPTPieChartDelegate Methods --(void)plot:(CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)index +-(void)Plot:(nonnull CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"Data label for '%@' was selected at index %d.", plot.identifier, (int)index); } --(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index +-(void)pieChart:(nonnull CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)index { - NSLog(@"Slice was selected at index %d. Value = %f", (int)index, [self.plotData[index] floatValue]); + NSLog(@"Slice was selected at index %d. Value = %f", (int)index, self.plotData[index].doubleValue); self.offsetIndex = NSNotFound; - CPTMutableNumberArray newData = [[NSMutableArray alloc] init]; - NSUInteger dataCount = (NSUInteger)lrint( ceil(10.0 * arc4random() / (double)UINT32_MAX) ) + 1; + CPTMutableNumberArray *newData = [[NSMutableArray alloc] init]; + NSUInteger dataCount = (NSUInteger)lrint(ceil(10.0 * arc4random() / (double)UINT32_MAX)) + 1; for ( NSUInteger i = 1; i < dataCount; i++ ) { [newData addObject:@(100.0 * arc4random() / (double)UINT32_MAX)]; } @@ -150,14 +150,14 @@ -(void)pieChart:(CPTPieChart *)plot sliceWasSelectedAtRecordIndex:(NSUInteger)in #pragma mark - #pragma mark CPTLegendDelegate Methods --(void)legend:(CPTLegend *)legend legendEntryForPlot:(CPTPlot *)plot wasSelectedAtIndex:(NSUInteger)idx +-(void)legend:(nonnull CPTLegend *__unused)legend legendEntryForPlot:(nonnull CPTPlot *)plot wasSelectedAtIndex:(NSUInteger)idx { NSLog(@"Legend entry for '%@' was selected at index %lu.", plot.identifier, (unsigned long)idx); [CPTAnimation animate:self property:@"sliceOffset" - from:(idx == self.offsetIndex ? NAN : 0.0) - to:(idx == self.offsetIndex ? 0.0 : 35.0) + from:(idx == self.offsetIndex ? CPTNAN : CPTFloat(0.0)) + to:(idx == self.offsetIndex ? CPTFloat(0.0) : CPTFloat(35.0)) duration:0.5 animationCurve:CPTAnimationCurveCubicOut delegate:nil]; @@ -168,12 +168,12 @@ -(void)legend:(CPTLegend *)legend legendEntryForPlot:(CPTPlot *)plot wasSelected #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSNumber *num; @@ -187,17 +187,14 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI return num; } --(NSAttributedString *)attributedLegendTitleForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index +-(NSAttributedString *)attributedLegendTitleForPieChart:(nonnull CPTPieChart *__unused)pieChart recordIndex:(NSUInteger)index { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE - UIColor *sliceColor = [CPTPieChart defaultPieSliceColorForIndex:index].uiColor; - UIFont *labelFont = [UIFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; -#else - NSColor *sliceColor = [CPTPieChart defaultPieSliceColorForIndex:index].nsColor; - NSFont *labelFont = [NSFont fontWithName:@"Helvetica" size:self.titleSize * CPTFloat(0.5)]; -#endif + CPTNativeColor *sliceColor = [CPTPieChart defaultPieSliceColorForIndex:index].nativeColor; + CPTNativeFont *labelFont = [CPTNativeFont fontWithName:@"Helvetica" + size:self.titleSize * CPTFloat(0.5)]; NSMutableAttributedString *title = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Pie Slice %lu", (unsigned long)index]]; + [title addAttribute:NSForegroundColorAttributeName value:sliceColor range:NSMakeRange(4, 5)]; @@ -209,7 +206,7 @@ -(NSAttributedString *)attributedLegendTitleForPieChart:(CPTPieChart *)pieChart return title; } --(CGFloat)radialOffsetForPieChart:(CPTPieChart *)pieChart recordIndex:(NSUInteger)index +-(CGFloat)radialOffsetForPieChart:(nonnull CPTPieChart *__unused)pieChart recordIndex:(NSUInteger)index { return index == self.offsetIndex ? self.sliceOffset : 0.0; } @@ -224,7 +221,7 @@ -(void)setSliceOffset:(CGFloat)newOffset [self.graphs[0] reloadData]; - if ( newOffset == 0.0 ) { + if ( newOffset == CPTFloat(0.0)) { self.offsetIndex = NSNotFound; } } diff --git a/examples/CorePlotGallery/src/plots/SimpleScatterPlot.h b/examples/CorePlotGallery/src/plots/SimpleScatterPlot.h index e974a12cd..9b86f8bb3 100644 --- a/examples/CorePlotGallery/src/plots/SimpleScatterPlot.h +++ b/examples/CorePlotGallery/src/plots/SimpleScatterPlot.h @@ -1,6 +1,6 @@ // -// SimpleScatterPlot.h -// CorePlotGallery +// SimpleScatterPlot.h +// CorePlotGallery // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m b/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m index 98450bab8..4a321efc4 100644 --- a/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/SimpleScatterPlot.m @@ -1,14 +1,14 @@ // -// SimpleScatterPlot.m -// CorePlotGallery +// SimpleScatterPlot.m +// CorePlotGallery // #import "SimpleScatterPlot.h" @interface SimpleScatterPlot() -@property (nonatomic, readwrite, strong) CPTPlotSpaceAnnotation *symbolTextAnnotation; -@property (nonatomic, readwrite, strong) NSArray *plotData; +@property (nonatomic, readwrite, strong, nullable) CPTPlotSpaceAnnotation *symbolTextAnnotation; +@property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; @property (nonatomic, readwrite, assign) CPTScatterPlotHistogramOption histogramOption; @end @@ -24,9 +24,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Simple Scatter Plot"; self.section = kLinePlots; @@ -38,7 +38,7 @@ -(instancetype)init -(void)killGraph { - if ( [self.graphs count] ) { + if ( self.graphs.count ) { CPTGraph *graph = (self.graphs)[0]; CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; @@ -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); @@ -65,9 +65,9 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -184,12 +184,12 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); NSNumber *num = self.plotData[index][key]; @@ -200,7 +200,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI #pragma mark - #pragma mark Plot Space Delegate Methods --(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(nullable CPTPlotRange *)plotSpace:(nonnull CPTPlotSpace *__unused)space willChangePlotRangeTo:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate { // Impose a limit on how far user can scroll in x if ( coordinate == CPTCoordinateX ) { @@ -217,7 +217,7 @@ -(CPTPlotRange *)plotSpace:(CPTPlotSpace *)space willChangePlotRangeTo:(CPTPlotR #pragma mark - #pragma mark CPTScatterPlot delegate methods --(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index +-(void)scatterPlot:(nonnull CPTScatterPlot *__unused)plot plotSymbolWasSelectedAtRecordIndex:(NSUInteger)index { CPTXYGraph *graph = (self.graphs)[0]; @@ -240,12 +240,12 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS NSNumber *x = dataPoint[@"x"]; NSNumber *y = dataPoint[@"y"]; - CPTNumberArray anchorPoint = @[x, y]; + CPTNumberArray *anchorPoint = @[x, y]; // Add annotation // First make a string for the y value NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - [formatter setMaximumFractionDigits:2]; + formatter.maximumFractionDigits = 2; NSString *yString = [formatter stringFromNumber:y]; // Now add the annotation to the plot area @@ -260,17 +260,17 @@ -(void)scatterPlot:(CPTScatterPlot *)plot plotSymbolWasSelectedAtRecordIndex:(NS } } --(void)scatterPlotDataLineWasSelected:(CPTScatterPlot *)plot +-(void)scatterPlotDataLineWasSelected:(nonnull CPTScatterPlot *)plot { NSLog(@"scatterPlotDataLineWasSelected: %@", plot); } --(void)scatterPlotDataLineTouchDown:(CPTScatterPlot *)plot +-(void)scatterPlotDataLineTouchDown:(nonnull CPTScatterPlot *)plot { NSLog(@"scatterPlotDataLineTouchDown: %@", plot); } --(void)scatterPlotDataLineTouchUp:(CPTScatterPlot *)plot +-(void)scatterPlotDataLineTouchUp:(nonnull CPTScatterPlot *)plot { NSLog(@"scatterPlotDataLineTouchUp: %@", plot); } @@ -278,9 +278,9 @@ -(void)scatterPlotDataLineTouchUp:(CPTScatterPlot *)plot #pragma mark - #pragma mark Plot area delegate method --(void)plotAreaWasSelected:(CPTPlotArea *)plotArea +-(void)plotAreaWasSelected:(nonnull CPTPlotArea *__unused)plotArea { - CPTXYGraph *graph = [self.graphs objectAtIndex:0]; + CPTXYGraph *graph = (self.graphs)[0]; if ( graph ) { // Remove the annotation @@ -293,8 +293,8 @@ -(void)plotAreaWasSelected:(CPTPlotArea *)plotArea else { CPTScatterPlotInterpolation interpolation = CPTScatterPlotInterpolationHistogram; - // Decrease the histogram display option, and if < 0 display linear graph - if ( --self.histogramOption < 0 ) { + // Decrease the histogram display option, and if < CPTScatterPlotHistogramNormal display linear graph + if ( --self.histogramOption < CPTScatterPlotHistogramNormal ) { interpolation = CPTScatterPlotInterpolationLinear; // Set the histogram option to the count, as that is guaranteed to be the last available option + 1 diff --git a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.h b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.h index 6ce56f9a2..4d8d78d2e 100644 --- a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.h +++ b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.h @@ -1,6 +1,6 @@ // -// SteppedScatterPlot.h -// Plot Gallery-Mac +// SteppedScatterPlot.h +// Plot Gallery-Mac // #import "PlotItem.h" @@ -8,4 +8,5 @@ @interface SteppedScatterPlot : PlotItem + @end diff --git a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m index 1aa277843..861e3a1b7 100644 --- a/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m +++ b/examples/CorePlotGallery/src/plots/SteppedScatterPlot.m @@ -1,13 +1,13 @@ // -// SteppedScatterPlot.m -// Plot Gallery-Mac +// SteppedScatterPlot.m +// Plot Gallery-Mac // #import "SteppedScatterPlot.h" @interface SteppedScatterPlot() -@property (nonatomic, readwrite, strong) NSArray *plotData; +@property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; @end @@ -20,9 +20,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Stepped Scatter Plot"; self.section = kLinePlots; } @@ -32,7 +32,7 @@ -(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); @@ -44,9 +44,9 @@ -(void)generateData } } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -102,7 +102,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP #pragma mark - #pragma mark CPTScatterPlotDelegate Methods --(void)plot:(CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)index +-(void)Plot:(nonnull CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"Data label for '%@' was selected at index %d.", plot.identifier, (int)index); } @@ -110,12 +110,12 @@ -(void)plot:(CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)index #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); NSNumber *num = self.plotData[index][key]; diff --git a/examples/CorePlotGallery/src/plots/VerticalBarChart.h b/examples/CorePlotGallery/src/plots/VerticalBarChart.h index 9d4634483..7f09fff01 100644 --- a/examples/CorePlotGallery/src/plots/VerticalBarChart.h +++ b/examples/CorePlotGallery/src/plots/VerticalBarChart.h @@ -1,6 +1,6 @@ // -// SimpleBarGraph.h -// CorePlotGallery +// SimpleBarGraph.h +// CorePlotGallery // #import "PlotItem.h" diff --git a/examples/CorePlotGallery/src/plots/VerticalBarChart.m b/examples/CorePlotGallery/src/plots/VerticalBarChart.m index ac6cb517f..2236f441f 100644 --- a/examples/CorePlotGallery/src/plots/VerticalBarChart.m +++ b/examples/CorePlotGallery/src/plots/VerticalBarChart.m @@ -1,6 +1,6 @@ // -// SimpleBarGraph.m -// CorePlotGallery +// SimpleBarGraph.m +// CorePlotGallery // #import "VerticalBarChart.h" @@ -9,7 +9,8 @@ @interface VerticalBarChart() -@property (nonatomic, readwrite, strong) CPTPlotSpaceAnnotation *symbolTextAnnotation; +@property (nonatomic, readwrite, strong, nullable) CPTPlotSpaceAnnotation *symbolTextAnnotation; + @end @implementation VerticalBarChart @@ -21,9 +22,9 @@ +(void)load [super registerPlotItem:self]; } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.title = @"Vertical Bar Chart"; self.section = kBarPlots; } @@ -33,7 +34,7 @@ -(instancetype)init -(void)killGraph { - if ( [self.graphs count] ) { + if ( self.graphs.count ) { CPTGraph *graph = (self.graphs)[0]; CPTPlotSpaceAnnotation *annotation = self.symbolTextAnnotation; @@ -50,9 +51,9 @@ -(void)generateData { } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL __unused)animated { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGRect bounds = hostingView.bounds; #else CGRect bounds = NSRectToCGRect(hostingView.bounds); @@ -130,7 +131,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP { y.majorIntervalLength = (kUseHorizontalBars ? @1.0 : @10.0); y.minorTicksPerInterval = (kUseHorizontalBars ? 0 : 9); - y.orthogonalPosition = ( kUseHorizontalBars ? @0.0 : @(-0.5) ); + y.orthogonalPosition = (kUseHorizontalBars ? @0.0 : @(-0.5)); y.preferredNumberOfMajorTicks = 8; y.majorGridLineStyle = majorGridLineStyle; @@ -211,7 +212,7 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP theLegend.fill = [CPTFill fillWithColor:[CPTColor colorWithGenericGray:CPTFloat(0.15)]]; theLegend.borderLineStyle = barLineStyle; theLegend.cornerRadius = textSize * CPTFloat(0.25); - theLegend.swatchSize = CGSizeMake( textSize * CPTFloat(0.75), textSize * CPTFloat(0.75) ); + theLegend.swatchSize = CGSizeMake(textSize * CPTFloat(0.75), textSize * CPTFloat(0.75)); whiteTextStyle.fontSize = textSize * CPTFloat(0.5); theLegend.textStyle = whiteTextStyle; theLegend.rowMargin = textSize * CPTFloat(0.25); @@ -221,12 +222,12 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP theLegend.paddingRight = textSize * CPTFloat(0.375); theLegend.paddingBottom = textSize * CPTFloat(0.375); - CPTNumberArray plotPoint = (kUseHorizontalBars ? @[@95, @0] : @[@0, @95]); + CPTNumberArray *plotPoint = (kUseHorizontalBars ? @[@95, @0] : @[@0, @95]); CPTPlotSpaceAnnotation *legendAnnotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:barPlotSpace anchorPlotPoint:plotPoint]; legendAnnotation.contentLayer = theLegend; - legendAnnotation.contentAnchorPoint = ( kUseHorizontalBars ? CGPointMake(1.0, 0.0) : CGPointMake(0.0, 1.0) ); + legendAnnotation.contentAnchorPoint = (kUseHorizontalBars ? CGPointMake(1.0, 0.0) : CGPointMake(0.0, 1.0)); [graph.plotAreaFrame.plotArea addAnnotation:legendAnnotation]; } @@ -234,16 +235,16 @@ -(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CP #pragma mark - #pragma mark CPTBarPlot delegate methods --(void)plot:(CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)index +-(void)Plot:(nonnull CPTPlot *)plot dataLabelWasSelectedAtRecordIndex:(NSUInteger)index { NSLog(@"Data label for '%@' was selected at index %d.", plot.identifier, (int)index); } --(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index +-(void)barPlot:(nonnull CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index { NSNumber *value = [self numberForPlot:plot field:CPTBarPlotFieldBarTip recordIndex:index]; - NSLog(@"Bar for '%@' was selected at index %d. Value = %f", plot.identifier, (int)index, [value floatValue]); + NSLog(@"Bar for '%@' was selected at index %d. Value = %f", plot.identifier, (int)index, value.doubleValue); CPTGraph *graph = (self.graphs)[0]; @@ -263,12 +264,12 @@ -(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index NSNumber *x = @(index); NSNumber *y = @2; - CPTNumberArray anchorPoint = (kUseHorizontalBars ? @[y, x] : @[x, y]); + CPTNumberArray *anchorPoint = (kUseHorizontalBars ? @[y, x] : @[x, y]); // Add annotation // First make a string for the y value NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init]; - [formatter setMaximumFractionDigits:2]; + formatter.maximumFractionDigits = 2; NSString *yString = [formatter stringFromNumber:value]; // Now add the annotation to the plot area @@ -287,12 +288,12 @@ -(void)barPlot:(CPTBarPlot *)plot barWasSelectedAtRecordIndex:(NSUInteger)index #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return 10; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { id num = nil; @@ -306,7 +307,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI num = @(index); } else { - num = @( (index + 1) * (index + 1) ); + num = @((index + 1) * (index + 1)); } } else { diff --git a/examples/CorePlotGallery/src/shared/PiNumberFormatter.m b/examples/CorePlotGallery/src/shared/PiNumberFormatter.m index dc8aa6f7b..8b1f1fdfb 100644 --- a/examples/CorePlotGallery/src/shared/PiNumberFormatter.m +++ b/examples/CorePlotGallery/src/shared/PiNumberFormatter.m @@ -2,6 +2,8 @@ double gcd(double a, double b); +#pragma mark - + /** @brief A number formatter that converts numbers to multiples of π. **/ @implementation PiNumberFormatter @@ -17,12 +19,12 @@ @implementation PiNumberFormatter * @param coordinateValue The numeric value. * @return The formatted string. **/ --(NSString *)stringForObjectValue:(id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSString *string = nil; if ( [coordinateValue respondsToSelector:@selector(doubleValue)] ) { - double value = [(NSNumber *)coordinateValue doubleValue] / M_PI; + double value = ((NSNumber *)coordinateValue).doubleValue / M_PI; double factor = round(self.multiplier.doubleValue); if ( factor == 0.0 ) { @@ -32,19 +34,19 @@ -(NSString *)stringForObjectValue:(id)coordinateValue double numerator = round(value * factor); double denominator = factor; double fraction = numerator / denominator; - double divisor = ABS( gcd(numerator, denominator) ); + double divisor = ABS(gcd(numerator, denominator)); if ( fraction == 0.0 ) { string = @"0"; } else if ( ABS(fraction) == 1.0 ) { - string = [NSString stringWithFormat:@"%@π", signbit(fraction) ? self.minusSign:@""]; + string = [NSString stringWithFormat:@"%@π", signbit(fraction) ? self.minusSign : @""]; } else if ( ABS(numerator) == 1.0 ) { - string = [NSString stringWithFormat:@"%@π/%g", signbit(numerator) ? self.minusSign:@"", denominator]; + string = [NSString stringWithFormat:@"%@π/%g", signbit(numerator) ? self.minusSign : @"", denominator]; } else if ( ABS(numerator / divisor) == 1.0 ) { - string = [NSString stringWithFormat:@"%@π/%g", signbit(numerator) ? self.minusSign:@"", denominator / divisor]; + string = [NSString stringWithFormat:@"%@π/%g", signbit(numerator) ? self.minusSign : @"", denominator / divisor]; } else if ( round(fraction) == fraction ) { string = [NSString stringWithFormat:@"%g π", fraction]; @@ -70,7 +72,7 @@ -(NSString *)stringForObjectValue:(id)coordinateValue while ( a != 0.0 ) { c = a; - a = round( fmod(b, a) ); + a = round(fmod(b, a)); b = c; } diff --git a/examples/CorePlotGallery/src/shared/PlotGallery.h b/examples/CorePlotGallery/src/shared/PlotGallery.h index fb70203f1..0c6e22f2f 100644 --- a/examples/CorePlotGallery/src/shared/PlotGallery.h +++ b/examples/CorePlotGallery/src/shared/PlotGallery.h @@ -1,23 +1,23 @@ // -// PlotGallery.h -// CorePlotGallery +// PlotGallery.h +// CorePlotGallery // #import "PlotItem.h" -@interface PlotGallery : NSObject +@interface PlotGallery : NSObject @property (nonatomic, readonly) NSUInteger count; @property (nonatomic, readonly) NSUInteger numberOfSections; -@property (nonatomic, readonly, strong) CPTStringArray sectionTitles; +@property (nonatomic, readonly, strong, nonnull) CPTStringArray *sectionTitles; -+(PlotGallery *)sharedPlotGallery; ++(nonnull PlotGallery *)sharedPlotGallery; --(void)addPlotItem:(PlotItem *)plotItem; +-(void)addPlotItem:(nonnull PlotItem *)plotItem; -(void)sortByTitle; --(PlotItem *)objectInSection:(NSUInteger)section atIndex:(NSUInteger)index; +-(nonnull PlotItem *)objectInSection:(NSUInteger)section atIndex:(NSUInteger)index; -(NSUInteger)numberOfRowsInSection:(NSUInteger)section; @end diff --git a/examples/CorePlotGallery/src/shared/PlotGallery.m b/examples/CorePlotGallery/src/shared/PlotGallery.m index bdf1addb5..fc40ffe5a 100644 --- a/examples/CorePlotGallery/src/shared/PlotGallery.m +++ b/examples/CorePlotGallery/src/shared/PlotGallery.m @@ -1,6 +1,6 @@ // -// PlotGallery.m -// CorePlotGallery +// PlotGallery.m +// CorePlotGallery // #import "PlotGallery.h" @@ -12,6 +12,8 @@ @interface PlotGallery() @end +#pragma mark - + @implementation PlotGallery @synthesize plotItems; @@ -19,10 +21,9 @@ @implementation PlotGallery static PlotGallery *sharedPlotGallery = nil; -+(PlotGallery *)sharedPlotGallery ++(nonnull PlotGallery *)sharedPlotGallery { - @synchronized(self) - { + @synchronized ( self ) { if ( sharedPlotGallery == nil ) { sharedPlotGallery = [[self alloc] init]; } @@ -32,8 +33,7 @@ +(PlotGallery *)sharedPlotGallery +(id)allocWithZone:(NSZone *)zone { - @synchronized(self) - { + @synchronized ( self ) { if ( sharedPlotGallery == nil ) { return [super allocWithZone:zone]; } @@ -41,14 +41,13 @@ +(id)allocWithZone:(NSZone *)zone return sharedPlotGallery; } --(instancetype)init +-(nonnull instancetype)init { Class thisClass = [self class]; - @synchronized(thisClass) - { + @synchronized ( thisClass ) { if ( sharedPlotGallery == nil ) { - if ( (self = [super init]) ) { + if ((self = [super init])) { sharedPlotGallery = self; plotItems = [[NSMutableArray alloc] init]; plotSections = [[NSCountedSet alloc] init]; @@ -59,12 +58,12 @@ -(instancetype)init return sharedPlotGallery; } --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *__unused)zone { return self; } --(void)addPlotItem:(PlotItem *)plotItem +-(void)addPlotItem:(nonnull PlotItem *)plotItem { [self.plotItems addObject:plotItem]; @@ -89,7 +88,7 @@ -(NSUInteger)numberOfRowsInSection:(NSUInteger)section return [self.plotSections countForObject:self.sectionTitles[section]]; } --(PlotItem *)objectInSection:(NSUInteger)section atIndex:(NSUInteger)index +-(nonnull PlotItem *)objectInSection:(NSUInteger)section atIndex:(NSUInteger)index { NSUInteger offset = 0; @@ -105,9 +104,9 @@ -(void)sortByTitle [self.plotItems sortUsingSelector:@selector(titleCompare:)]; } --(CPTStringArray)sectionTitles +-(CPTStringArray *)sectionTitles { - return [[self.plotSections allObjects] sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; + return [self.plotSections.allObjects sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)]; } @end diff --git a/examples/CorePlotGallery/src/shared/PlotItem.h b/examples/CorePlotGallery/src/shared/PlotItem.h index 43ad4f566..eefd5e40d 100644 --- a/examples/CorePlotGallery/src/shared/PlotItem.h +++ b/examples/CorePlotGallery/src/shared/PlotItem.h @@ -1,13 +1,13 @@ // -// PlotItem.h -// CorePlotGallery +// PlotItem.h +// CorePlotGallery // #import #import -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #import typedef CGRect CGNSRect; @@ -19,47 +19,47 @@ typedef NSRect CGNSRect; typedef NSView PlotGalleryNativeView; #endif -extern NSString *const kDemoPlots; -extern NSString *const kPieCharts; -extern NSString *const kLinePlots; -extern NSString *const kBarPlots; -extern NSString *const kFinancialPlots; +extern NSString *__nonnull const kDemoPlots; +extern NSString *__nonnull const kPieCharts; +extern NSString *__nonnull const kLinePlots; +extern NSString *__nonnull const kBarPlots; +extern NSString *__nonnull const kFinancialPlots; @class CPTGraph; @class CPTTheme; @interface PlotItem : NSObject -@property (nonatomic, readwrite, strong) CPTGraphHostingView *defaultLayerHostingView; +@property (nonatomic, readwrite, strong, nullable) CPTGraphHostingView *defaultLayerHostingView; -@property (nonatomic, readwrite, strong) NSMutableArray<__kindof CPTGraph *> *graphs; -@property (nonatomic, readwrite, strong) NSString *section; -@property (nonatomic, readwrite, strong) NSString *title; +@property (nonatomic, readwrite, strong, nonnull) NSMutableArray<__kindof CPTGraph *> *graphs; +@property (nonatomic, readwrite, strong, nonnull) NSString *section; +@property (nonatomic, readwrite, strong, nonnull) NSString *title; @property (nonatomic, readonly) CGFloat titleSize; -+(void)registerPlotItem:(id)item; ++(void)registerPlotItem:(nonnull id)item; --(void)renderInView:(PlotGalleryNativeView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated; --(CPTNativeImage *)image; +-(void)renderInView:(nonnull PlotGalleryNativeView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated; +-(nonnull CPTNativeImage *)image; #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE #else -(void)setFrameSize:(NSSize)size; #endif --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated; +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *)hostingView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated; -(void)formatAllGraphs; -(void)reloadData; --(void)applyTheme:(CPTTheme *)theme toGraph:(CPTGraph *)graph withDefault:(CPTTheme *)defaultTheme; +-(void)applyTheme:(nullable CPTTheme *)theme toGraph:(nonnull CPTGraph *)graph withDefault:(nullable CPTTheme *)defaultTheme; --(void)addGraph:(CPTGraph *)graph; --(void)addGraph:(CPTGraph *)graph toHostingView:(CPTGraphHostingView *)hostingView; +-(void)addGraph:(nonnull CPTGraph *)graph; +-(void)addGraph:(nonnull CPTGraph *)graph toHostingView:(nullable CPTGraphHostingView *)hostingView; -(void)killGraph; -(void)generateData; --(NSComparisonResult)titleCompare:(PlotItem *)other; +-(NSComparisonResult)titleCompare:(nonnull PlotItem *)other; @end diff --git a/examples/CorePlotGallery/src/shared/PlotItem.m b/examples/CorePlotGallery/src/shared/PlotItem.m index 15254b415..08bc060b7 100644 --- a/examples/CorePlotGallery/src/shared/PlotItem.m +++ b/examples/CorePlotGallery/src/shared/PlotItem.m @@ -1,15 +1,15 @@ // -// PlotItem.m -// CorePlotGallery +// PlotItem.m +// CorePlotGallery // #import "PlotGallery.h" #import -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else -// For IKImageBrowser +// For NSCollectionView #import #endif @@ -36,7 +36,7 @@ @implementation PlotItem @synthesize cachedImage; @dynamic titleSize; -+(void)registerPlotItem:(id)item ++(void)registerPlotItem:(nonnull id)item { NSLog(@"registerPlotItem for class %@", [item class]); @@ -51,20 +51,20 @@ +(void)registerPlotItem:(id)item } } --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { defaultLayerHostingView = nil; graphs = [[NSMutableArray alloc] init]; - section = nil; - title = nil; + section = @""; + title = @""; } return self; } --(void)addGraph:(CPTGraph *)graph toHostingView:(CPTGraphHostingView *)hostingView +-(void)addGraph:(nonnull CPTGraph *)graph toHostingView:(nullable CPTGraphHostingView *)hostingView { [self.graphs addObject:graph]; @@ -73,7 +73,7 @@ -(void)addGraph:(CPTGraph *)graph toHostingView:(CPTGraphHostingView *)hostingVi } } --(void)addGraph:(CPTGraph *)graph +-(void)addGraph:(nonnull CPTGraph *)graph { [self addGraph:graph toHostingView:nil]; } @@ -106,7 +106,7 @@ -(void)generateData { } --(NSComparisonResult)titleCompare:(PlotItem *)other +-(NSComparisonResult)titleCompare:(nonnull PlotItem *)other { NSComparisonResult comparisonResult = [self.section caseInsensitiveCompare:other.section]; @@ -121,8 +121,10 @@ -(CGFloat)titleSize { CGFloat size; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE - switch ( UI_USER_INTERFACE_IDIOM() ) { +#if TARGET_OS_TV + size = 36.0; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + switch ( UI_USER_INTERFACE_IDIOM()) { case UIUserInterfaceIdiomPad: size = 24.0; break; @@ -142,13 +144,13 @@ -(CGFloat)titleSize return size; } --(void)setPaddingDefaultsForGraph:(CPTGraph *)graph +-(void)setPaddingDefaultsForGraph:(nonnull CPTGraph *)graph { CGFloat boundsPadding = self.titleSize; graph.paddingLeft = boundsPadding; - if ( graph.titleDisplacement.y > 0.0 ) { + if ( graph.titleDisplacement.y > CPTFloat(0.0)) { graph.paddingTop = graph.titleTextStyle.fontSize * CPTFloat(2.0); } else { @@ -172,7 +174,7 @@ -(void)formatAllGraphs graph.title = (self.graphs.count == 1 ? self.title : nil); graph.titleTextStyle = textStyle; - graph.titleDisplacement = CPTPointMake( 0.0, textStyle.fontSize * CPTFloat(1.5) ); + graph.titleDisplacement = CPTPointMake(0.0, textStyle.fontSize * CPTFloat(1.5)); graph.titlePlotAreaFrameAnchor = CPTRectAnchorTop; // Padding @@ -226,7 +228,7 @@ -(void)formatAllGraphs textStyle.fontSize = labelSize; theLegend.textStyle = textStyle; - theLegend.swatchSize = CGSizeMake( labelSize * CPTFloat(1.5), labelSize * CPTFloat(1.5) ); + theLegend.swatchSize = CGSizeMake(labelSize * CPTFloat(1.5), labelSize * CPTFloat(1.5)); theLegend.rowMargin = labelSize * CPTFloat(0.75); theLegend.columnMargin = labelSize * CPTFloat(0.75); @@ -238,9 +240,9 @@ -(void)formatAllGraphs } } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE --(UIImage *)image +-(nonnull CPTNativeImage *)image { if ( self.cachedImage == nil ) { CGRect imageFrame = CGRectMake(0, 0, 400, 300); @@ -285,7 +287,7 @@ -(UIImage *)image #else // OSX --(NSImage *)image +-(nonnull CPTNativeImage *)image { if ( self.cachedImage == nil ) { CGRect imageFrame = CGRectMake(0, 0, 400, 300); @@ -297,26 +299,9 @@ -(NSImage *)image CGSize boundsSize = imageFrame.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]; - - NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; - CGContextRef context = (CGContextRef)[bitmapContext graphicsPort]; - - CGContextClearRect( context, CGRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); - CGContextSetAllowsAntialiasing(context, true); - CGContextSetShouldSmoothFonts(context, false); - [imageView.layer renderInContext:context]; - CGContextFlush(context); + NSBitmapImageRep *layerImage = [imageView bitmapImageRepForCachingDisplayInRect:imageFrame]; + layerImage.size = boundsSize; + [imageView cacheDisplayInRect:imageFrame toBitmapImageRep:layerImage]; self.cachedImage = [[NSImage alloc] initWithSize:NSSizeFromCGSize(boundsSize)]; [self.cachedImage addRepresentation:layerImage]; @@ -324,9 +309,10 @@ -(NSImage *)image return self.cachedImage; } + #endif --(void)applyTheme:(CPTTheme *)theme toGraph:(CPTGraph *)graph withDefault:(CPTTheme *)defaultTheme +-(void)applyTheme:(nullable CPTTheme *)theme toGraph:(nonnull CPTGraph *)graph withDefault:(nullable CPTTheme *)defaultTheme { if ( theme == nil ) { [graph applyTheme:defaultTheme]; @@ -336,14 +322,15 @@ -(void)applyTheme:(CPTTheme *)theme toGraph:(CPTGraph *)graph withDefault:(CPTTh } } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else --(void)setFrameSize:(NSSize)size +-(void)setFrameSize:(NSSize __unused)size { } + #endif --(void)renderInView:(PlotGalleryNativeView *)inView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInView:(nonnull PlotGalleryNativeView *)inView withTheme:(nullable CPTTheme *)theme animated:(BOOL)animated { [self killGraph]; @@ -351,7 +338,7 @@ -(void)renderInView:(PlotGalleryNativeView *)inView withTheme:(CPTTheme *)theme [inView addSubview:hostingView]; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE hostingView.translatesAutoresizingMaskIntoConstraints = NO; [inView addConstraint:[NSLayoutConstraint constraintWithItem:hostingView attribute:NSLayoutAttributeLeft @@ -382,7 +369,7 @@ -(void)renderInView:(PlotGalleryNativeView *)inView withTheme:(CPTTheme *)theme multiplier:1.0 constant:0.0]]; #else - [hostingView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; + hostingView.autoresizingMask = NSViewWidthSizable | NSViewHeightSizable; [hostingView setAutoresizesSubviews:YES]; #endif @@ -394,7 +381,7 @@ -(void)renderInView:(PlotGalleryNativeView *)inView withTheme:(CPTTheme *)theme self.defaultLayerHostingView = hostingView; } --(void)renderInGraphHostingView:(CPTGraphHostingView *)hostingView withTheme:(CPTTheme *)theme animated:(BOOL)animated +-(void)renderInGraphHostingView:(nonnull CPTGraphHostingView *__unused)hostingView withTheme:(nullable CPTTheme *__unused)theme animated:(BOOL __unused)animated { NSLog(@"PlotItem:renderInLayer: Override me"); } @@ -409,7 +396,7 @@ -(void)reloadData #pragma mark - #pragma mark IKImageBrowserItem methods -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else -(NSString *)imageUID @@ -431,6 +418,7 @@ -(NSString *)imageTitle { return self.title; } + #endif @end diff --git a/examples/CorePlotGallery/src/tvOS/AppDelegateTV.h b/examples/CorePlotGallery/src/tvOS/AppDelegateTV.h new file mode 100644 index 000000000..45bd5ecd6 --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/AppDelegateTV.h @@ -0,0 +1,7 @@ +#import + +@interface AppDelegateTV : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@end diff --git a/examples/CorePlotGallery/src/tvOS/AppDelegateTV.m b/examples/CorePlotGallery/src/tvOS/AppDelegateTV.m new file mode 100644 index 000000000..25c2be344 --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/AppDelegateTV.m @@ -0,0 +1,16 @@ +#import "AppDelegateTV.h" + +#import "PlotGallery.h" + +@implementation AppDelegateTV + +@synthesize window; + +-(BOOL)application:(UIApplication *__unused)application didFinishLaunchingWithOptions:(NSDictionary *__unused)launchOptions +{ + [[PlotGallery sharedPlotGallery] sortByTitle]; + + return YES; +} + +@end diff --git a/examples/CorePlotGallery/src/tvOS/Base.lproj/Main.storyboard b/examples/CorePlotGallery/src/tvOS/Base.lproj/Main.storyboard new file mode 100644 index 000000000..6c7f86385 --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/Base.lproj/Main.storyboard @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.h b/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.h new file mode 100644 index 000000000..46e67160d --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.h @@ -0,0 +1,17 @@ +// +// DetailViewControllerTV.h +// CorePlotGallery +// + +@class PlotItem; + +@interface DetailViewControllerTV : UIViewController + +@property (nonatomic, strong) PlotItem *detailItem; +@property (nonatomic, copy) NSString *currentThemeName; + +@property (nonatomic, strong) IBOutlet UIView *hostingView; + +-(void)themeSelectedWithName:(NSString *)themeName; + +@end diff --git a/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m b/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m new file mode 100644 index 000000000..7cc1f5d52 --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/DetailViewControllerTV.m @@ -0,0 +1,122 @@ +// +// DetailViewControllerTV +// CorePlotGallery +// + +#import "DetailViewControllerTV.h" + +#import "PlotItem.h" +#import "ThemeTableViewControllerTV.h" + +@interface DetailViewControllerTV() + +-(CPTTheme *)currentTheme; + +-(void)setupView; +-(void)themeChanged:(NSNotification *)notification; + +@end + +#pragma mark - + +@implementation DetailViewControllerTV + +@synthesize detailItem; +@synthesize hostingView; +@synthesize currentThemeName; + +#pragma mark - +#pragma mark Initialization and Memory Management + +-(void)setupView +{ + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(themeChanged:) + name:PlotGalleryThemeDidChangeNotification + object:nil]; + + [self.detailItem renderInView:self.hostingView withTheme:[self currentTheme] animated:YES]; +} + +-(void)awakeFromNib +{ + [super awakeFromNib]; + + [self setupView]; +} + +-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { + [self setupView]; + } + + return self; +} + +-(void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark - +#pragma mark Managing the detail item + +-(void)setDetailItem:(PlotItem *)newDetailItem +{ + if ( detailItem != newDetailItem ) { + [detailItem killGraph]; + + detailItem = newDetailItem; + + if ( self.hostingView ) { + [detailItem renderInView:self.hostingView withTheme:[self currentTheme] animated:YES]; + } + } +} + +#pragma mark - +#pragma mark View lifecycle + +-(void)viewDidAppear:(BOOL)animated +{ + [super viewDidAppear:animated]; + + [self setupView]; +} + +#pragma mark - +#pragma mark Theme Selection + +-(CPTTheme *)currentTheme +{ + CPTTheme *theme; + + if ( [self.currentThemeName isEqualToString:kThemeTableViewControllerNoTheme] ) { + theme = (id)[NSNull null]; + } + else if ( [self.currentThemeName isEqualToString:kThemeTableViewControllerDefaultTheme] ) { + theme = nil; + } + else { + theme = [CPTTheme themeNamed:self.currentThemeName]; + } + + return theme; +} + +-(void)themeSelectedWithName:(NSString *)themeName +{ + self.currentThemeName = themeName; + + [self.detailItem renderInView:self.hostingView withTheme:[self currentTheme] animated:YES]; +} + +-(void)themeChanged:(NSNotification *)notification +{ + NSDictionary *themeInfo = notification.userInfo; + + [self themeSelectedWithName:themeInfo[PlotGalleryThemeNameKey]]; +} + +@end diff --git a/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.h b/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.h new file mode 100644 index 000000000..db15ca7f8 --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.h @@ -0,0 +1,10 @@ +// +// RootViewControllerTV.h +// CorePlotGallery +// + +@interface RootViewControllerTV : UITableViewController + +@property (nonatomic, strong) IBOutlet UIBarButtonItem *themeBarButton; + +@end diff --git a/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.m b/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.m new file mode 100644 index 000000000..0e114aef2 --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/RootViewControllerTV.m @@ -0,0 +1,125 @@ +// +// RootViewControllerTV.m +// CorePlotGallery +// + +#import "RootViewControllerTV.h" + +#import "DetailViewControllerTV.h" +#import "ThemeTableViewControllerTV.h" + +#import "PlotGallery.h" +#import "PlotItem.h" + +@interface RootViewControllerTV() + +@property (nonatomic, copy) NSString *currentThemeName; + +-(void)themeChanged:(NSNotification *)notification; + +@end + +#pragma mark - + +@implementation RootViewControllerTV + +@synthesize themeBarButton; +@synthesize currentThemeName; + +-(void)viewDidLoad +{ + [super viewDidLoad]; + + self.clearsSelectionOnViewWillAppear = NO; + + self.currentThemeName = kThemeTableViewControllerDefaultTheme; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(themeChanged:) + name:PlotGalleryThemeDidChangeNotification + object:nil]; +} + +-(void)dealloc +{ + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark - +#pragma mark Segues + +-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id __unused)sender +{ + if ( [segue.identifier isEqualToString:@"showDetail"] ) { + DetailViewControllerTV *controller = (DetailViewControllerTV *)segue.destinationViewController; + + controller.navigationItem.leftBarButtonItem = self.splitViewController.displayModeButtonItem; + + controller.currentThemeName = self.currentThemeName; + + NSIndexPath *indexPath = self.tableView.indexPathForSelectedRow; + + PlotItem *plotItem = [[PlotGallery sharedPlotGallery] objectInSection:[indexPath indexAtPosition:0] + atIndex:[indexPath indexAtPosition:1]]; + + controller.detailItem = plotItem; + } +} + +#pragma mark - +#pragma mark Theme Selection + +-(void)setCurrentThemeName:(NSString *)newThemeName +{ + if ( newThemeName != currentThemeName ) { + currentThemeName = [newThemeName copy]; + + self.themeBarButton.title = newThemeName; + } +} + +-(void)themeChanged:(NSNotification *)notification +{ + NSDictionary *themeInfo = notification.userInfo; + + self.currentThemeName = themeInfo[PlotGalleryThemeNameKey]; +} + +#pragma mark - +#pragma mark Table view data source + +-(NSInteger)numberOfSectionsInTableView:(UITableView *__unused)tv +{ + return (NSInteger)[PlotGallery sharedPlotGallery].numberOfSections; +} + +-(NSInteger)tableView:(UITableView *__unused)tv numberOfRowsInSection:(NSInteger)section +{ + return (NSInteger)[[PlotGallery sharedPlotGallery] numberOfRowsInSection:(NSUInteger)section]; +} + +-(UITableViewCell *)tableView:(UITableView *)tv cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *cellId = @"PlotCell"; + + UITableViewCell *cell = [tv dequeueReusableCellWithIdentifier:cellId]; + + if ( cell == nil ) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellId]; + cell.accessoryType = UITableViewCellAccessoryNone; + } + + PlotItem *plotItem = [[PlotGallery sharedPlotGallery] objectInSection:[indexPath indexAtPosition:0] + atIndex:[indexPath indexAtPosition:1]]; + cell.imageView.image = [plotItem image]; + cell.textLabel.text = plotItem.title; + + return cell; +} + +-(NSString *)tableView:(UITableView *__unused)tableView titleForHeaderInSection:(NSInteger)section +{ + return [PlotGallery sharedPlotGallery].sectionTitles[(NSUInteger)section]; +} + +@end diff --git a/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.h b/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.h new file mode 100644 index 000000000..db53d1f17 --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.h @@ -0,0 +1,16 @@ +// +// ThemeTableViewControllerTV.h +// CorePlotGallery +// + +extern NSString *const kThemeTableViewControllerNoTheme; +extern NSString *const kThemeTableViewControllerDefaultTheme; + +extern NSString *const PlotGalleryThemeDidChangeNotification; +extern NSString *const PlotGalleryThemeNameKey; + +#pragma mark - + +@interface ThemeTableViewControllerTV : UITableViewController + +@end diff --git a/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m b/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m new file mode 100644 index 000000000..fb6aac50e --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/ThemeTableViewControllerTV.m @@ -0,0 +1,102 @@ +// +// ThemeTableViewControllerTV.m +// CorePlotGallery +// + +#import "ThemeTableViewControllerTV.h" + +#import + +NSString *const kThemeTableViewControllerNoTheme = @"None"; +NSString *const kThemeTableViewControllerDefaultTheme = @"Default"; + +NSString *const PlotGalleryThemeDidChangeNotification = @"PlotGalleryThemeDidChangeNotification"; +NSString *const PlotGalleryThemeNameKey = @"PlotGalleryThemeNameKey"; + +@interface ThemeTableViewControllerTV() + +@property (nonatomic, readwrite, strong) CPTMutableStringArray *themes; + +@end + +#pragma mark - + +@implementation ThemeTableViewControllerTV + +@synthesize themes; + +-(void)setupThemes +{ + CPTMutableStringArray *themeList = [[NSMutableArray alloc] init]; + + [themeList addObject:kThemeTableViewControllerDefaultTheme]; + [themeList addObject:kThemeTableViewControllerNoTheme]; + + for ( Class themeClass in [CPTTheme themeClasses] ) { + [themeList addObject:[themeClass name]]; + } + + self.themes = themeList; +} + +-(void)awakeFromNib +{ + [super awakeFromNib]; + + [self setupThemes]; +} + +-(instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) { + [self setupThemes]; + } + + return self; +} + +#pragma mark - +#pragma mark Table view data source + +-(NSInteger)numberOfSectionsInTableView:(UITableView *__unused)tableView +{ + return 1; +} + +-(NSInteger)tableView:(UITableView *__unused)tableView numberOfRowsInSection:(NSInteger __unused)section +{ + return (NSInteger)self.themes.count; +} + +-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString *CellIdentifier = @"ThemeCell"; + + UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; + + if ( cell == nil ) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; + } + + cell.textLabel.text = self.themes[(NSUInteger)indexPath.row]; + + return cell; +} + +#pragma mark - +#pragma mark Table view delegate + +-(void)tableView:(UITableView *__unused)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath +{ + NSDictionary *themeInfo = @{ + PlotGalleryThemeNameKey: self.themes[(NSUInteger)indexPath.row] + }; + + [[NSNotificationCenter defaultCenter] postNotificationName:PlotGalleryThemeDidChangeNotification + object:self + userInfo:themeInfo]; + + [self dismissViewControllerAnimated:YES completion:nil]; +} + +@end diff --git a/examples/CorePlotGallery/src/tvOS/main.m b/examples/CorePlotGallery/src/tvOS/main.m new file mode 100644 index 000000000..3bc32fa82 --- /dev/null +++ b/examples/CorePlotGallery/src/tvOS/main.m @@ -0,0 +1,9 @@ +#import "AppDelegateTV.h" +#import + +int main(int argc, char *argv[]) +{ + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegateTV class])); + } +} diff --git a/examples/DatePlot/DatePlot.xib b/examples/DatePlot/Base.lproj/DatePlot.xib similarity index 100% rename from examples/DatePlot/DatePlot.xib rename to examples/DatePlot/Base.lproj/DatePlot.xib diff --git a/examples/DatePlot/Info.plist b/examples/DatePlot/Base.lproj/Info.plist similarity index 100% rename from examples/DatePlot/Info.plist rename to examples/DatePlot/Base.lproj/Info.plist diff --git a/examples/DatePlot/DatePlot-Bridging-Header.h b/examples/DatePlot/DatePlot-Bridging-Header.h deleted file mode 100644 index cde174e4f..000000000 --- a/examples/DatePlot/DatePlot-Bridging-Header.h +++ /dev/null @@ -1 +0,0 @@ -#import diff --git a/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj b/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj index 704f45dc6..21d005158 100644 --- a/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj +++ b/examples/DatePlot/DatePlot.xcodeproj/project.pbxproj @@ -11,10 +11,10 @@ 0761850B0F3CB1E800A89A76 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 076184C10F3CAD5900A89A76 /* CorePlot.framework */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 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 */; }; + C3D0A1A720E0183A00BA2921 /* DatePlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1A920E0183A00BA2921 /* DatePlot.xib */; }; C3D3937419FD6E3500148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3937319FD6E3500148319 /* Images.xcassets */; }; /* End PBXBuildFile section */ @@ -40,6 +40,20 @@ remoteGlobalIDString = 0730F600109492D800E95162; remoteInfo = UnitTests; }; + C310CE5B1C0A3DB500C4FCB4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C310CE5D1C0A3DB500C4FCB4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3F04DB71B44CCFD0002322A /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; @@ -88,19 +102,18 @@ 071BCBD61079EBE00045E43D /* CorePlot.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = SOURCE_ROOT; }; 0761854B0F3CB3CB00A89A76 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CorePlot.framework; path = ../../../../framework/build/Debug/CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 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 = ""; }; - C3A1443E197DE35F0048F1FF /* DatePlot-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "DatePlot-Bridging-Header.h"; sourceTree = ""; }; + C33E19A7198330CA00182AF2 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = Source/AppDelegate.swift; sourceTree = ""; }; + C37A409820E030B500C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; + C385066522A9CC740086BAD5 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; 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 = ""; }; + C3D0A1B620E0184100BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/DatePlot.xib; sourceTree = ""; }; C3D3937319FD6E3500148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = DatePlot/Images.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -127,6 +140,8 @@ C3F04DBA1B44CCFD0002322A /* UnitTests iOS.xctest */, C3F04DBC1B44CCFD0002322A /* libCorePlot-CocoaTouch.a */, C3F04DBE1B44CCFD0002322A /* CorePlot-CocoaTouchTests.xctest */, + C310CE5C1C0A3DB500C4FCB4 /* CorePlot.framework */, + C310CE5E1C0A3DB500C4FCB4 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -134,7 +149,7 @@ 080E96DDFE201D6D7F000001 /* Classes */ = { isa = PBXGroup; children = ( - C3A1443E197DE35F0048F1FF /* DatePlot-Bridging-Header.h */, + C33E19A7198330CA00182AF2 /* AppDelegate.swift */, C3A1443F197DE35F0048F1FF /* DateController.swift */, ); name = Classes; @@ -189,8 +204,8 @@ isa = PBXGroup; children = ( C3D3937319FD6E3500148319 /* Images.xcassets */, - 90AF4F430F36CF1800753D26 /* DatePlot.xib */, - 8D1107310486CEB800E47090 /* Info.plist */, + C3D0A1A920E0183A00BA2921 /* DatePlot.xib */, + C37A409920E030B500C4FF48 /* Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, ); name = Resources; @@ -208,7 +223,6 @@ C33E19A219832EEA00182AF2 /* Other Sources */ = { isa = PBXGroup; children = ( - C33E19A7198330CA00182AF2 /* main.swift */, C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */, ); name = "Other Sources"; @@ -245,17 +259,23 @@ attributes = { BuildIndependentTargetsInParallel = NO; LastSwiftUpdateCheck = 0700; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1100; + TargetAttributes = { + 8D1107260486CEB800E47090 = { + LastSwiftMigration = 1020; + }; + }; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "DatePlot" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + de, + ja, + en, + fr, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CPTTestApp */; projectDirPath = ""; @@ -287,6 +307,20 @@ remoteRef = 07E0DF7F109C4E9500F108D2 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + C310CE5C1C0A3DB500C4FCB4 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C310CE5B1C0A3DB500C4FCB4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C310CE5E1C0A3DB500C4FCB4 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C310CE5D1C0A3DB500C4FCB4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3F04DB81B44CCFD0002322A /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -324,7 +358,7 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, C3D3937419FD6E3500148319 /* Images.xcassets in Resources */, - 90AF4F440F36CF1800753D26 /* DatePlot.xib in Resources */, + C3D0A1A720E0183A00BA2921 /* DatePlot.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -335,7 +369,7 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - C33E19A8198330CA00182AF2 /* main.swift in Sources */, + C33E19A8198330CA00182AF2 /* AppDelegate.swift in Sources */, C3A14440197DE35F0048F1FF /* DateController.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -354,11 +388,27 @@ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C165DFE840E0CC02AAC07 /* English */, + C385066522A9CC740086BAD5 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; + C37A409920E030B500C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A409820E030B500C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; + C3D0A1A920E0183A00BA2921 /* DatePlot.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1B620E0184100BA2921 /* Base */, + ); + name = DatePlot.xib; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -370,22 +420,21 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = DatePlot_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = DatePlot; - SWIFT_OBJC_BRIDGING_HEADER = "DatePlot-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; }; name = Debug; }; @@ -397,32 +446,35 @@ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = DatePlot_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; PRODUCT_NAME = DatePlot; - SWIFT_OBJC_BRIDGING_HEADER = "DatePlot-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; + SWIFT_VERSION = 5.0; }; name = Release; }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.9; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; @@ -431,12 +483,14 @@ }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C3CBBF19EA07F600A0296A /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.10; + MACOSX_DEPLOYMENT_TARGET = 10.9; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; }; diff --git a/examples/DatePlot/DatePlot.xcodeproj/xcshareddata/xcschemes/DatePlot.xcscheme b/examples/DatePlot/DatePlot.xcodeproj/xcshareddata/xcschemes/DatePlot.xcscheme new file mode 100644 index 000000000..40f98e3d8 --- /dev/null +++ b/examples/DatePlot/DatePlot.xcodeproj/xcshareddata/xcschemes/DatePlot.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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..fa77a2a96 100644 --- a/examples/DatePlot/Source/DateController.swift +++ b/examples/DatePlot/Source/DateController.swift @@ -1,8 +1,9 @@ import Foundation import Cocoa +import CorePlot class DateController : NSObject, CPTPlotDataSource { - private let oneDay : Double = 24 * 60 * 60; + private let oneDay : Double = 24 * 60 * 60 @IBOutlet var hostView : CPTGraphHostingView? = nil @@ -19,57 +20,57 @@ 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) + let theme = CPTTheme(named: .darkGradientTheme) + newGraph.apply(theme) if let host = self.hostView { - host.hostedGraph = newGraph; + host.hostedGraph = newGraph } // Setup scatter plot space let plotSpace = newGraph.defaultPlotSpace as! CPTXYPlotSpace - plotSpace.xRange = CPTPlotRange(location:0.0, length:oneDay * 5.0) - plotSpace.yRange = CPTPlotRange(location:1.0, length:3.0) + plotSpace.xRange = CPTPlotRange(location: 0.0, length: (oneDay * 5.0) as NSNumber) + 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 = oneDay as NSNumber x.orthogonalPosition = 2.0 - x.minorTicksPerInterval = 0; - let dateFormatter = NSDateFormatter() - dateFormatter.dateStyle = NSDateFormatterStyle.ShortStyle + x.minorTicksPerInterval = 0 + let dateFormatter = DateFormatter() + dateFormatter.dateStyle = .short let timeFormatter = CPTTimeFormatter(dateFormatter:dateFormatter) - timeFormatter.referenceDate = refDate; - x.labelFormatter = timeFormatter; + timeFormatter.referenceDate = refDate + x.labelFormatter = timeFormatter } if let y = axisSet.yAxis { y.majorIntervalLength = 0.5 y.minorTicksPerInterval = 5 - y.orthogonalPosition = oneDay + y.orthogonalPosition = oneDay as NSNumber - y.labelingPolicy = .None + y.labelingPolicy = .none } // Create a plot that uses the data source method - let dataSourceLinePlot = CPTScatterPlot(frame: CGRectZero) - dataSourceLinePlot.identifier = "Date Plot" + let dataSourceLinePlot = CPTScatterPlot(frame: .zero) + dataSourceLinePlot.identifier = "Date Plot" as NSString 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 +88,22 @@ 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) -> Any? { 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 + + @unknown default: + return nil } } } 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) diff --git a/examples/DatePlot/English.lproj/InfoPlist.strings b/examples/DatePlot/en.lproj/InfoPlist.strings similarity index 100% rename from examples/DatePlot/English.lproj/InfoPlist.strings rename to examples/DatePlot/en.lproj/InfoPlist.strings diff --git a/examples/DropPlot/English.lproj/CPTPlotDocument.xib b/examples/DropPlot/Base.lproj/CPTPlotDocument.xib similarity index 100% rename from examples/DropPlot/English.lproj/CPTPlotDocument.xib rename to examples/DropPlot/Base.lproj/CPTPlotDocument.xib diff --git a/examples/DropPlot/Info.plist b/examples/DropPlot/Base.lproj/Info.plist similarity index 100% rename from examples/DropPlot/Info.plist rename to examples/DropPlot/Base.lproj/Info.plist diff --git a/examples/DropPlot/English.lproj/MainMenu.xib b/examples/DropPlot/Base.lproj/MainMenu.xib similarity index 100% rename from examples/DropPlot/English.lproj/MainMenu.xib rename to examples/DropPlot/Base.lproj/MainMenu.xib diff --git a/examples/DropPlot/CPTPlotDocument.h b/examples/DropPlot/CPTPlotDocument.h index 53ca54d7a..695e3165f 100644 --- a/examples/DropPlot/CPTPlotDocument.h +++ b/examples/DropPlot/CPTPlotDocument.h @@ -7,7 +7,7 @@ -(IBAction)zoomOut; // PDF / image export --(IBAction)exportToPDF:(id)sender; --(IBAction)exportToPNG:(id)sender; +-(IBAction)exportToPDF:(nullable id)sender; +-(IBAction)exportToPNG:(nullable id)sender; @end diff --git a/examples/DropPlot/CPTPlotDocument.m b/examples/DropPlot/CPTPlotDocument.m index 96ecb9f84..537a8bdcb 100644 --- a/examples/DropPlot/CPTPlotDocument.m +++ b/examples/DropPlot/CPTPlotDocument.m @@ -3,8 +3,8 @@ @interface CPTPlotDocument() -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *graphView; -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *graphView; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *graph; @property (nonatomic, readwrite, assign) double minimumValueForXAxis; @property (nonatomic, readwrite, assign) double maximumValueForXAxis; @@ -14,7 +14,7 @@ @interface CPTPlotDocument() @property (nonatomic, readwrite, assign) double majorIntervalLengthForY; @property (nonatomic, readwrite, strong) NSArray *dataPoints; -@property (nonatomic, readwrite, strong) CPTPlotSpaceAnnotation *zoomAnnotation; +@property (nonatomic, readwrite, strong, nullable) CPTPlotSpaceAnnotation *zoomAnnotation; @property (nonatomic, readwrite, assign) CGPoint dragStart; @property (nonatomic, readwrite, assign) CGPoint dragEnd; @@ -40,9 +40,9 @@ @implementation CPTPlotDocument @synthesize dragStart; @synthesize dragEnd; -//#define USE_NSDECIMAL +// #define USE_NSDECIMAL --(instancetype)init +-(nonnull instancetype)init { self = [super init]; if ( self ) { @@ -54,12 +54,12 @@ -(instancetype)init return self; } --(NSString *)windowNibName +-(nullable NSString *)windowNibName { return @"CPTPlotDocument"; } --(void)windowControllerDidLoadNib:(NSWindowController *)windowController +-(void)windowControllerDidLoadNib:(nonnull NSWindowController *__unused)windowController { // Create graph from theme CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; @@ -90,12 +90,12 @@ -(void)windowControllerDidLoadNib:(NSWindowController *)windowController // Setup plot space CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)newGraph.defaultPlotSpace; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(self.minimumValueForXAxis) - length:@(ceil( (self.maximumValueForXAxis - self.minimumValueForXAxis) / self.majorIntervalLengthForX ) * self.majorIntervalLengthForX)]; + length:@(ceil((self.maximumValueForXAxis - self.minimumValueForXAxis) / self.majorIntervalLengthForX) * self.majorIntervalLengthForX)]; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@(self.minimumValueForYAxis) - length:@(ceil( (self.maximumValueForYAxis - self.minimumValueForYAxis) / self.majorIntervalLengthForY ) * self.majorIntervalLengthForY)]; + length:@(ceil((self.maximumValueForYAxis - self.minimumValueForYAxis) / self.majorIntervalLengthForY) * self.majorIntervalLengthForY)]; // this allows the plot to respond to mouse events - [plotSpace setDelegate:self]; + plotSpace.delegate = self; [plotSpace setAllowsUserInteraction:YES]; CPTXYAxisSet *axisSet = (CPTXYAxisSet *)newGraph.axisSet; @@ -128,7 +128,7 @@ -(void)windowControllerDidLoadNib:(NSWindowController *)windowController #pragma mark - #pragma mark Data loading methods --(NSData *)dataOfType:(NSString *)typeName error:(NSError *__autoreleasing *)outError +-(nullable NSData *)dataOfType:(nonnull NSString *__unused)typeName error:(NSError *__autoreleasing __nullable *)outError { // Insert code here to write your document to data of the specified type. If the given outError != NULL, ensure that you set *outError when returning nil. @@ -142,37 +142,37 @@ -(NSData *)dataOfType:(NSString *)typeName error:(NSError *__autoreleasing *)out return nil; } --(BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError *__autoreleasing *)outError +-(BOOL)readFromData:(nonnull NSData *)data ofType:(NSString *)typeName error:(NSError *__autoreleasing __nullable *)outError { if ( [typeName isEqualToString:@"CSVDocument"] ) { - double minX = MAXFLOAT; - double maxX = -MAXFLOAT; + double minX = (double)INFINITY; + double maxX = -(double)INFINITY; - double minY = MAXFLOAT; - double maxY = -MAXFLOAT; + double minY = (double)INFINITY; + double maxY = -(double)INFINITY; NSMutableArray *newData = [[NSMutableArray alloc] init]; 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; // Read headers from the first line of the file [fileContents getParagraphStart:&lineStart end:&lineEnd contentsEnd:&contentsEnd forRange:NSMakeRange(lineEnd, 0)]; -// currentRange = NSMakeRange(lineStart, contentsEnd - lineStart); -// CPTStringArray columnHeaders = [[fileContents substringWithRange:currentRange] arrayByParsingCSVLine]; -// NSLog([columnHeaders objectAtIndex:0]); + // currentRange = NSMakeRange(lineStart, contentsEnd - lineStart); + // CPTStringArray * columnHeaders = [[fileContents substringWithRange:currentRange] arrayByParsingCSVLine]; + // NSLog([columnHeaders objectAtIndex:0]); while ( lineEnd < length ) { [fileContents getParagraphStart:&lineStart end:&lineEnd contentsEnd:&contentsEnd forRange:NSMakeRange(lineEnd, 0)]; currentRange = NSMakeRange(lineStart, contentsEnd - lineStart); - CPTStringArray columnValues = [[fileContents substringWithRange:currentRange] arrayByParsingCSVLine]; + CPTStringArray *columnValues = [[fileContents substringWithRange:currentRange] arrayByParsingCSVLine]; - double xValue = [columnValues[0] doubleValue]; - double yValue = [columnValues[1] doubleValue]; + double xValue = columnValues[0].doubleValue; + double yValue = columnValues[1].doubleValue; if ( xValue < minX ) { minX = xValue; } @@ -201,13 +201,13 @@ -(BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError *_ double intervalX = (maxX - minX) / 5.0; if ( intervalX > 0.0 ) { - intervalX = pow( 10.0, ceil( log10(intervalX) ) ); + intervalX = pow(10.0, ceil(log10(intervalX))); } self.majorIntervalLengthForX = intervalX; double intervalY = (maxY - minY) / 10.0; if ( intervalY > 0.0 ) { - intervalY = pow( 10.0, ceil( log10(intervalY) ) ); + intervalY = pow(10.0, ceil(log10(intervalY))); } self.majorIntervalLengthForY = intervalY; @@ -263,20 +263,20 @@ -(IBAction)zoomIn -(IBAction)zoomOut { - double minX = MAXFLOAT; - double maxX = -MAXFLOAT; + double minX = (double)INFINITY; + double maxX = -(double)INFINITY; - double minY = MAXFLOAT; - double maxY = -MAXFLOAT; + double minY = (double)INFINITY; + double maxY = -(double)INFINITY; // get the ful range min and max values for ( NSDictionary *xyValues in self.dataPoints ) { - double xVal = [xyValues[@"x"] doubleValue]; + double xVal = xyValues[@"x"].doubleValue; minX = fmin(xVal, minX); maxX = fmax(xVal, maxX); - double yVal = [xyValues[@"y"] doubleValue]; + double yVal = xyValues[@"y"].doubleValue; minY = fmin(yVal, minY); maxY = fmax(yVal, maxY); @@ -297,9 +297,9 @@ -(IBAction)zoomOut CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace; plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@(minX) - length:@(ceil( (maxX - minX) / intervalX ) * intervalX)]; + length:@(ceil((maxX - minX) / intervalX) * intervalX)]; plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@(minY) - length:@(ceil( (maxY - minY) / intervalY ) * intervalY)]; + length:@(ceil((maxY - minY) / intervalY) * intervalY)]; CPTXYAxisSet *axisSet = (CPTXYAxisSet *)self.graph.axisSet; axisSet.xAxis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; axisSet.yAxis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; @@ -308,35 +308,35 @@ -(IBAction)zoomOut #pragma mark - #pragma mark PDF / image export --(IBAction)exportToPDF:(id)sender +-(IBAction)exportToPDF:(nullable id __unused)sender { NSSavePanel *pdfSavingDialog = [NSSavePanel savePanel]; - [pdfSavingDialog setAllowedFileTypes:@[@"pdf"]]; + pdfSavingDialog.allowedFileTypes = @[@"pdf"]; if ( [pdfSavingDialog runModal] == NSOKButton ) { NSData *dataForPDF = [self.graph dataForPDFRepresentationOfLayer]; - NSURL *url = [pdfSavingDialog URL]; + NSURL *url = pdfSavingDialog.URL; if ( url ) { [dataForPDF writeToURL:url atomically:NO]; } } } --(IBAction)exportToPNG:(id)sender +-(IBAction)exportToPNG:(nullable id __unused)sender { NSSavePanel *pngSavingDialog = [NSSavePanel savePanel]; - [pngSavingDialog setAllowedFileTypes:@[@"png"]]; + pngSavingDialog.allowedFileTypes = @[@"png"]; if ( [pngSavingDialog runModal] == NSOKButton ) { NSImage *image = [self.graph imageOfLayer]; - NSData *tiffData = [image TIFFRepresentation]; + NSData *tiffData = image.TIFFRepresentation; NSBitmapImageRep *tiffRep = [NSBitmapImageRep imageRepWithData:tiffData]; - NSData *pngData = [tiffRep representationUsingType:NSPNGFileType properties:[NSDictionary dictionary]]; + NSData *pngData = [tiffRep representationUsingType:NSPNGFileType properties:@{}]; - NSURL *url = [pngSavingDialog URL]; + NSURL *url = pngSavingDialog.URL; if ( url ) { [pngData writeToURL:url atomically:NO]; } @@ -346,12 +346,12 @@ -(IBAction)exportToPNG:(id)sender #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.dataPoints.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { NSString *key = (fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y"); @@ -361,7 +361,7 @@ -(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUI #pragma mark - #pragma mark Plot Space Delegate Methods --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(id)event atPoint:(CGPoint)interactionPoint +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceDraggedEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint)interactionPoint { CPTPlotSpaceAnnotation *annotation = self.zoomAnnotation; @@ -369,16 +369,16 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(i CPTPlotArea *plotArea = self.graph.plotAreaFrame.plotArea; CGRect plotBounds = plotArea.bounds; - // convert the dragStart and dragEnd values to plot coordinates +// convert the dragStart and dragEnd values to plot coordinates CGPoint dragStartInPlotArea = [self.graph convertPoint:self.dragStart toLayer:plotArea]; CGPoint dragEndInPlotArea = [self.graph convertPoint:interactionPoint toLayer:plotArea]; - // create the dragrect from dragStart to the current location - CGFloat endX = MAX( MIN( dragEndInPlotArea.x, CGRectGetMaxX(plotBounds) ), CGRectGetMinX(plotBounds) ); - CGFloat endY = MAX( MIN( dragEndInPlotArea.y, CGRectGetMaxY(plotBounds) ), CGRectGetMinY(plotBounds) ); - CGRect borderRect = CGRectMake( dragStartInPlotArea.x, dragStartInPlotArea.y, - (endX - dragStartInPlotArea.x), - (endY - dragStartInPlotArea.y) ); +// create the dragrect from dragStart to the current location + CGFloat endX = MAX(MIN(dragEndInPlotArea.x, CGRectGetMaxX(plotBounds)), CGRectGetMinX(plotBounds)); + CGFloat endY = MAX(MIN(dragEndInPlotArea.y, CGRectGetMaxY(plotBounds)), CGRectGetMinY(plotBounds)); + CGRect borderRect = CGRectMake(dragStartInPlotArea.x, dragStartInPlotArea.y, + (endX - dragStartInPlotArea.x), + (endY - dragStartInPlotArea.y)); annotation.contentAnchorPoint = CGPointMake(dragEndInPlotArea.x >= dragStartInPlotArea.x ? 0.0 : 1.0, dragEndInPlotArea.y >= dragStartInPlotArea.y ? 0.0 : 1.0); @@ -388,7 +388,7 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDraggedEvent:(i return NO; } --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)event atPoint:(CGPoint)interactionPoint +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceDownEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint)interactionPoint { if ( !self.zoomAnnotation ) { self.dragStart = interactionPoint; @@ -396,9 +396,9 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)e CPTPlotArea *plotArea = self.graph.plotAreaFrame.plotArea; CGPoint dragStartInPlotArea = [self.graph convertPoint:self.dragStart toLayer:plotArea]; - if ( CGRectContainsPoint(plotArea.bounds, dragStartInPlotArea) ) { - // create the zoom rectangle - // first a bordered layer to draw the zoomrect + if ( CGRectContainsPoint(plotArea.bounds, dragStartInPlotArea)) { +// create the zoom rectangle +// first a bordered layer to draw the zoomrect CPTBorderedLayer *zoomRectangleLayer = [[CPTBorderedLayer alloc] initWithFrame:CGRectNull]; CPTMutableLineStyle *lineStyle = [CPTMutableLineStyle lineStyle]; @@ -411,10 +411,10 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)e double start[2]; [self.graph.defaultPlotSpace doublePrecisionPlotPoint:start numberOfCoordinates:2 forPlotAreaViewPoint:dragStartInPlotArea]; - CPTNumberArray anchorPoint = @[@(start[CPTCoordinateX]), - @(start[CPTCoordinateY])]; + CPTNumberArray *anchorPoint = @[@(start[CPTCoordinateX]), + @(start[CPTCoordinateY])]; - // now create the annotation +// now create the annotation CPTPlotSpace *defaultSpace = self.graph.defaultPlotSpace; if ( defaultSpace ) { CPTPlotSpaceAnnotation *annotation = [[CPTPlotSpaceAnnotation alloc] initWithPlotSpace:defaultSpace anchorPlotPoint:anchorPoint]; @@ -429,7 +429,7 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceDownEvent:(id)e return NO; } --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)event atPoint:(CGPoint)interactionPoint +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTPlotSpaceAnnotation *annotation = self.zoomAnnotation; @@ -437,15 +437,15 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)eve self.dragEnd = interactionPoint; // double-click to completely zoom out - if ( [event clickCount] == 2 ) { + if ((event.type != NSEventTypeScrollWheel) && (event.clickCount == 2)) { CPTPlotArea *plotArea = self.graph.plotAreaFrame.plotArea; CGPoint dragEndInPlotArea = [self.graph convertPoint:interactionPoint toLayer:plotArea]; - if ( CGRectContainsPoint(plotArea.bounds, dragEndInPlotArea) ) { + if ( CGRectContainsPoint(plotArea.bounds, dragEndInPlotArea)) { [self zoomOut]; } } - else if ( !CGPointEqualToPoint(self.dragStart, self.dragEnd) ) { + else if ( !CGPointEqualToPoint(self.dragStart, self.dragEnd)) { // no accidental drag, so zoom in [self zoomIn]; } @@ -461,7 +461,7 @@ -(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)eve return NO; } --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceCancelledEvent:(id)event atPoint:(CGPoint)interactionPoint +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceCancelledEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)interactionPoint { CPTPlotSpaceAnnotation *annotation = self.zoomAnnotation; diff --git a/examples/DropPlot/DropPlot.xcodeproj/project.pbxproj b/examples/DropPlot/DropPlot.xcodeproj/project.pbxproj index a07cd5882..43c984131 100644 --- a/examples/DropPlot/DropPlot.xcodeproj/project.pbxproj +++ b/examples/DropPlot/DropPlot.xcodeproj/project.pbxproj @@ -71,6 +71,20 @@ remoteGlobalIDString = C38A09C41A4619A900D45436; remoteInfo = "CorePlot-CocoaTouchTests"; }; + C3CBFB791BE590A300519EE8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BC93AA7C0FDEFEAC00606226 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C3CBFB7B1BE590A300519EE8 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BC93AA7C0FDEFEAC00606226 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -88,26 +102,26 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - 089C1660FE840EACC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FBA07B3F13500E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; - 1DDD58290DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/CPTPlotDocument.xib; sourceTree = ""; }; - 1DDD582B0DA1D0D100B32029 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/MainMenu.xib; sourceTree = ""; }; - 2A37F4ACFDCFA73011CA2CEA /* CPTPlotDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTPlotDocument.m; sourceTree = ""; }; + 2A37F4ACFDCFA73011CA2CEA /* CPTPlotDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPlotDocument.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 2A37F4AEFDCFA73011CA2CEA /* CPTPlotDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotDocument.h; sourceTree = ""; }; 2A37F4B0FDCFA73011CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 2A37F4BAFDCFA73011CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = English; path = English.lproj/Credits.rtf; sourceTree = ""; }; 2A37F4C4FDCFA73011CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 2A37F4C5FDCFA73011CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32DBCF750370BD2300C91783 /* DropPlot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DropPlot_Prefix.pch; sourceTree = ""; }; - 8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D15AC370486D014006FF6A4 /* DropPlot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DropPlot.app; sourceTree = BUILT_PRODUCTS_DIR; }; BC00E6470FE1BF0A00DE81E0 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; BC93AA7C0FDEFEAC00606226 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = SOURCE_ROOT; }; BC93AAF40FDF3F0200606226 /* NSString+ParseCSV.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+ParseCSV.h"; sourceTree = ""; }; BC93AAF50FDF3F0200606226 /* NSString+ParseCSV.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+ParseCSV.m"; sourceTree = ""; }; + C3564D1722A2D115000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.rtf; name = en; path = en.lproj/Credits.rtf; sourceTree = ""; }; + C3564D1822A2D115000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + C37A40A820E0314800C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C3D3937719FD705000148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = DropPlot/Images.xcassets; sourceTree = ""; }; C3D6210E19DF72E000652CE7 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3DA082A20E00C3C00F73704 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/CPTPlotDocument.xib; sourceTree = ""; }; + C3DA082B20E00C3C00F73704 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -193,7 +207,7 @@ children = ( C3D3937719FD705000148319 /* Images.xcassets */, 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */, - 8D15AC360486D014006FF6A4 /* Info.plist */, + C37A40A920E0314800C4FF48 /* Info.plist */, 089C165FFE840EACC02AAC07 /* InfoPlist.strings */, 1DDD58280DA1D0D100B32029 /* CPTPlotDocument.xib */, 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */, @@ -219,6 +233,8 @@ C3B345AA1B46194500844218 /* UnitTests iOS.xctest */, C3B345AC1B46194500844218 /* libCorePlot-CocoaTouch.a */, C3B345AE1B46194500844218 /* CorePlot-CocoaTouchTests.xctest */, + C3CBFB7A1BE590A300519EE8 /* CorePlot.framework */, + C3CBFB7C1BE590A300519EE8 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -252,17 +268,18 @@ 2A37F4A9FDCFA73011CA2CEA /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1100; }; buildConfigurationList = C05733CB08A9546B00998B17 /* Build configuration list for PBXProject "DropPlot" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + de, + ja, + fr, + en, ); mainGroup = 2A37F4AAFDCFA73011CA2CEA /* DropPlot */; projectDirPath = ""; @@ -322,6 +339,20 @@ remoteRef = C3B345AD1B46194500844218 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + C3CBFB7A1BE590A300519EE8 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C3CBFB791BE590A300519EE8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C3CBFB7C1BE590A300519EE8 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C3CBFB7B1BE590A300519EE8 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; /* End PBXReferenceProxy section */ /* Begin PBXResourcesBuildPhase section */ @@ -364,7 +395,7 @@ 089C165FFE840EACC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C1660FE840EACC02AAC07 /* English */, + C3564D1822A2D115000A54C9 /* en */, ); name = InfoPlist.strings; sourceTree = ""; @@ -372,7 +403,7 @@ 1DDD58280DA1D0D100B32029 /* CPTPlotDocument.xib */ = { isa = PBXVariantGroup; children = ( - 1DDD58290DA1D0D100B32029 /* English */, + C3DA082A20E00C3C00F73704 /* Base */, ); name = CPTPlotDocument.xib; sourceTree = ""; @@ -380,7 +411,7 @@ 1DDD582A0DA1D0D100B32029 /* MainMenu.xib */ = { isa = PBXVariantGroup; children = ( - 1DDD582B0DA1D0D100B32029 /* English */, + C3DA082B20E00C3C00F73704 /* Base */, ); name = MainMenu.xib; sourceTree = ""; @@ -388,11 +419,19 @@ 2A37F4B9FDCFA73011CA2CEA /* Credits.rtf */ = { isa = PBXVariantGroup; children = ( - 2A37F4BAFDCFA73011CA2CEA /* English */, + C3564D1722A2D115000A54C9 /* en */, ); name = Credits.rtf; sourceTree = ""; }; + C37A40A920E0314800C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40A820E0314800C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -403,14 +442,14 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = DropPlot_Prefix.pch; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -425,13 +464,14 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = DropPlot_Prefix.pch; HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -441,15 +481,15 @@ }; C05733CC08A9546B00998B17 /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3D6210E19DF72E000652CE7 /* CorePlotWarnings.xcconfig */; buildSettings = { ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; @@ -458,11 +498,13 @@ }; C05733CD08A9546B00998B17 /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3D6210E19DF72E000652CE7 /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; + MACOSX_DEPLOYMENT_TARGET = 10.8; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; }; diff --git a/examples/DropPlot/DropPlot.xcodeproj/xcshareddata/xcschemes/DropPlot.xcscheme b/examples/DropPlot/DropPlot.xcodeproj/xcshareddata/xcschemes/DropPlot.xcscheme new file mode 100644 index 000000000..e0844ecb4 --- /dev/null +++ b/examples/DropPlot/DropPlot.xcodeproj/xcshareddata/xcschemes/DropPlot.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/DropPlot/NSString+ParseCSV.h b/examples/DropPlot/NSString+ParseCSV.h index 050b88e4e..2258c2636 100644 --- a/examples/DropPlot/NSString+ParseCSV.h +++ b/examples/DropPlot/NSString+ParseCSV.h @@ -3,6 +3,6 @@ @interface NSString(ParseCSV) --(CPTStringArray)arrayByParsingCSVLine; +-(CPTStringArray *)arrayByParsingCSVLine; @end diff --git a/examples/DropPlot/NSString+ParseCSV.m b/examples/DropPlot/NSString+ParseCSV.m index d3b604b98..7a9bbde09 100644 --- a/examples/DropPlot/NSString+ParseCSV.m +++ b/examples/DropPlot/NSString+ParseCSV.m @@ -2,22 +2,22 @@ @implementation NSString(ParseCSV) --(CPTStringArray)arrayByParsingCSVLine +-(CPTStringArray *)arrayByParsingCSVLine { BOOL isRemoveWhitespace = YES; - CPTMutableStringArray theArray = [NSMutableArray array]; - CPTStringArray theFields = [self componentsSeparatedByString:@","]; + CPTMutableStringArray *theArray = [NSMutableArray array]; + CPTStringArray *theFields = [self componentsSeparatedByString:@","]; NSCharacterSet *quotedCharacterSet = [NSCharacterSet characterSetWithCharactersInString:@"\""]; NSMutableString *theConcatenatedField = [NSMutableString string]; BOOL inField = NO; - for ( NSUInteger i = 0; i < [theFields count]; i++ ) { + for ( NSUInteger i = 0; i < theFields.count; i++ ) { NSString *theField = theFields[i]; switch ( inField ) { case NO: - if ( ([theField hasPrefix:@"\""] == YES) && ([theField hasSuffix:@"\""] == NO) ) { + if (([theField hasPrefix:@"\""] == YES) && ([theField hasSuffix:@"\""] == NO)) { inField = YES; [theConcatenatedField appendString:theField]; [theConcatenatedField appendString:@","]; diff --git a/examples/DropPlot/English.lproj/Credits.rtf b/examples/DropPlot/en.lproj/Credits.rtf similarity index 100% rename from examples/DropPlot/English.lproj/Credits.rtf rename to examples/DropPlot/en.lproj/Credits.rtf diff --git a/examples/DropPlot/English.lproj/InfoPlist.strings b/examples/DropPlot/en.lproj/InfoPlist.strings similarity index 100% rename from examples/DropPlot/English.lproj/InfoPlist.strings rename to examples/DropPlot/en.lproj/InfoPlist.strings diff --git a/examples/DropPlot/main.m b/examples/DropPlot/main.m index c81924a60..77a0b5c98 100644 --- a/examples/DropPlot/main.m +++ b/examples/DropPlot/main.m @@ -1,9 +1,9 @@ // -// main.m -// DropPlot +// main.m +// DropPlot // -// Created by Brad Larson on 6/9/2009. -// Copyright SonoPlot, Inc. 2009 . All rights reserved. +// Created by Brad Larson on 6/9/2009. +// Copyright SonoPlot, Inc. 2009 . All rights reserved. // #import diff --git a/examples/MinorTickLabels/Info.plist b/examples/MinorTickLabels/Base.lproj/Info.plist similarity index 100% rename from examples/MinorTickLabels/Info.plist rename to examples/MinorTickLabels/Base.lproj/Info.plist diff --git a/examples/MinorTickLabels/minorTickFormatter.xib b/examples/MinorTickLabels/Base.lproj/minorTickFormatter.xib similarity index 100% rename from examples/MinorTickLabels/minorTickFormatter.xib rename to examples/MinorTickLabels/Base.lproj/minorTickFormatter.xib diff --git a/examples/MinorTickLabels/Controller.m b/examples/MinorTickLabels/Controller.m index 118873b06..194c6a92a 100644 --- a/examples/MinorTickLabels/Controller.m +++ b/examples/MinorTickLabels/Controller.m @@ -3,9 +3,9 @@ @interface Controller() -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *hostView; -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; -@property (nonatomic, readwrite, strong) NSArray *plotData; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *hostView; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; @end @@ -61,7 +61,7 @@ -(void)awakeFromNib CPTTimeFormatter *myTimeFormatter = [[CPTTimeFormatter alloc] initWithDateFormatter:timeFormatter]; myTimeFormatter.referenceDate = refDate; x.minorTickLabelFormatter = myTimeFormatter; -// x.minorTickLabelRotation = M_PI_2; +// x.minorTickLabelRotation = M_PI_2; CPTXYAxis *y = axisSet.yAxis; y.majorIntervalLength = @0.5; @@ -98,12 +98,12 @@ -(void)awakeFromNib #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { return self.plotData[index][@(fieldEnum)]; } diff --git a/examples/MinorTickLabels/Source/main.m b/examples/MinorTickLabels/Source/main.m index 50ab6acfb..c8341df20 100644 --- a/examples/MinorTickLabels/Source/main.m +++ b/examples/MinorTickLabels/Source/main.m @@ -1,9 +1,9 @@ // -// main.m -// CPTTestApp +// main.m +// CPTTestApp // -// Created by Dirkjan Krijnders on 2/2/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. +// Created by Dirkjan Krijnders on 2/2/09. +// Copyright __MyCompanyName__ 2009. All rights reserved. // #import diff --git a/examples/MinorTickLabels/English.lproj/InfoPlist.strings b/examples/MinorTickLabels/en.lproj/InfoPlist.strings similarity index 100% rename from examples/MinorTickLabels/English.lproj/InfoPlist.strings rename to examples/MinorTickLabels/en.lproj/InfoPlist.strings diff --git a/examples/MinorTickLabels/minorTickFormatter.xcodeproj/project.pbxproj b/examples/MinorTickLabels/minorTickFormatter.xcodeproj/project.pbxproj index b49d4a8cf..d0e672ef8 100644 --- a/examples/MinorTickLabels/minorTickFormatter.xcodeproj/project.pbxproj +++ b/examples/MinorTickLabels/minorTickFormatter.xcodeproj/project.pbxproj @@ -13,8 +13,8 @@ 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - 90AF4F440F36CF1800753D26 /* minorTickFormatter.xib in Resources */ = {isa = PBXBuildFile; fileRef = 90AF4F430F36CF1800753D26 /* minorTickFormatter.xib */; }; BC8E737D0FC0B3CF00DF8511 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */; }; + C3D0A1CB20E0195800BA2921 /* minorTickFormatter.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A1CD20E0195800BA2921 /* minorTickFormatter.xib */; }; C3D3937C19FD732200148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3937B19FD732200148319 /* Images.xcassets */; }; /* End PBXBuildFile section */ @@ -40,6 +40,20 @@ remoteGlobalIDString = 0730F600109492D800E95162; remoteInfo = UnitTests; }; + C310CE771C0A3DF000C4FCB4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C310CE791C0A3DF000C4FCB4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3B345B71B46195100844218 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; @@ -90,18 +104,18 @@ 0761854B0F3CB3CB00A89A76 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CorePlot.framework; path = ../../../../framework/build/Debug/CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 077382AF0F3DC1FB002F10E2 /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = ""; }; 077382B00F3DC1FB002F10E2 /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = ""; }; - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Source/main.m; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* minorTickFormatter_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = minorTickFormatter_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* minorTickFormatter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = minorTickFormatter.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 90AF4F430F36CF1800753D26 /* minorTickFormatter.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = minorTickFormatter.xib; sourceTree = ""; }; BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + C3564CFD22A2D107000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + C37A40B620E0316900C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C37FFB5D19E1ECF0003F34C5 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3D0A1DA20E0195F00BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/minorTickFormatter.xib; sourceTree = ""; }; C3D3937B19FD732200148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = minorTickFormatter/Images.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -128,6 +142,8 @@ C3B345BA1B46195100844218 /* UnitTests iOS.xctest */, C3B345BC1B46195100844218 /* libCorePlot-CocoaTouch.a */, C3B345BE1B46195100844218 /* CorePlot-CocoaTouchTests.xctest */, + C310CE781C0A3DF000C4FCB4 /* CorePlot.framework */, + C310CE7A1C0A3DF000C4FCB4 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -200,8 +216,8 @@ isa = PBXGroup; children = ( C3D3937B19FD732200148319 /* Images.xcassets */, - 90AF4F430F36CF1800753D26 /* minorTickFormatter.xib */, - 8D1107310486CEB800E47090 /* Info.plist */, + C3D0A1CD20E0195800BA2921 /* minorTickFormatter.xib */, + C37A40B720E0316900C4FF48 /* Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, ); name = Resources; @@ -246,17 +262,18 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = NO; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1100; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "minorTickFormatter" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + de, + en, + ja, + fr, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CPTTestApp */; projectDirPath = ""; @@ -288,6 +305,20 @@ remoteRef = 07E0DF7F109C4E9500F108D2 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + C310CE781C0A3DF000C4FCB4 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C310CE771C0A3DF000C4FCB4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C310CE7A1C0A3DF000C4FCB4 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C310CE791C0A3DF000C4FCB4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3B345B81B46195100844218 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -325,7 +356,7 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, C3D3937C19FD732200148319 /* Images.xcassets in Resources */, - 90AF4F440F36CF1800753D26 /* minorTickFormatter.xib in Resources */, + C3D0A1CB20E0195800BA2921 /* minorTickFormatter.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -355,11 +386,27 @@ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C165DFE840E0CC02AAC07 /* English */, + C3564CFD22A2D107000A54C9 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; + C37A40B720E0316900C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40B620E0316900C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; + C3D0A1CD20E0195800BA2921 /* minorTickFormatter.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A1DA20E0195F00BA2921 /* Base */, + ); + name = minorTickFormatter.xib; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -370,16 +417,15 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = minorTickFormatter_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -394,13 +440,14 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = minorTickFormatter_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -410,15 +457,16 @@ }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C37FFB5D19E1ECF0003F34C5 /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; @@ -427,12 +475,14 @@ }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C37FFB5D19E1ECF0003F34C5 /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; }; diff --git a/examples/MinorTickLabels/minorTickFormatter.xcodeproj/xcshareddata/xcschemes/minorTickFormatter.xcscheme b/examples/MinorTickLabels/minorTickFormatter.xcodeproj/xcshareddata/xcschemes/minorTickFormatter.xcscheme new file mode 100644 index 000000000..417b6d1dc --- /dev/null +++ b/examples/MinorTickLabels/minorTickFormatter.xcodeproj/xcshareddata/xcschemes/minorTickFormatter.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/RangePlot/Info.plist b/examples/RangePlot/Base.lproj/Info.plist similarity index 100% rename from examples/RangePlot/Info.plist rename to examples/RangePlot/Base.lproj/Info.plist diff --git a/examples/RangePlot/RangePlot.xib b/examples/RangePlot/Base.lproj/RangePlot.xib similarity index 100% rename from examples/RangePlot/RangePlot.xib rename to examples/RangePlot/Base.lproj/RangePlot.xib diff --git a/examples/RangePlot/Controller.m b/examples/RangePlot/Controller.m index d2b16d02e..bf6741983 100644 --- a/examples/RangePlot/Controller.m +++ b/examples/RangePlot/Controller.m @@ -3,11 +3,11 @@ @interface Controller() -@property (nonatomic, readwrite, strong) IBOutlet CPTGraphHostingView *hostView; -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; -@property (nonatomic, readwrite, strong) NSArray *plotData; -@property (nonatomic, readwrite, strong) CPTFill *areaFill; -@property (nonatomic, readwrite, strong) CPTLineStyle *barLineStyle; +@property (nonatomic, readwrite, strong, nullable) IBOutlet CPTGraphHostingView *hostView; +@property (nonatomic, readwrite, strong, nonnull) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nonnull) NSArray *plotData; +@property (nonatomic, readwrite, strong, nonnull) CPTFill *areaFill; +@property (nonatomic, readwrite, strong, nonnull) CPTLineStyle *barLineStyle; @end @@ -124,17 +124,17 @@ -(void)awakeFromNib #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.plotData.count; } --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index +-(nullable id)numberForPlot:(nonnull CPTPlot *__unused)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index { return self.plotData[index][@(fieldEnum)]; } --(BOOL)plotSpace:(CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(id)event atPoint:(CGPoint)point +-(BOOL)plotSpace:(nonnull CPTPlotSpace *__unused)space shouldHandlePointingDeviceUpEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)point { CPTRangePlot *rangePlot = (CPTRangePlot *)[self.graph plotWithIdentifier:@"Date Plot"]; diff --git a/examples/RangePlot/RangePlot.xcodeproj/project.pbxproj b/examples/RangePlot/RangePlot.xcodeproj/project.pbxproj index 6256f4431..53802d311 100644 --- a/examples/RangePlot/RangePlot.xcodeproj/project.pbxproj +++ b/examples/RangePlot/RangePlot.xcodeproj/project.pbxproj @@ -7,15 +7,14 @@ objects = { /* Begin PBXBuildFile section */ - 071BCBD71079EBE00045E43D /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 071BCBD61079EBE00045E43D /* CorePlot.framework */; }; 076185040F3CB17800A89A76 /* CorePlot.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = 076184C10F3CAD5900A89A76 /* CorePlot.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; }; 0761850B0F3CB1E800A89A76 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 076184C10F3CAD5900A89A76 /* CorePlot.framework */; }; 077382B10F3DC1FB002F10E2 /* Controller.m in Sources */ = {isa = PBXBuildFile; fileRef = 077382B00F3DC1FB002F10E2 /* Controller.m */; }; 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; }; 8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; }; 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; }; - 90AF4F440F36CF1800753D26 /* RangePlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = 90AF4F430F36CF1800753D26 /* RangePlot.xib */; }; BC8E737D0FC0B3CF00DF8511 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */; }; + C3D0A17B20E0179100BA2921 /* RangePlot.xib in Resources */ = {isa = PBXBuildFile; fileRef = C3D0A17D20E0179100BA2921 /* RangePlot.xib */; }; C3D3938219FD786F00148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3938119FD786F00148319 /* Images.xcassets */; }; /* End PBXBuildFile section */ @@ -41,6 +40,20 @@ remoteGlobalIDString = 0730F600109492D800E95162; remoteInfo = UnitTests; }; + C310CE871C0A3DF700C4FCB4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6921BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; + C310CE891C0A3DF700C4FCB4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C37EA6B71BC83F2D0091C8F7; + remoteInfo = "UnitTests tvOS"; + }; C3B345C71B46195900844218 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = 076184BC0F3CAD5900A89A76 /* CorePlot.xcodeproj */; @@ -91,18 +104,18 @@ 0761854B0F3CB3CB00A89A76 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = CorePlot.framework; path = ../../../../framework/build/Debug/CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 077382AF0F3DC1FB002F10E2 /* Controller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Controller.h; sourceTree = ""; }; 077382B00F3DC1FB002F10E2 /* Controller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Controller.m; sourceTree = ""; }; - 089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = ""; }; 13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = ""; }; 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = main.m; path = Source/main.m; sourceTree = ""; }; 29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = ""; }; 29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = ""; }; 32CA4F630368D1EE00C91783 /* RangePlot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RangePlot_Prefix.pch; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 8D1107320486CEB800E47090 /* RangePlot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RangePlot.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 90AF4F430F36CF1800753D26 /* RangePlot.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RangePlot.xib; sourceTree = ""; }; BC8E737C0FC0B3CF00DF8511 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + C3564CBC22A2D0E1000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; + C37A40C420E0318900C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = Base.lproj/Info.plist; sourceTree = ""; }; C37FFB6019E1EEB6003F34C5 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3D0A18A20E0179F00BA2921 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/RangePlot.xib; sourceTree = ""; }; C3D3938119FD786F00148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = RangePlot/Images.xcassets; sourceTree = ""; }; /* End PBXFileReference section */ @@ -114,7 +127,6 @@ 0761850B0F3CB1E800A89A76 /* CorePlot.framework in Frameworks */, 8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */, BC8E737D0FC0B3CF00DF8511 /* QuartzCore.framework in Frameworks */, - 071BCBD71079EBE00045E43D /* CorePlot.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -130,6 +142,8 @@ C3B345CA1B46195900844218 /* UnitTests iOS.xctest */, C3B345CC1B46195900844218 /* libCorePlot-CocoaTouch.a */, C3B345CE1B46195900844218 /* CorePlot-CocoaTouchTests.xctest */, + C310CE881C0A3DF700C4FCB4 /* CorePlot.framework */, + C310CE8A1C0A3DF700C4FCB4 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -202,8 +216,8 @@ isa = PBXGroup; children = ( C3D3938119FD786F00148319 /* Images.xcassets */, - 90AF4F430F36CF1800753D26 /* RangePlot.xib */, - 8D1107310486CEB800E47090 /* Info.plist */, + C3D0A17D20E0179100BA2921 /* RangePlot.xib */, + C37A40C520E0318900C4FF48 /* Info.plist */, 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */, ); name = Resources; @@ -248,17 +262,18 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = NO; - LastUpgradeCheck = 0700; + LastUpgradeCheck = 1100; }; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "RangePlot" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + en, + de, + fr, + ja, ); mainGroup = 29B97314FDCFA39411CA2CEA /* CPTTestApp */; projectDirPath = ""; @@ -290,6 +305,20 @@ remoteRef = 07E0DF7F109C4E9500F108D2 /* PBXContainerItemProxy */; sourceTree = BUILT_PRODUCTS_DIR; }; + C310CE881C0A3DF700C4FCB4 /* CorePlot.framework */ = { + isa = PBXReferenceProxy; + fileType = wrapper.framework; + path = CorePlot.framework; + remoteRef = C310CE871C0A3DF700C4FCB4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + C310CE8A1C0A3DF700C4FCB4 /* UnitTests tvOS.xctest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = "UnitTests tvOS.xctest"; + remoteRef = C310CE891C0A3DF700C4FCB4 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; C3B345C81B46195900844218 /* CorePlot.framework */ = { isa = PBXReferenceProxy; fileType = wrapper.framework; @@ -327,7 +356,7 @@ files = ( 8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */, C3D3938219FD786F00148319 /* Images.xcassets in Resources */, - 90AF4F440F36CF1800753D26 /* RangePlot.xib in Resources */, + C3D0A17B20E0179100BA2921 /* RangePlot.xib in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -357,11 +386,27 @@ 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C165DFE840E0CC02AAC07 /* English */, + C3564CBC22A2D0E1000A54C9 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; + C37A40C520E0318900C4FF48 /* Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A40C420E0318900C4FF48 /* Base */, + ); + name = Info.plist; + sourceTree = ""; + }; + C3D0A17D20E0179100BA2921 /* RangePlot.xib */ = { + isa = PBXVariantGroup; + children = ( + C3D0A18A20E0179F00BA2921 /* Base */, + ); + name = RangePlot.xib; + sourceTree = ""; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -372,16 +417,15 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; COPY_PHASE_STRIP = NO; GCC_DYNAMIC_NO_PIC = NO; GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = RangePlot_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_TREAT_WARNINGS_AS_ERRORS = YES; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -396,13 +440,14 @@ ALWAYS_SEARCH_USER_PATHS = NO; ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_OBJC_ARC = YES; + CODE_SIGN_IDENTITY = "-"; COMBINE_HIDPI_IMAGES = YES; DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; GCC_MODEL_TUNING = G5; GCC_PRECOMPILE_PREFIX_HEADER = YES; GCC_PREFIX_HEADER = RangePlot_Prefix.pch; GCC_PREPROCESSOR_DEFINITIONS = ""; - INFOPLIST_FILE = Info.plist; + INFOPLIST_FILE = "$(SRCROOT)/Base.lproj/Info.plist"; INSTALL_PATH = "$(HOME)/Applications"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @loader_path/../Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; @@ -412,15 +457,16 @@ }; C01FCF4F08A954540054247B /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C37FFB6019E1EEB6003F34C5 /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; ENABLE_TESTABILITY = YES; FRAMEWORK_SEARCH_PATHS = ""; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; GCC_OPTIMIZATION_LEVEL = 0; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; ONLY_ACTIVE_ARCH = YES; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; @@ -429,12 +475,14 @@ }; C01FCF5008A954540054247B /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C37FFB6019E1EEB6003F34C5 /* CorePlotWarnings.xcconfig */; buildSettings = { + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; GCC_C_LANGUAGE_STANDARD = c99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = s; GCC_PREPROCESSOR_DEFINITIONS = ""; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.7; + MACOSX_DEPLOYMENT_TARGET = 10.8; SDKROOT = macosx; SYMROOT = "$(SRCROOT)/../../build"; }; diff --git a/examples/RangePlot/RangePlot.xcodeproj/xcshareddata/xcschemes/RangePlot.xcscheme b/examples/RangePlot/RangePlot.xcodeproj/xcshareddata/xcschemes/RangePlot.xcscheme new file mode 100644 index 000000000..ecd1f2065 --- /dev/null +++ b/examples/RangePlot/RangePlot.xcodeproj/xcshareddata/xcschemes/RangePlot.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/RangePlot/Source/main.m b/examples/RangePlot/Source/main.m index 50ab6acfb..c8341df20 100644 --- a/examples/RangePlot/Source/main.m +++ b/examples/RangePlot/Source/main.m @@ -1,9 +1,9 @@ // -// main.m -// CPTTestApp +// main.m +// CPTTestApp // -// Created by Dirkjan Krijnders on 2/2/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. +// Created by Dirkjan Krijnders on 2/2/09. +// Copyright __MyCompanyName__ 2009. All rights reserved. // #import diff --git a/examples/RangePlot/English.lproj/InfoPlist.strings b/examples/RangePlot/en.lproj/InfoPlist.strings similarity index 100% rename from examples/RangePlot/English.lproj/InfoPlist.strings rename to examples/RangePlot/en.lproj/InfoPlist.strings diff --git a/examples/StockPlot/AAPL.plist b/examples/StockPlot/AAPL.plist deleted file mode 100644 index 717591046..000000000 --- a/examples/StockPlot/AAPL.plist +++ /dev/null @@ -1,1107 +0,0 @@ - - - - - endDate - 2009-06-19T06:53:47Z - financialData - - - adjClose - 135.88 - close - 135.88 - date - 2009-06-18T04:00:00Z - high - 138 - low - 135.59 - open - 136.11 - volume - 15237600 - - - adjClose - 135.58 - close - 135.58 - date - 2009-06-17T04:00:00Z - high - 137.45 - low - 134.53 - open - 136.67 - volume - 20377100 - - - adjClose - 136.35 - close - 136.35 - date - 2009-06-16T04:00:00Z - high - 138.47 - low - 136.1 - open - 136.66 - volume - 18255100 - - - adjClose - 136.09 - close - 136.09 - date - 2009-06-15T04:00:00Z - high - 136.93 - low - 134.89 - open - 136.01 - volume - 19276800 - - - adjClose - 136.97 - close - 136.97 - date - 2009-06-12T04:00:00Z - high - 139.1 - low - 136.04 - open - 138.81 - volume - 20098500 - - - adjClose - 139.95 - close - 139.95 - date - 2009-06-11T04:00:00Z - high - 141.56 - low - 138.55 - open - 139.55 - volume - 18719300 - - - adjClose - 140.25 - close - 140.25 - date - 2009-06-10T04:00:00Z - high - 142.35 - low - 138.3 - open - 142.28 - volume - 24593700 - - - adjClose - 142.72 - close - 142.72 - date - 2009-06-09T04:00:00Z - high - 144.56 - low - 140.55 - open - 143.81 - volume - 24152500 - - - adjClose - 143.85 - close - 143.85 - date - 2009-06-08T04:00:00Z - high - 144.23 - low - 139.43 - open - 143.82 - volume - 33255400 - - - adjClose - 144.67 - close - 144.67 - date - 2009-06-05T04:00:00Z - high - 146.4 - low - 143.21 - open - 145.31 - volume - 22585700 - - - adjClose - 143.74 - close - 143.74 - date - 2009-06-04T04:00:00Z - high - 144.18 - low - 140.04 - open - 140.13 - volume - 19537200 - - - adjClose - 140.95 - close - 140.95 - date - 2009-06-03T04:00:00Z - high - 141.11 - low - 139.07 - open - 140 - volume - 20171800 - - - adjClose - 139.49 - close - 139.49 - date - 2009-06-02T04:00:00Z - high - 141.34 - low - 138.35 - open - 138.99 - volume - 16199500 - - - adjClose - 139.35 - close - 139.35 - date - 2009-06-01T04:00:00Z - high - 139.99 - low - 136 - open - 136.47 - volume - 16160700 - - - adjClose - 135.81 - close - 135.81 - date - 2009-05-29T04:00:00Z - high - 135.9 - low - 133.85 - open - 135.39 - volume - 16304800 - - - adjClose - 135.07 - close - 135.07 - date - 2009-05-28T04:00:00Z - high - 135.39 - low - 132.03 - open - 133.45 - volume - 17397200 - - - adjClose - 133.05 - close - 133.05 - date - 2009-05-27T04:00:00Z - high - 134.98 - low - 130.91 - open - 131.78 - volume - 23086500 - - - adjClose - 130.78 - close - 130.78 - date - 2009-05-26T04:00:00Z - high - 130.83 - low - 124.55 - open - 124.76 - volume - 22692300 - - - adjClose - 122.5 - close - 122.5 - date - 2009-05-22T04:00:00Z - high - 124.18 - low - 121.75 - open - 124.05 - volume - 10642800 - - - adjClose - 124.18 - close - 124.18 - date - 2009-05-21T04:00:00Z - high - 126.78 - low - 122.89 - open - 125.15 - volume - 14569500 - - - adjClose - 125.87 - close - 125.87 - date - 2009-05-20T04:00:00Z - high - 129.21 - low - 125.3 - open - 127.63 - volume - 13878000 - - - adjClose - 127.45 - close - 127.45 - date - 2009-05-19T04:00:00Z - high - 129.31 - low - 125.74 - open - 126.82 - volume - 13300800 - - - adjClose - 126.65 - close - 126.65 - date - 2009-05-18T04:00:00Z - high - 126.7 - low - 121.57 - open - 123.73 - volume - 16387200 - - - adjClose - 122.42 - close - 122.42 - date - 2009-05-15T04:00:00Z - high - 124.62 - low - 121.61 - open - 122.32 - volume - 13127400 - - - adjClose - 122.95 - close - 122.95 - date - 2009-05-14T04:00:00Z - high - 123.53 - low - 119.7 - open - 119.78 - volume - 15993800 - - - adjClose - 119.49 - close - 119.49 - date - 2009-05-13T04:00:00Z - high - 124.02 - low - 119.38 - open - 123.21 - volume - 21284700 - - - adjClose - 124.42 - close - 124.42 - date - 2009-05-12T04:00:00Z - high - 129.71 - low - 123.25 - open - 129.56 - volume - 21767200 - - - adjClose - 129.57 - close - 129.57 - date - 2009-05-11T04:00:00Z - high - 130.96 - low - 127.12 - open - 127.37 - volume - 14452100 - - - adjClose - 129.19 - close - 129.19 - date - 2009-05-08T04:00:00Z - high - 131.23 - low - 126.26 - open - 129.04 - volume - 16713000 - - - adjClose - 129.06 - close - 129.06 - date - 2009-05-07T04:00:00Z - high - 132.39 - low - 127.9 - open - 132.33 - volume - 18992000 - - - adjClose - 132.5 - close - 132.5 - date - 2009-05-06T04:00:00Z - high - 133.5 - low - 130.22 - open - 133.33 - volume - 16912100 - - - adjClose - 132.71 - close - 132.71 - date - 2009-05-05T04:00:00Z - high - 132.86 - low - 131.12 - open - 131.75 - volume - 14223400 - - - adjClose - 132.07 - close - 132.07 - date - 2009-05-04T04:00:00Z - high - 132.25 - low - 127.68 - open - 128.24 - volume - 21762800 - - - adjClose - 127.24 - close - 127.24 - date - 2009-05-01T04:00:00Z - high - 127.95 - low - 125.8 - open - 125.8 - volume - 14197000 - - - adjClose - 125.83 - close - 125.83 - date - 2009-04-30T04:00:00Z - high - 127 - low - 124.92 - open - 126.22 - volume - 17803200 - - - adjClose - 125.14 - close - 125.14 - date - 2009-04-29T04:00:00Z - high - 126.85 - low - 123.83 - open - 124.85 - volume - 16361100 - - - adjClose - 123.9 - close - 123.9 - date - 2009-04-28T04:00:00Z - high - 126.21 - low - 123.26 - open - 123.35 - volume - 16280600 - - - adjClose - 124.73 - close - 124.73 - date - 2009-04-27T04:00:00Z - high - 125 - low - 122.66 - open - 122.9 - volume - 17167500 - - - adjClose - 123.9 - close - 123.9 - date - 2009-04-24T04:00:00Z - high - 125.14 - low - 122.97 - open - 124.64 - volume - 19313000 - - - adjClose - 125.4 - close - 125.4 - date - 2009-04-23T04:00:00Z - high - 127.2 - low - 123.51 - open - 126.62 - volume - 33755600 - - - adjClose - 121.51 - close - 121.51 - date - 2009-04-22T04:00:00Z - high - 125.35 - low - 121.2 - open - 122.63 - volume - 33527400 - - - adjClose - 121.76 - close - 121.76 - date - 2009-04-21T04:00:00Z - high - 122.14 - low - 118.6 - open - 118.89 - volume - 16810200 - - - adjClose - 120.5 - close - 120.5 - date - 2009-04-20T04:00:00Z - high - 122.99 - low - 119.16 - open - 121.73 - volume - 16659500 - - - adjClose - 123.42 - close - 123.42 - date - 2009-04-17T04:00:00Z - high - 124.25 - low - 120.25 - open - 121.18 - volume - 17767700 - - - adjClose - 121.45 - close - 121.45 - date - 2009-04-16T04:00:00Z - high - 123.15 - low - 118.79 - open - 119.19 - volume - 21194500 - - - adjClose - 117.64 - close - 117.64 - date - 2009-04-15T04:00:00Z - high - 118.25 - low - 115.76 - open - 117.2 - volume - 14745800 - - - adjClose - 118.31 - close - 118.31 - date - 2009-04-14T04:00:00Z - high - 120.17 - low - 117.25 - open - 119.57 - volume - 16236500 - - - adjClose - 120.22 - close - 120.22 - date - 2009-04-13T04:00:00Z - high - 120.98 - low - 119 - open - 120.01 - volume - 13901300 - - - adjClose - 119.57 - close - 119.57 - date - 2009-04-09T04:00:00Z - high - 120 - low - 117.96 - open - 118.42 - volume - 18955600 - - - adjClose - 116.32 - close - 116.32 - date - 2009-04-08T04:00:00Z - high - 116.79 - low - 114.58 - open - 115.43 - volume - 16272500 - - - adjClose - 115 - close - 115 - date - 2009-04-07T04:00:00Z - high - 116.67 - low - 114.19 - open - 116.53 - volume - 19163600 - - - adjClose - 118.45 - close - 118.45 - date - 2009-04-06T04:00:00Z - high - 118.75 - low - 113.28 - open - 114.94 - volume - 23502300 - - - adjClose - 115.99 - close - 115.99 - date - 2009-04-03T04:00:00Z - high - 116.13 - low - 113.52 - open - 114.19 - volume - 22722900 - - - adjClose - 112.71 - close - 112.71 - date - 2009-04-02T04:00:00Z - high - 114.75 - low - 109.78 - open - 110.14 - volume - 29013100 - - - adjClose - 108.69 - close - 108.69 - date - 2009-04-01T04:00:00Z - high - 109 - low - 103.89 - open - 104.09 - volume - 21049000 - - - adjClose - 105.12 - close - 105.12 - date - 2009-03-31T04:00:00Z - high - 107.45 - low - 105 - open - 105.45 - volume - 20338500 - - - adjClose - 104.49 - close - 104.49 - date - 2009-03-30T04:00:00Z - high - 105.01 - low - 102.61 - open - 104.51 - volume - 17957000 - - - adjClose - 106.85 - close - 106.85 - date - 2009-03-27T04:00:00Z - high - 108.53 - low - 106.4 - open - 108.23 - volume - 17602600 - - - adjClose - 109.87 - close - 109.87 - date - 2009-03-26T04:00:00Z - high - 109.98 - low - 107.58 - open - 107.83 - volume - 22009000 - - - adjClose - 106.49 - close - 106.49 - date - 2009-03-25T04:00:00Z - high - 108.36 - low - 103.86 - open - 107.58 - volume - 23093500 - - - adjClose - 106.5 - close - 106.5 - date - 2009-03-24T04:00:00Z - high - 109.44 - low - 105.39 - open - 106.36 - volume - 22879000 - - - adjClose - 107.66 - close - 107.66 - date - 2009-03-23T04:00:00Z - high - 108.16 - low - 101.75 - open - 102.71 - volume - 23799900 - - - adjClose - 101.59 - close - 101.59 - date - 2009-03-20T04:00:00Z - high - 103.11 - low - 100.57 - open - 102.09 - volume - 24842400 - - - adjClose - 101.62 - close - 101.62 - date - 2009-03-19T04:00:00Z - high - 103.2 - low - 100.25 - open - 101.85 - volume - 17863600 - - - adjClose - 101.52 - close - 101.52 - date - 2009-03-18T04:00:00Z - high - 103.48 - low - 99.72 - open - 99.91 - volume - 28429900 - - - adjClose - 99.66 - close - 99.66 - date - 2009-03-17T04:00:00Z - high - 99.69 - low - 95.07000000000001 - open - 95.23999999999999 - volume - 28094500 - - - adjClose - 95.42 - close - 95.42 - date - 2009-03-16T04:00:00Z - high - 97.39 - low - 94.17999999999999 - open - 96.53 - volume - 28473000 - - - adjClose - 95.92999999999999 - close - 95.92999999999999 - date - 2009-03-13T04:00:00Z - high - 97.2 - low - 95.01000000000001 - open - 96.3 - volume - 21470300 - - - overallHigh - 146.4 - overallLow - 94.17999999999999 - startDate - 2009-03-13T06:53:47Z - symbol - AAPL - - diff --git a/examples/StockPlot/Classes/APYahooDataPuller.h b/examples/StockPlot/Classes/APYahooDataPuller.h deleted file mode 100644 index 0185dd8d0..000000000 --- a/examples/StockPlot/Classes/APYahooDataPuller.h +++ /dev/null @@ -1,35 +0,0 @@ -#import "NSDictionary+APFinancialData.h" - -@class APYahooDataPuller; - -typedef NSArray *CPTFinancialDataArray; - -@protocol APYahooDataPullerDelegate - -@optional - --(void)dataPullerFinancialDataDidChange:(APYahooDataPuller *)dp; --(void)dataPuller:(APYahooDataPuller *)dp downloadDidFailWithError:(NSError *)error; - -@end - -@interface APYahooDataPuller : NSObject - -@property (nonatomic, readwrite, weak) id delegate; -@property (nonatomic, readwrite, copy) NSString *symbol; -@property (nonatomic, readwrite, strong) NSDate *startDate; -@property (nonatomic, readwrite, strong) NSDate *endDate; -@property (nonatomic, readwrite, copy) NSString *targetSymbol; -@property (nonatomic, readwrite, strong) NSDate *targetStartDate; -@property (nonatomic, readwrite, strong) NSDate *targetEndDate; -@property (nonatomic, readonly, strong) CPTFinancialDataArray financialData; -@property (nonatomic, readonly, strong) NSDecimalNumber *overallHigh; -@property (nonatomic, readonly, strong) NSDecimalNumber *overallLow; -@property (nonatomic, readonly, assign) BOOL loadingData; -@property (nonatomic, readonly, assign) BOOL staleData; - --(instancetype)initWithTargetSymbol:(NSString *)aSymbol targetStartDate:(NSDate *)aStartDate targetEndDate:(NSDate *)anEndDate; --(void)fetchIfNeeded; --(void)cancelDownload; - -@end diff --git a/examples/StockPlot/Classes/APYahooDataPuller.m b/examples/StockPlot/Classes/APYahooDataPuller.m deleted file mode 100644 index a3b6a559a..000000000 --- a/examples/StockPlot/Classes/APYahooDataPuller.m +++ /dev/null @@ -1,360 +0,0 @@ -#import "APYahooDataPuller.h" -#import "NSDictionary+APFinancialData.h" - -@interface APYahooDataPuller() - -@property (nonatomic, readwrite, copy) NSString *csvString; - -@property (nonatomic, readwrite, strong) NSDecimalNumber *overallHigh; -@property (nonatomic, readwrite, strong) NSDecimalNumber *overallLow; -@property (nonatomic, readwrite, strong) CPTFinancialDataArray financialData; - -@property (nonatomic, readwrite, assign) BOOL loadingData; -@property (nonatomic, readwrite, strong) NSMutableData *receivedData; -@property (nonatomic, readwrite, strong) NSURLConnection *connection; - -NSTimeInterval timeIntervalForNumberOfWeeks(double numberOfWeeks); - -@end - -#pragma mark - - -NSTimeInterval timeIntervalForNumberOfWeeks(double numberOfWeeks) -{ - NSTimeInterval seconds = fabs(60.0 * 60.0 * 24.0 * 7.0 * numberOfWeeks); - - return seconds; -} - -@implementation APYahooDataPuller - -@synthesize symbol; -@synthesize startDate; -@synthesize endDate; -@synthesize targetStartDate; -@synthesize targetEndDate; -@synthesize targetSymbol; -@synthesize overallLow; -@synthesize overallHigh; -@synthesize csvString; -@synthesize financialData; - -@synthesize receivedData; -@synthesize connection; -@synthesize loadingData; -@dynamic staleData; - -@synthesize delegate; - -//convert any NSNumber in financial line to NSDecimalNumber --(CPTDictionary)sanitizedFinancialLine:(CPTDictionary)theFinancialLine -{ - CPTMutableDictionary aFinancialLine = [NSMutableDictionary dictionaryWithDictionary:theFinancialLine]; - - for ( id key in [aFinancialLine allKeys] ) { - id something = aFinancialLine[key]; - if ( [something respondsToSelector:@selector(decimalValue)] ) { - something = [NSDecimalNumber decimalNumberWithDecimal:[(NSNumber *)something decimalValue]]; - aFinancialLine[key] = something; - } - } - return [NSDictionary dictionaryWithDictionary:aFinancialLine]; -} - --(void)setFinancialData:(NSArray *)aFinancialData -{ - //NSLog(@"in -setFinancialData:, old value of financialData: %@, changed to: %@", financialData, aFinancialData); - - if ( financialData != aFinancialData ) { - NSMutableArray *mutableFinancialData = [aFinancialData mutableCopy]; - CPTDictionary financialLine = nil; - - NSUInteger count = mutableFinancialData.count; - - for ( NSUInteger i = 0; i < count; i++ ) { - financialLine = (CPTDictionary)mutableFinancialData[i]; - financialLine = [self sanitizedFinancialLine:financialLine]; - mutableFinancialData[i] = financialLine; - } - - financialData = [[NSArray alloc] initWithArray:mutableFinancialData]; - if ( 0 < financialData.count ) { - [self notifyFinancesChanged]; - } - } -} - --(CPTDictionary)plistRep -{ - CPTMutableDictionary rep = [NSMutableDictionary dictionaryWithCapacity:7]; - - rep[@"symbol"] = [self symbol]; - rep[@"startDate"] = [self startDate]; - rep[@"endDate"] = [self endDate]; - rep[@"overallHigh"] = [self overallHigh]; - rep[@"overallLow"] = [self overallLow]; - rep[@"financialData"] = [self financialData]; - - return [NSDictionary dictionaryWithDictionary:rep]; -} - --(BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag -{ - NSLog(@"writeToFile:%@", path); - BOOL success = [[self plistRep] writeToFile:path atomically:flag]; - return success; -} - --(instancetype)initWithDictionary:(CPTDictionary)aDict targetSymbol:(NSString *)aSymbol targetStartDate:(NSDate *)aStartDate targetEndDate:(NSDate *)anEndDate -{ - self = [super init]; - if ( self != nil ) { - self.symbol = aDict[@"symbol"]; - self.startDate = aDict[@"startDate"]; - self.overallLow = [NSDecimalNumber decimalNumberWithDecimal:[aDict[@"overallLow"] decimalValue]]; - self.overallHigh = [NSDecimalNumber decimalNumberWithDecimal:[aDict[@"overallHigh"] decimalValue]]; - self.endDate = aDict[@"endDate"]; - self.financialData = aDict[@"financialData"]; - - self.targetSymbol = aSymbol; - self.targetStartDate = aStartDate; - self.targetEndDate = anEndDate; - } - return self; -} - --(NSString *)pathForSymbol:(NSString *)aSymbol -{ - CPTStringArray paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = paths[0]; - NSString *docPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", aSymbol]]; - - return docPath; -} - --(NSString *)faultTolerantPathForSymbol:(NSString *)aSymbol -{ - NSString *docPath = [self pathForSymbol:aSymbol]; - - if ( ![[NSFileManager defaultManager] fileExistsAtPath:docPath] ) { - //if there isn't one in the user's documents directory, see if we ship with this data - docPath = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.plist", aSymbol]]; - } - return docPath; -} - -//Always returns *something* --(CPTDictionary)dictionaryForSymbol:(NSString *)aSymbol -{ - NSString *path = [self faultTolerantPathForSymbol:aSymbol]; - - CPTMutableDictionary localPlistDict = [NSMutableDictionary dictionaryWithContentsOfFile:path]; - - return localPlistDict; -} - --(instancetype)initWithTargetSymbol:(NSString *)aSymbol targetStartDate:(NSDate *)aStartDate targetEndDate:(NSDate *)anEndDate -{ - CPTDictionary cachedDictionary = [self dictionaryForSymbol:aSymbol]; - - if ( nil != cachedDictionary ) { - return [self initWithDictionary:cachedDictionary targetSymbol:aSymbol targetStartDate:aStartDate targetEndDate:anEndDate]; - } - - CPTMutableDictionary rep = [NSMutableDictionary dictionaryWithCapacity:7]; - rep[@"symbol"] = aSymbol; - rep[@"startDate"] = aStartDate; - rep[@"endDate"] = anEndDate; - rep[@"overallHigh"] = [NSDecimalNumber notANumber]; - rep[@"overallLow"] = [NSDecimalNumber notANumber]; - rep[@"financialData"] = @[]; - - return [self initWithDictionary:rep targetSymbol:aSymbol targetStartDate:aStartDate targetEndDate:anEndDate]; -} - --(instancetype)init -{ - NSTimeInterval secondsAgo = -timeIntervalForNumberOfWeeks(14.0); //12 weeks ago - NSDate *start = [NSDate dateWithTimeIntervalSinceNow:secondsAgo]; - - NSDate *end = [NSDate date]; - - return [self initWithTargetSymbol:@"AAPL" targetStartDate:start targetEndDate:end]; -} - --(void)dealloc -{ - delegate = nil; -} - -// http://www.goldb.org/ystockquote.html --(NSString *)URL -{ - unsigned int unitFlags = NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitYear; - - NSCalendar *gregorian = [[NSCalendar alloc] - initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - - NSDateComponents *compsStart = [gregorian components:unitFlags fromDate:self.targetStartDate]; - NSDateComponents *compsEnd = [gregorian components:unitFlags fromDate:self.targetEndDate]; - - NSString *url = [NSString stringWithFormat:@"http://ichart.yahoo.com/table.csv?s=%@&", [self targetSymbol]]; - - url = [url stringByAppendingFormat:@"a=%ld&", (long)[compsStart month] - 1]; - url = [url stringByAppendingFormat:@"b=%ld&", (long)[compsStart day]]; - url = [url stringByAppendingFormat:@"c=%ld&", (long)[compsStart year]]; - - url = [url stringByAppendingFormat:@"d=%ld&", (long)[compsEnd month] - 1]; - url = [url stringByAppendingFormat:@"e=%ld&", (long)[compsEnd day]]; - url = [url stringByAppendingFormat:@"f=%ld&", (long)[compsEnd year]]; - url = [url stringByAppendingString:@"g=d&"]; - - url = [url stringByAppendingString:@"ignore=.csv"]; - url = [url stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - return url; -} - --(void)notifyFinancesChanged -{ - id theDelegate = self.delegate; - - if ( [theDelegate respondsToSelector:@selector(dataPullerFinancialDataDidChange:)] ) { - [theDelegate performSelector:@selector(dataPullerFinancialDataDidChange:) withObject:self]; - } -} - -#pragma mark - -#pragma mark Downloading of data - --(BOOL)staleData -{ - NSTimeInterval twelveHours = 60.0 * 60.0 * 12.0; - - return 0 >= self.financialData.count || - ![[self targetSymbol] isEqualToString:[self symbol]] || - [[self targetStartDate] timeIntervalSinceDate:[self startDate]] > twelveHours || - [[self targetEndDate] timeIntervalSinceDate:[self endDate]] > twelveHours; -} - --(void)fetchIfNeeded -{ - if ( self.loadingData ) { - return; - } - - //Check to see if cached data is stale - if ( self.staleData ) { - self.loadingData = YES; - NSString *urlString = [self URL]; - NSLog(@"Fetching URL %@", urlString); - NSURL *url = [NSURL URLWithString:urlString]; - NSURLRequest *theRequest = [NSURLRequest requestWithURL:url - cachePolicy:NSURLRequestUseProtocolCachePolicy - timeoutInterval:60.0]; - - // create the connection with the request - // and start loading the data - self.connection = [NSURLConnection connectionWithRequest:theRequest delegate:self]; - if ( self.connection ) { - self.receivedData = [NSMutableData data]; - } - else { - self.loadingData = NO; - } - } -} - --(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data -{ - // append the new data to the receivedData - [self.receivedData appendData:data]; -} - --(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response -{ - // this method is called when the server has determined that it - // has enough information to create the NSURLResponse - // it can be called multiple times, for example in the case of a - // redirect, so each time we reset the data. - [self.receivedData setLength:0]; -} - --(void)cancelDownload -{ - if ( self.loadingData ) { - [self.connection cancel]; - self.loadingData = NO; - - self.receivedData = nil; - self.connection = nil; - } -} - --(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error -{ - self.loadingData = NO; - self.receivedData = nil; - self.connection = nil; - NSLog(@"err = %@", [error localizedDescription]); - self.connection = nil; - - id theDelegate = self.delegate; - if ( [theDelegate respondsToSelector:@selector(dataPuller:downloadDidFailWithError:)] ) { - [theDelegate performSelector:@selector(dataPuller:downloadDidFailWithError:) withObject:self withObject:error]; - } -} - --(void)connectionDidFinishLoading:(NSURLConnection *)connection -{ - self.loadingData = NO; - self.connection = nil; - - NSString *csv = [[NSString alloc] initWithData:self.receivedData encoding:NSUTF8StringEncoding]; - [self populateWithString:csv]; - - self.receivedData = nil; - [self writeToFile:[self pathForSymbol:self.symbol] atomically:YES]; -} - --(void)populateWithString:(NSString *)csv -{ - CPTStringArray csvLines = [csv componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]]; - - NSMutableArray *newFinancials = [NSMutableArray arrayWithCapacity:csvLines.count]; - NSDictionary *currentFinancial = nil; - NSString *line = nil; - - self.overallHigh = [NSDecimalNumber notANumber]; - self.overallLow = [NSDecimalNumber notANumber]; - - for ( NSUInteger i = 1; i < csvLines.count - 1; i++ ) { - line = (NSString *)csvLines[i]; - currentFinancial = [NSDictionary dictionaryWithCSVLine:line]; - [newFinancials addObject:currentFinancial]; - - NSDecimalNumber *high = currentFinancial[@"high"]; - NSDecimalNumber *low = currentFinancial[@"low"]; - - if ( [self.overallHigh isEqual:[NSDecimalNumber notANumber]] ) { - self.overallHigh = high; - } - - if ( [self.overallLow isEqual:[NSDecimalNumber notANumber]] ) { - self.overallLow = low; - } - - if ( [low compare:self.overallLow] == NSOrderedAscending ) { - self.overallLow = low; - } - if ( [high compare:self.overallHigh] == NSOrderedDescending ) { - self.overallHigh = high; - } - } - self.startDate = self.targetStartDate; - self.endDate = self.targetEndDate; - self.symbol = self.targetSymbol; - - [self setFinancialData:[NSArray arrayWithArray:newFinancials]]; -} - -@end diff --git a/examples/StockPlot/Classes/APYahooDataPullerGraph.h b/examples/StockPlot/Classes/APYahooDataPullerGraph.h deleted file mode 100644 index f47a2770e..000000000 --- a/examples/StockPlot/Classes/APYahooDataPullerGraph.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// APYahooDataPullerGraph.h -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import "APYahooDataPuller.h" -#import "CorePlot-CocoaTouch.h" -#import - -@interface APYahooDataPullerGraph : UIViewController - -@property (nonatomic, strong) IBOutlet CPTGraphHostingView *graphHost; -@property (nonatomic, strong) APYahooDataPuller *dataPuller; - -@end diff --git a/examples/StockPlot/Classes/APYahooDataPullerGraph.m b/examples/StockPlot/Classes/APYahooDataPullerGraph.m deleted file mode 100644 index c855ea68e..000000000 --- a/examples/StockPlot/Classes/APYahooDataPullerGraph.m +++ /dev/null @@ -1,170 +0,0 @@ -// -// APYahooDataPullerGraph.m -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import "APYahooDataPullerGraph.h" - -@interface APYahooDataPullerGraph() - -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; - -@end - -#pragma mark - - -@implementation APYahooDataPullerGraph - -@synthesize graphHost; -@synthesize dataPuller; -@synthesize graph; - --(void)reloadData -{ - if ( !self.graph ) { - CPTXYGraph *newGraph = [[CPTXYGraph alloc] initWithFrame:CGRectZero]; - CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; - [newGraph applyTheme:theme]; - self.graph = newGraph; - - newGraph.paddingTop = 30.0; - newGraph.paddingBottom = 30.0; - newGraph.paddingLeft = 50.0; - newGraph.paddingRight = 50.0; - - CPTScatterPlot *dataSourceLinePlot = [[CPTScatterPlot alloc] initWithFrame:newGraph.bounds]; - dataSourceLinePlot.identifier = @"Data Source Plot"; - - CPTMutableLineStyle *lineStyle = [dataSourceLinePlot.dataLineStyle mutableCopy]; - lineStyle.lineWidth = 1.0; - lineStyle.lineColor = [CPTColor redColor]; - dataSourceLinePlot.dataLineStyle = lineStyle; - - dataSourceLinePlot.dataSource = self; - [newGraph addPlot:dataSourceLinePlot]; - } - - CPTXYGraph *theGraph = self.graph; - self.graphHost.hostedGraph = theGraph; - - CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)theGraph.defaultPlotSpace; - - NSDecimalNumber *high = self.dataPuller.overallHigh; - NSDecimalNumber *low = self.dataPuller.overallLow; - NSDecimalNumber *length = [high decimalNumberBySubtracting:low]; - - //NSLog(@"high = %@, low = %@, length = %@", high, low, length); - plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(self.dataPuller.financialData.count)]; - plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:low length:length]; - // Axes - CPTXYAxisSet *axisSet = (CPTXYAxisSet *)theGraph.axisSet; - - CPTXYAxis *x = axisSet.xAxis; - x.majorIntervalLength = @10.0; - x.orthogonalPosition = @0.0; - x.minorTicksPerInterval = 1; - - CPTXYAxis *y = axisSet.yAxis; - NSDecimal six = CPTDecimalFromInteger(6); - y.majorIntervalLength = [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalDivide(length.decimalValue, six)]; - y.majorTickLineStyle = nil; - y.minorTicksPerInterval = 4; - y.minorTickLineStyle = nil; - y.orthogonalPosition = @0.0; - y.alternatingBandFills = @[[[CPTColor whiteColor] colorWithAlphaComponent:CPTFloat(0.1)], [NSNull null]]; - - [theGraph reloadData]; - - [[self navigationItem] setTitle:[self.dataPuller symbol]]; -} - --(void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; -} - -// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. --(void)viewDidLoad -{ - [super 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. - [super didReceiveMemoryWarning]; - - // Release any cached data, images, etc that aren't in use. -} - -#pragma mark - -#pragma mark Plot Data Source Methods - --(NSUInteger)numberOfRecords -{ - return self.dataPuller.financialData.count; -} - --(id)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index -{ - NSNumber *num = @0; - - if ( fieldEnum == CPTScatterPlotFieldX ) { - num = @(index + 1); - } - else if ( fieldEnum == CPTScatterPlotFieldY ) { - CPTFinancialDataArray financialData = self.dataPuller.financialData; - - CPTDictionary fData = financialData[[financialData count] - index - 1]; - num = fData[@"close"]; - NSAssert([num isMemberOfClass:[NSDecimalNumber class]], @"grrr"); - } - - return num; -} - --(void)dataPullerFinancialDataDidChange:(APYahooDataPuller *)dp -{ - [self reloadData]; -} - -#pragma mark accessors - --(void)setDataPuller:(APYahooDataPuller *)aDataPuller -{ - //NSLog(@"in -setDataPuller:, old value of dataPuller: %@, changed to: %@", dataPuller, aDataPuller); - - if ( dataPuller != aDataPuller ) { - dataPuller = aDataPuller; - [dataPuller setDelegate:self]; - [self reloadData]; - } -} - --(void)dealloc -{ - if ( dataPuller.delegate == self ) { - [dataPuller setDelegate:nil]; - } -} - --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot -{ - return [self numberOfRecords]; -} - -@end diff --git a/examples/StockPlot/Classes/APYahooDataPullerGraph.xib b/examples/StockPlot/Classes/APYahooDataPullerGraph.xib deleted file mode 100644 index 979259557..000000000 --- a/examples/StockPlot/Classes/APYahooDataPullerGraph.xib +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/Classes/NSDictionary+APFinancialData.h b/examples/StockPlot/Classes/NSDictionary+APFinancialData.h deleted file mode 100644 index 6ede21860..000000000 --- a/examples/StockPlot/Classes/NSDictionary+APFinancialData.h +++ /dev/null @@ -1,7 +0,0 @@ -#import "CorePlot-CocoaTouch.h" - -@interface NSDictionary(APFinancialData) - -+(CPTDictionary)dictionaryWithCSVLine:(NSString *)csvLine; - -@end diff --git a/examples/StockPlot/Classes/NSDictionary+APFinancialData.m b/examples/StockPlot/Classes/NSDictionary+APFinancialData.m deleted file mode 100644 index 355e1db9d..000000000 --- a/examples/StockPlot/Classes/NSDictionary+APFinancialData.m +++ /dev/null @@ -1,56 +0,0 @@ -#import "NSDictionary+APFinancialData.h" - -@interface NSDateFormatter(yahooCSVDateFormatter) - -+(NSDateFormatter *)yahooCSVDateFormatter; - -@end - -@implementation NSDateFormatter(yahooCSVDateFormatter) - -+(NSDateFormatter *)yahooCSVDateFormatter -{ - static NSDateFormatter *df = nil; - static dispatch_once_t onceToken = 0; - - dispatch_once(&onceToken, ^{ - df = [[NSDateFormatter alloc] init]; - [df setDateFormat:@"yyyy-MM-dd"]; - }); - - return df; -} - -@end - -@implementation NSDictionary(APFinancialData) - -+(CPTDictionary)dictionaryWithCSVLine:(NSString *)csvLine -{ - CPTStringArray csvChunks = [csvLine componentsSeparatedByString:@","]; - - CPTMutableDictionary csvDict = [NSMutableDictionary dictionaryWithCapacity:7]; - - // Date,Open,High,Low,Close,Volume,Adj Close - // 2009-06-08,143.82,144.23,139.43,143.85,33255400,143.85 - NSDate *theDate = [[NSDateFormatter yahooCSVDateFormatter] dateFromString:csvChunks[0]]; - - csvDict[@"date"] = theDate; - NSDecimalNumber *theOpen = [NSDecimalNumber decimalNumberWithString:csvChunks[1]]; - csvDict[@"open"] = theOpen; - NSDecimalNumber *theHigh = [NSDecimalNumber decimalNumberWithString:csvChunks[2]]; - csvDict[@"high"] = theHigh; - NSDecimalNumber *theLow = [NSDecimalNumber decimalNumberWithString:csvChunks[3]]; - csvDict[@"low"] = theLow; - NSDecimalNumber *theClose = [NSDecimalNumber decimalNumberWithString:csvChunks[4]]; - csvDict[@"close"] = theClose; - NSDecimalNumber *theVolume = [NSDecimalNumber decimalNumberWithString:csvChunks[5]]; - csvDict[@"volume"] = theVolume; - NSDecimalNumber *theAdjClose = [NSDecimalNumber decimalNumberWithString:csvChunks[6]]; - csvDict[@"adjClose"] = theAdjClose; - - //non-mutable autoreleased dict - return [NSDictionary dictionaryWithDictionary:csvDict]; -} - -@end diff --git a/examples/StockPlot/Classes/RootViewController.h b/examples/StockPlot/Classes/RootViewController.h deleted file mode 100644 index c1559f3ef..000000000 --- a/examples/StockPlot/Classes/RootViewController.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// RootViewController.h -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// -#import - -#import "APYahooDataPuller.h" -#import "APYahooDataPullerGraph.h" - -@interface RootViewController : UITableViewController - -@property (nonatomic, readonly, strong) CPTStringArray symbols; - --(void)addSymbol:(NSString *)aSymbol; - -@end diff --git a/examples/StockPlot/Classes/RootViewController.m b/examples/StockPlot/Classes/RootViewController.m deleted file mode 100644 index c2561bf62..000000000 --- a/examples/StockPlot/Classes/RootViewController.m +++ /dev/null @@ -1,319 +0,0 @@ -// -// RootViewController.m -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// - -#import "APYahooDataPuller.h" -#import "RootViewController.h" - -@interface RootViewController() - -@property (nonatomic, readwrite, strong) APYahooDataPullerGraph *graph; -@property (nonatomic, readwrite, strong) NSMutableArray *stocks; - -@end - -@implementation RootViewController - -@synthesize graph; -@synthesize stocks; -@dynamic symbols; - --(void)viewDidLoad -{ - [super viewDidLoad]; - self.stocks = [[NSMutableArray alloc] initWithCapacity:4]; - [self addSymbol:@"AAPL"]; - [self addSymbol:@"GOOG"]; - [self addSymbol:@"YHOO"]; - [self addSymbol:@"MSFT"]; - - // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - // self.navigationItem.rightBarButtonItem = self.editButtonItem; -} - --(void)didReceiveMemoryWarning -{ - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - - // Release any cached data, images, etc that aren't in use. -} - --(void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - [[self navigationItem] setTitle:@"Stocks"]; - //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 setDelegate:self]; - } -} - -#pragma mark Table view methods - --(void)inspectStock:(APYahooDataPuller *)aStock -{ - NSDecimalNumber *high = [aStock overallHigh]; - NSDecimalNumber *low = [aStock overallLow]; - - 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]; - [av show]; - } - else { - if ( nil == self.graph ) { - APYahooDataPullerGraph *aGraph = [[APYahooDataPullerGraph alloc] initWithNibName:@"APYahooDataPullerGraph" bundle:nil]; - self.graph = aGraph; - } - - [self.graph setDataPuller:aStock]; - [self.navigationController pushViewController:self.graph animated:YES]; - self.graph.view.frame = self.view.bounds; - } -} - -// Override to support row selection in the table view. --(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath -{ - APYahooDataPuller *dp = self.stocks[(NSUInteger)indexPath.row]; - - [self inspectStock:dp]; - [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; -} - --(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView -{ - return 1; -} - -// Customize the number of rows in the table view. --(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section -{ - return (NSInteger)self.stocks.count; -} - --(void)setupCell:(UITableViewCell *)cell forStockAtIndex:(NSUInteger)row -{ - APYahooDataPuller *dp = self.stocks[row]; - - [[cell textLabel] setText:[dp symbol]]; - - NSDateFormatter *df = [[NSDateFormatter alloc] init]; - [df setDateStyle:NSDateFormatterShortStyle]; - NSString *startString = @"(NA)"; - if ( [dp startDate] ) { - startString = [df stringFromDate:[dp startDate]]; - } - - NSString *endString = @"(NA)"; - if ( [dp endDate] ) { - endString = [df stringFromDate:[dp endDate]]; - } - - NSNumberFormatter *nf = [[NSNumberFormatter alloc] init]; - [nf setRoundingMode:NSNumberFormatterRoundHalfUp]; - [nf setDecimalSeparator:@"."]; - [nf setGroupingSeparator:@","]; - [nf setPositiveFormat:@"\u00A4###,##0.00"]; - [nf setNegativeFormat:@"(\u00A4###,##0.00)"]; - - NSString *overallLow = @"(NA)"; - if ( ![[NSDecimalNumber notANumber] isEqual:[dp overallLow]] ) { - overallLow = [nf stringFromNumber:[dp overallLow]]; - } - NSString *overallHigh = @"(NA)"; - if ( ![[NSDecimalNumber notANumber] isEqual:[dp overallHigh]] ) { - overallHigh = [nf stringFromNumber:[dp overallHigh]]; - } - - [[cell detailTextLabel] setText:[NSString stringWithFormat:@"%@ - %@; Low:%@ High:%@", startString, endString, overallLow, overallHigh]]; - - UIView *accessory = [cell accessoryView]; - if ( dp.loadingData ) { - if ( ![accessory isMemberOfClass:[UIActivityIndicatorView class]] ) { - accessory = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - [(UIActivityIndicatorView *)accessory setHidesWhenStopped : NO]; - [cell setAccessoryView:accessory]; - } - [(UIActivityIndicatorView *)accessory startAnimating]; - } - else { - if ( [accessory isMemberOfClass:[UIActivityIndicatorView class]] ) { - [(UIActivityIndicatorView *)accessory stopAnimating]; - } - if ( dp.staleData ) { - if ( ![accessory isMemberOfClass:[UIImageView class]] ) { - UIImage *caution = [UIImage imageNamed:@"caution.png"]; - accessory = [[UIImageView alloc] initWithImage:caution]; - [cell setAccessoryView:accessory]; -// CGRect frame = accessory.frame; -//#pragma unused (frame) - } - } - else { - [cell setAccessoryView:nil]; - } - } -} - -// Customize the appearance of table view cells. --(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath -{ - static NSString *CellIdentifier = @"UITableViewCellStyleSubtitle"; - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; - - if ( cell == nil ) { - cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; - } - - NSUInteger row = (NSUInteger)indexPath.row; - - [self setupCell:cell forStockAtIndex:row]; - - return cell; -} - --(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation -{ - self.graph.view.frame = self.view.bounds; -} - -#pragma mark - -#pragma mark accessors - --(CPTStringArray)symbols -{ - //NSLog(@"in -symbols, returned symbols = %@", symbols); - CPTMutableStringArray symbols = [NSMutableArray arrayWithCapacity:self.stocks.count]; - - for ( APYahooDataPuller *dp in self.stocks ) { - [symbols addObject:[dp symbol]]; - } - return [NSArray arrayWithArray:symbols]; -} - --(void)dataPuller:(APYahooDataPuller *)dp downloadDidFailWithError:(NSError *)error -{ - NSLog(@"dataPuller:%@ downloadDidFailWithError:%@", dp, error); - NSUInteger idx = [self.stocks indexOfObject:dp]; - NSInteger section = 0; - NSIndexPath *path = [NSIndexPath indexPathForRow:(NSInteger)idx inSection:section]; - UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path]; - [self setupCell:cell forStockAtIndex:idx]; -} - --(void)dataPullerFinancialDataDidChange:(APYahooDataPuller *)dp -{ - NSLog(@"dataPullerFinancialDataDidChange:%@", dp); - NSUInteger idx = [self.stocks indexOfObject:dp]; - NSInteger section = 0; - NSIndexPath *path = [NSIndexPath indexPathForRow:(NSInteger)idx inSection:section]; - UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:path]; - [self setupCell:cell forStockAtIndex:idx]; -} - --(void)addSymbol:(NSString *)aSymbol -{ - NSTimeInterval secondsAgo = -fabs(60.0 * 60.0 * 24.0 * 7.0 * 12.0); //12 weeks ago - NSDate *start = [NSDate dateWithTimeIntervalSinceNow:secondsAgo]; - NSDate *end = [NSDate date]; - - APYahooDataPuller *dp = [[APYahooDataPuller alloc] initWithTargetSymbol:aSymbol targetStartDate:start targetEndDate:end]; - - [[self stocks] addObject:dp]; - [dp fetchIfNeeded]; - [dp setDelegate:self]; - [[self tableView] reloadData]; //TODO: should reload whole thing -} - --(void)dealloc -{ - for ( APYahooDataPuller *dp in stocks ) { - if ( dp.delegate == self ) { - dp.delegate = nil; - } - } - stocks = nil; -} - -/* - * - (void)viewDidLoad { - * [super viewDidLoad]; - * - * // Uncomment the following line to display an Edit button in the navigation bar for this view controller. - * // self.navigationItem.rightBarButtonItem = self.editButtonItem; - * } - */ - -/* - * - (void)viewDidAppear:(BOOL)animated { - * [super viewDidAppear:animated]; - * } - */ - -/* - * - (void)viewWillDisappear:(BOOL)animated { - * [super viewWillDisappear:animated]; - * } - */ - -/* - * - (void)viewDidDisappear:(BOOL)animated { - * [super viewDidDisappear:animated]; - * } - */ - -/* - * // Override to support row selection in the table view. - * - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - * - * // Navigation logic may go here -- for example, create and push another view controller. - * // AnotherViewController *anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil]; - * // [self.navigationController pushViewController:anotherViewController animated:YES]; - * // [anotherViewController release]; - * } - */ - -/* - * // Override to support conditional editing of the table view. - * - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath { - * // Return NO if you do not want the specified item to be editable. - * return YES; - * } - */ - -/* - * // Override to support editing the table view. - * - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { - * - * if (editingStyle == UITableViewCellEditingStyleDelete) { - * // Delete the row from the data source. - * [tableView deleteRowsAtIndexPaths:@[indexPath] withRowAnimation:UITableViewRowAnimationFade]; - * } - * else if (editingStyle == UITableViewCellEditingStyleInsert) { - * // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view. - * } - * } - */ - -/* - * // Override to support rearranging the table view. - * - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath { - * } - */ - -/* - * // Override to support conditional rearranging of the table view. - * - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath { - * // Return NO if you do not want the item to be re-orderable. - * return YES; - * } - */ - -@end diff --git a/examples/StockPlot/Classes/StockPlotAppDelegate.h b/examples/StockPlot/Classes/StockPlotAppDelegate.h deleted file mode 100644 index 0a3b0badf..000000000 --- a/examples/StockPlot/Classes/StockPlotAppDelegate.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// StockPlotAppDelegate.h -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// - -@interface StockPlotAppDelegate : NSObject - -@property (nonatomic, strong) IBOutlet UIWindow *window; -@property (nonatomic, strong) IBOutlet UINavigationController *navigationController; - -@end diff --git a/examples/StockPlot/Classes/StockPlotAppDelegate.m b/examples/StockPlot/Classes/StockPlotAppDelegate.m deleted file mode 100644 index aed96ab66..000000000 --- a/examples/StockPlot/Classes/StockPlotAppDelegate.m +++ /dev/null @@ -1,36 +0,0 @@ -// -// StockPlotAppDelegate.m -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// - -#import "RootViewController.h" -#import "StockPlotAppDelegate.h" - -@implementation StockPlotAppDelegate - -@synthesize window; -@synthesize navigationController; - -#pragma mark - -#pragma mark Application lifecycle - --(void)applicationDidFinishLaunching:(UIApplication *)application -{ - [[self.navigationController navigationBar] setTintColor:[UIColor blackColor]]; - - self.window.rootViewController = self.navigationController; - [self.window makeKeyAndVisible]; -} - --(void)applicationWillTerminate:(UIApplication *)application -{ - // Save data if appropriate -} - -#pragma mark - -#pragma mark Memory management - -@end diff --git a/examples/StockPlot/GOOG.plist b/examples/StockPlot/GOOG.plist deleted file mode 100644 index 489ad37be..000000000 --- a/examples/StockPlot/GOOG.plist +++ /dev/null @@ -1,1107 +0,0 @@ - - - - - endDate - 2009-06-19T06:53:47Z - financialData - - - adjClose - 414.0600000000001 - close - 414.0600000000001 - date - 2009-06-18T04:00:00Z - high - 418.6899999999999 - low - 413 - open - 415.68 - volume - 3085200 - - - adjClose - 415.16 - close - 415.16 - date - 2009-06-17T04:00:00Z - high - 419.72 - low - 411.5600000000001 - open - 416.1899999999999 - volume - 3490100 - - - adjClose - 416 - close - 416 - date - 2009-06-16T04:00:00Z - high - 421.09 - low - 415.42 - open - 419.3100000000001 - volume - 3049700 - - - adjClose - 416.77 - close - 416.77 - date - 2009-06-15T04:00:00Z - high - 421.5 - low - 414 - open - 421.5 - volume - 3736900 - - - adjClose - 424.84 - close - 424.84 - date - 2009-06-12T04:00:00Z - high - 427.7 - low - 421.21 - open - 426.86 - volume - 2918400 - - - adjClose - 429 - close - 429 - date - 2009-06-11T04:00:00Z - high - 433.73 - low - 428.37 - open - 431.77 - volume - 2865200 - - - adjClose - 432.6 - close - 432.6 - date - 2009-06-10T04:00:00Z - high - 437.89 - low - 426.67 - open - 436.23 - volume - 3358900 - - - adjClose - 435.62 - close - 435.62 - date - 2009-06-09T04:00:00Z - high - 440.5 - low - 431.76 - open - 438.58 - volume - 3254900 - - - adjClose - 438.77 - close - 438.77 - date - 2009-06-08T04:00:00Z - high - 440.92 - low - 434.12 - open - 439.5 - volume - 3098700 - - - adjClose - 444.32 - close - 444.32 - date - 2009-06-05T04:00:00Z - high - 447.34 - low - 439.46 - open - 445.07 - volume - 3680800 - - - adjClose - 440.28 - close - 440.28 - date - 2009-06-04T04:00:00Z - high - 441.24 - low - 434.5 - open - 435.3 - volume - 3638100 - - - adjClose - 431.65 - close - 431.65 - date - 2009-06-03T04:00:00Z - high - 432.46 - low - 424 - open - 426 - volume - 3532800 - - - adjClose - 428.4 - close - 428.4 - date - 2009-06-02T04:00:00Z - high - 429.96 - low - 423.4 - open - 426.25 - volume - 2623600 - - - adjClose - 426.5600000000001 - close - 426.5600000000001 - date - 2009-06-01T04:00:00Z - high - 429.6 - low - 418.53 - open - 418.73 - volume - 3322400 - - - adjClose - 417.23 - close - 417.23 - date - 2009-05-29T04:00:00Z - high - 417.23 - low - 410.7 - open - 412.11 - volume - 2648200 - - - adjClose - 410.4 - close - 410.4 - date - 2009-05-28T04:00:00Z - high - 411.62 - low - 404.61 - open - 408.68 - volume - 2668800 - - - adjClose - 405.56 - close - 405.56 - date - 2009-05-27T04:00:00Z - high - 411.86 - low - 404.81 - open - 405.64 - volume - 3034300 - - - adjClose - 404.36 - close - 404.36 - date - 2009-05-26T04:00:00Z - high - 405 - low - 390 - open - 391.95 - volume - 3104500 - - - adjClose - 393.5 - close - 393.5 - date - 2009-05-22T04:00:00Z - high - 398.65 - low - 392 - open - 396.66 - volume - 1718600 - - - adjClose - 396.5 - close - 396.5 - date - 2009-05-21T04:00:00Z - high - 402.84 - low - 393.84 - open - 396.3 - volume - 2719800 - - - adjClose - 397.18 - close - 397.18 - date - 2009-05-20T04:00:00Z - high - 405.67 - low - 395 - open - 402.09 - volume - 2284000 - - - adjClose - 398.88 - close - 398.88 - date - 2009-05-19T04:00:00Z - high - 401.64 - low - 393 - open - 396.1 - volume - 2837500 - - - adjClose - 396.84 - close - 396.84 - date - 2009-05-18T04:00:00Z - high - 397.31 - low - 385.4 - open - 394.73 - volume - 3351700 - - - adjClose - 390 - close - 390 - date - 2009-05-15T04:00:00Z - high - 394.11 - low - 389.09 - open - 391.1 - volume - 3008700 - - - adjClose - 387.5 - close - 387.5 - date - 2009-05-14T04:00:00Z - high - 392.21 - low - 384.69 - open - 388.8 - volume - 2937000 - - - adjClose - 389.54 - close - 389.54 - date - 2009-05-13T04:00:00Z - high - 396.39 - low - 388.35 - open - 394.09 - volume - 2842800 - - - adjClose - 399.01 - close - 399.01 - date - 2009-05-12T04:00:00Z - high - 410.99 - low - 395.11 - open - 410.01 - volume - 3790800 - - - adjClose - 407.98 - close - 407.98 - date - 2009-05-11T04:00:00Z - high - 412 - low - 401.2 - open - 402.8 - volume - 2559300 - - - adjClose - 407.33 - close - 407.33 - date - 2009-05-08T04:00:00Z - high - 410.13 - low - 395 - open - 402.85 - volume - 3865100 - - - adjClose - 396.61 - close - 396.61 - date - 2009-05-07T04:00:00Z - high - 404.99 - low - 392.5 - open - 404.1 - volume - 2999800 - - - adjClose - 403.47 - close - 403.47 - date - 2009-05-06T04:00:00Z - high - 408.28 - low - 401 - open - 406.79 - volume - 2632900 - - - adjClose - 402.99 - close - 402.99 - date - 2009-05-05T04:00:00Z - high - 405 - low - 397.25 - open - 399.98 - volume - 2400800 - - - adjClose - 401.98 - close - 401.98 - date - 2009-05-04T04:00:00Z - high - 402.4 - low - 394.79 - open - 398.17 - volume - 3203000 - - - adjClose - 393.69 - close - 393.69 - date - 2009-05-01T04:00:00Z - high - 397.59 - low - 391.55 - open - 395.03 - volume - 2427700 - - - adjClose - 395.97 - close - 395.97 - date - 2009-04-30T04:00:00Z - high - 403.75 - low - 394.8 - open - 395.76 - volume - 4355700 - - - adjClose - 391.47 - close - 391.47 - date - 2009-04-29T04:00:00Z - high - 394.97 - low - 385.83 - open - 385.97 - volume - 3610000 - - - adjClose - 383.71 - close - 383.71 - date - 2009-04-28T04:00:00Z - high - 389.05 - low - 381.54 - open - 383.75 - volume - 2943600 - - - adjClose - 385.95 - close - 385.95 - date - 2009-04-27T04:00:00Z - high - 389.49 - low - 382.75 - open - 384.34 - volume - 2290600 - - - adjClose - 389.49 - close - 389.49 - date - 2009-04-24T04:00:00Z - high - 393.18 - low - 380.5 - open - 386.05 - volume - 3385400 - - - adjClose - 384.69 - close - 384.69 - date - 2009-04-23T04:00:00Z - high - 389.75 - low - 381.11 - open - 387.51 - volume - 2609000 - - - adjClose - 383.86 - close - 383.86 - date - 2009-04-22T04:00:00Z - high - 390 - low - 379.01 - open - 381.75 - volume - 3501800 - - - adjClose - 381.47 - close - 381.47 - date - 2009-04-21T04:00:00Z - high - 384.3 - low - 376.1 - open - 376.17 - volume - 3695400 - - - adjClose - 379.3 - close - 379.3 - date - 2009-04-20T04:00:00Z - high - 390.65 - low - 375.89 - open - 386.15 - volume - 4428900 - - - adjClose - 392.24 - close - 392.24 - date - 2009-04-17T04:00:00Z - high - 399.82 - low - 384.81 - open - 386.02 - volume - 10730800 - - - adjClose - 388.74 - close - 388.74 - date - 2009-04-16T04:00:00Z - high - 392.9 - low - 381.02 - open - 381.5 - volume - 10185100 - - - adjClose - 379.5 - close - 379.5 - date - 2009-04-15T04:00:00Z - high - 381.06 - low - 364.16 - open - 367.1 - volume - 4930700 - - - adjClose - 368.91 - close - 368.91 - date - 2009-04-14T04:00:00Z - high - 376.99 - low - 365.6 - open - 376.94 - volume - 3428600 - - - adjClose - 378.11 - close - 378.11 - date - 2009-04-13T04:00:00Z - high - 379.1 - low - 370.3 - open - 371.33 - volume - 3050100 - - - adjClose - 372.5 - close - 372.5 - date - 2009-04-09T04:00:00Z - high - 374.35 - low - 366.25 - open - 369.5 - volume - 3382600 - - - adjClose - 362 - close - 362 - date - 2009-04-08T04:00:00Z - high - 365 - low - 356.21 - open - 363.5 - volume - 2765200 - - - adjClose - 358.65 - close - 358.65 - date - 2009-04-07T04:00:00Z - high - 363.75 - low - 355.31 - open - 362.6 - volume - 3680100 - - - adjClose - 368.24 - close - 368.24 - date - 2009-04-06T04:00:00Z - high - 369.82 - low - 361.4 - open - 367 - volume - 3280300 - - - adjClose - 369.78 - close - 369.78 - date - 2009-04-03T04:00:00Z - high - 371.72 - low - 358 - open - 364.5 - volume - 3789800 - - - adjClose - 362.5 - close - 362.5 - date - 2009-04-02T04:00:00Z - high - 369.76 - low - 360.32 - open - 363.31 - volume - 4488000 - - - adjClose - 354.09 - close - 354.09 - date - 2009-04-01T04:00:00Z - high - 355.24 - low - 340.61 - open - 343.78 - volume - 3301200 - - - adjClose - 348.06 - close - 348.06 - date - 2009-03-31T04:00:00Z - high - 353.51 - low - 346.18 - open - 348.93 - volume - 3655300 - - - adjClose - 342.69 - close - 342.69 - date - 2009-03-30T04:00:00Z - high - 343.81 - low - 336.05 - open - 342.55 - volume - 3094100 - - - adjClose - 347.7 - close - 347.7 - date - 2009-03-27T04:00:00Z - high - 352 - low - 345.47 - open - 350 - volume - 3322800 - - - adjClose - 353.29 - close - 353.29 - date - 2009-03-26T04:00:00Z - high - 359.16 - low - 348.5 - open - 353.13 - volume - 6003300 - - - adjClose - 344.07 - close - 344.07 - date - 2009-03-25T04:00:00Z - high - 351.34 - low - 336.25 - open - 350.4 - volume - 4336300 - - - adjClose - 347.17 - close - 347.17 - date - 2009-03-24T04:00:00Z - high - 353.84 - low - 344 - open - 346.5 - volume - 3820000 - - - adjClose - 348.6 - close - 348.6 - date - 2009-03-23T04:00:00Z - high - 349.45 - low - 333.03 - open - 333.56 - volume - 4271500 - - - adjClose - 330.16 - close - 330.16 - date - 2009-03-20T04:00:00Z - high - 332.99 - low - 326.34 - open - 330.3 - volume - 4737900 - - - adjClose - 329.94 - close - 329.94 - date - 2009-03-19T04:00:00Z - high - 336 - low - 327.38 - open - 331.68 - volume - 4111200 - - - adjClose - 333.1 - close - 333.1 - date - 2009-03-18T04:00:00Z - high - 340 - low - 328.05 - open - 334.81 - volume - 5012200 - - - adjClose - 335.34 - close - 335.34 - date - 2009-03-17T04:00:00Z - high - 335.34 - low - 319.09 - open - 320.18 - volume - 4712500 - - - adjClose - 319.69 - close - 319.69 - date - 2009-03-16T04:00:00Z - high - 329.73 - low - 318.59 - open - 325.99 - volume - 4946800 - - - adjClose - 324.42 - close - 324.42 - date - 2009-03-13T04:00:00Z - high - 327.46 - low - 319.03 - open - 326.1 - volume - 3906400 - - - overallHigh - 447.34 - overallLow - 318.59 - startDate - 2009-03-13T06:53:47Z - symbol - GOOG - - diff --git a/examples/StockPlot/Launch Screen.xib b/examples/StockPlot/Launch Screen.xib deleted file mode 100644 index a4454db08..000000000 --- a/examples/StockPlot/Launch Screen.xib +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/MSFT.plist b/examples/StockPlot/MSFT.plist deleted file mode 100644 index 5564f546f..000000000 --- a/examples/StockPlot/MSFT.plist +++ /dev/null @@ -1,1107 +0,0 @@ - - - - - endDate - 2009-06-19T06:53:47Z - financialData - - - adjClose - 23.5 - close - 23.5 - date - 2009-06-18T04:00:00Z - high - 23.69 - low - 23.3 - open - 23.62 - volume - 58825800 - - - adjClose - 23.68 - close - 23.68 - date - 2009-06-17T04:00:00Z - high - 23.82 - low - 23.17 - open - 23.5 - volume - 86463700 - - - adjClose - 23.45 - close - 23.45 - date - 2009-06-16T04:00:00Z - high - 24.11 - low - 23.44 - open - 23.47 - volume - 105284900 - - - adjClose - 23.42 - close - 23.42 - date - 2009-06-15T04:00:00Z - high - 23.54 - low - 23.02 - open - 23.23 - volume - 69074500 - - - adjClose - 23.33 - close - 23.33 - date - 2009-06-12T04:00:00Z - high - 23.38 - low - 22.74 - open - 22.9 - volume - 50951800 - - - adjClose - 22.83 - close - 22.83 - date - 2009-06-11T04:00:00Z - high - 23.26 - low - 22.57 - open - 22.59 - volume - 65124600 - - - adjClose - 22.55 - close - 22.55 - date - 2009-06-10T04:00:00Z - high - 22.62 - low - 22.12 - open - 22.17 - volume - 61202600 - - - adjClose - 22.08 - close - 22.08 - date - 2009-06-09T04:00:00Z - high - 22.32 - low - 21.88 - open - 22.06 - volume - 50852100 - - - adjClose - 22.05 - close - 22.05 - date - 2009-06-08T04:00:00Z - high - 22.32 - low - 21.63 - open - 21.98 - volume - 49000600 - - - adjClose - 22.14 - close - 22.14 - date - 2009-06-05T04:00:00Z - high - 22.31 - low - 21.81 - open - 21.96 - volume - 59579200 - - - adjClose - 21.83 - close - 21.83 - date - 2009-06-04T04:00:00Z - high - 21.9 - low - 21.58 - open - 21.77 - volume - 42330000 - - - adjClose - 21.73 - close - 21.73 - date - 2009-06-03T04:00:00Z - high - 21.76 - low - 21.29 - open - 21.31 - volume - 56039600 - - - adjClose - 21.4 - close - 21.4 - date - 2009-06-02T04:00:00Z - high - 21.98 - low - 21.2 - open - 21.36 - volume - 48935700 - - - adjClose - 21.4 - close - 21.4 - date - 2009-06-01T04:00:00Z - high - 21.5 - low - 20.86 - open - 21 - volume - 57317100 - - - adjClose - 20.89 - close - 20.89 - date - 2009-05-29T04:00:00Z - high - 20.94 - low - 20.3 - open - 20.56 - volume - 46134900 - - - adjClose - 20.45 - close - 20.45 - date - 2009-05-28T04:00:00Z - high - 20.63 - low - 20.05 - open - 20.32 - volume - 45480800 - - - adjClose - 20.13 - close - 20.13 - date - 2009-05-27T04:00:00Z - high - 20.6 - low - 20.07 - open - 20.25 - volume - 42892900 - - - adjClose - 20.34 - close - 20.34 - date - 2009-05-26T04:00:00Z - high - 20.45 - low - 19.45 - open - 19.54 - volume - 44991700 - - - adjClose - 19.75 - close - 19.75 - date - 2009-05-22T04:00:00Z - high - 20.17 - low - 19.47 - open - 19.93 - volume - 37318700 - - - adjClose - 19.82 - close - 19.82 - date - 2009-05-21T04:00:00Z - high - 20.23 - low - 19.51 - open - 20.14 - volume - 58232800 - - - adjClose - 20.38 - close - 20.38 - date - 2009-05-20T04:00:00Z - high - 20.69 - low - 20.22 - open - 20.41 - volume - 47450700 - - - adjClose - 20.31 - close - 20.31 - date - 2009-05-19T04:00:00Z - high - 20.74 - low - 20.25 - open - 20.51 - volume - 51368300 - - - adjClose - 20.47 - close - 20.6 - date - 2009-05-18T04:00:00Z - high - 20.6 - low - 20.24 - open - 20.36 - volume - 46073800 - - - adjClose - 20.09 - close - 20.22 - date - 2009-05-15T04:00:00Z - high - 20.5 - low - 19.98 - open - 20.13 - volume - 61289900 - - - adjClose - 19.93 - close - 20.06 - date - 2009-05-14T04:00:00Z - high - 20.23 - low - 19.8 - open - 19.83 - volume - 54539500 - - - adjClose - 19.63 - close - 19.75 - date - 2009-05-13T04:00:00Z - high - 20 - low - 19.67 - open - 19.92 - volume - 49281700 - - - adjClose - 19.76 - close - 19.89 - date - 2009-05-12T04:00:00Z - high - 20.06 - low - 19.47 - open - 19.51 - volume - 71966800 - - - adjClose - 19.2 - close - 19.32 - date - 2009-05-11T04:00:00Z - high - 19.73 - low - 19.01 - open - 19.2 - volume - 63762600 - - - adjClose - 19.3 - close - 19.42 - date - 2009-05-08T04:00:00Z - high - 19.64 - low - 19.14 - open - 19.46 - volume - 67597600 - - - adjClose - 19.2 - close - 19.32 - date - 2009-05-07T04:00:00Z - high - 19.99 - low - 19.14 - open - 19.96 - volume - 68727200 - - - adjClose - 19.67 - close - 19.79 - date - 2009-05-06T04:00:00Z - high - 20.07 - low - 19.61 - open - 20.06 - volume - 59639100 - - - adjClose - 19.67 - close - 19.79 - date - 2009-05-05T04:00:00Z - high - 20.24 - low - 19.64 - open - 20.14 - volume - 66835500 - - - adjClose - 20.06 - close - 20.19 - date - 2009-05-04T04:00:00Z - high - 20.4 - low - 19.98 - open - 20.37 - volume - 54313400 - - - adjClose - 20.11 - close - 20.24 - date - 2009-05-01T04:00:00Z - high - 20.35 - low - 19.86 - open - 20.19 - volume - 63224500 - - - adjClose - 20.13 - close - 20.26 - date - 2009-04-30T04:00:00Z - high - 21.1 - low - 20.01 - open - 20.6 - volume - 87439900 - - - adjClose - 20.12 - close - 20.25 - date - 2009-04-29T04:00:00Z - high - 20.89 - low - 20.06 - open - 20.11 - volume - 79301600 - - - adjClose - 19.8 - close - 19.93 - date - 2009-04-28T04:00:00Z - high - 20.27 - low - 19.79 - open - 20.25 - volume - 76685200 - - - adjClose - 20.27 - close - 20.4 - date - 2009-04-27T04:00:00Z - high - 20.82 - low - 20.28 - open - 20.55 - volume - 68219600 - - - adjClose - 20.78 - close - 20.91 - date - 2009-04-24T04:00:00Z - high - 21.2 - low - 19.5 - open - 19.82 - volume - 168478500 - - - adjClose - 18.8 - close - 18.92 - date - 2009-04-23T04:00:00Z - high - 18.94 - low - 18.47 - open - 18.92 - volume - 86116300 - - - adjClose - 18.66 - close - 18.78 - date - 2009-04-22T04:00:00Z - high - 19.19 - low - 18.7 - open - 18.76 - volume - 59401000 - - - adjClose - 18.85 - close - 18.97 - date - 2009-04-21T04:00:00Z - high - 19.08 - low - 18.57 - open - 18.59 - volume - 60928300 - - - adjClose - 18.49 - close - 18.61 - date - 2009-04-20T04:00:00Z - high - 18.95 - low - 18.57 - open - 18.89 - volume - 62937200 - - - adjClose - 19.08 - close - 19.2 - date - 2009-04-17T04:00:00Z - high - 19.69 - low - 19 - open - 19.69 - volume - 61398500 - - - adjClose - 19.64 - close - 19.76 - date - 2009-04-16T04:00:00Z - high - 19.78 - low - 18.99 - open - 19.16 - volume - 67688700 - - - adjClose - 18.71 - close - 18.83 - date - 2009-04-15T04:00:00Z - high - 19.25 - low - 18.51 - open - 19.21 - volume - 72725500 - - - adjClose - 19.23 - close - 19.35 - date - 2009-04-14T04:00:00Z - high - 19.55 - low - 19 - open - 19.44 - volume - 63796300 - - - adjClose - 19.47 - close - 19.59 - date - 2009-04-13T04:00:00Z - high - 19.85 - low - 19.37 - open - 19.69 - volume - 44444700 - - - adjClose - 19.55 - close - 19.67 - date - 2009-04-09T04:00:00Z - high - 19.7 - low - 19.22 - open - 19.45 - volume - 55759600 - - - adjClose - 19.07 - close - 19.19 - date - 2009-04-08T04:00:00Z - high - 19.62 - low - 18.96 - open - 18.97 - volume - 56408900 - - - adjClose - 18.64 - close - 18.76 - date - 2009-04-07T04:00:00Z - high - 19.14 - low - 18.63 - open - 18.76 - volume - 65815200 - - - adjClose - 18.64 - close - 18.76 - date - 2009-04-06T04:00:00Z - high - 18.76 - low - 18.27 - open - 18.54 - volume - 47476100 - - - adjClose - 18.63 - close - 18.75 - date - 2009-04-03T04:00:00Z - high - 19.15 - low - 18.43 - open - 19.13 - volume - 81858400 - - - adjClose - 19.17 - close - 19.29 - date - 2009-04-02T04:00:00Z - high - 19.89 - low - 19 - open - 19.5 - volume - 99082300 - - - adjClose - 19.19 - close - 19.31 - date - 2009-04-01T04:00:00Z - high - 19.36 - low - 18.18 - open - 18.23 - volume - 96438900 - - - adjClose - 18.25 - close - 18.37 - date - 2009-03-31T04:00:00Z - high - 18.79 - low - 17.78 - open - 17.83 - volume - 92095500 - - - adjClose - 17.37 - close - 17.48 - date - 2009-03-30T04:00:00Z - high - 17.76 - low - 17.27 - open - 17.74 - volume - 49633000 - - - adjClose - 18.02 - close - 18.13 - date - 2009-03-27T04:00:00Z - high - 18.62 - low - 18.05 - open - 18.54 - volume - 47670400 - - - adjClose - 18.71 - close - 18.83 - date - 2009-03-26T04:00:00Z - high - 18.88 - low - 18.12 - open - 18.17 - volume - 63775100 - - - adjClose - 17.77 - close - 17.88 - date - 2009-03-25T04:00:00Z - high - 18.31 - low - 17.52 - open - 17.98 - volume - 73927100 - - - adjClose - 17.82 - close - 17.93 - date - 2009-03-24T04:00:00Z - high - 18.21 - low - 17.84 - open - 18.04 - volume - 50044100 - - - adjClose - 18.21 - close - 18.33 - date - 2009-03-23T04:00:00Z - high - 18.59 - low - 17.31 - open - 17.37 - volume - 71600000 - - - adjClose - 16.95 - close - 17.06 - date - 2009-03-20T04:00:00Z - high - 17.65 - low - 16.88 - open - 17.32 - volume - 81725500 - - - adjClose - 17.03 - close - 17.14 - date - 2009-03-19T04:00:00Z - high - 17.45 - low - 16.92 - open - 17.37 - volume - 58994600 - - - adjClose - 16.85 - close - 16.96 - date - 2009-03-18T04:00:00Z - high - 17.22 - low - 16.6 - open - 17.03 - volume - 70710700 - - - adjClose - 16.79 - close - 16.9 - date - 2009-03-17T04:00:00Z - high - 16.9 - low - 16.26 - open - 16.32 - volume - 62481000 - - - adjClose - 16.15 - close - 16.25 - date - 2009-03-16T04:00:00Z - high - 16.96 - low - 16.24 - open - 16.82 - volume - 67028900 - - - adjClose - 16.54 - close - 16.65 - date - 2009-03-13T04:00:00Z - high - 17.05 - low - 16.18 - open - 16.98 - volume - 82965800 - - - overallHigh - 24.11 - overallLow - 16.18 - startDate - 2009-03-13T06:53:47Z - symbol - MSFT - - diff --git a/examples/StockPlot/MainWindow.xib b/examples/StockPlot/MainWindow.xib deleted file mode 100644 index ddc52b78a..000000000 --- a/examples/StockPlot/MainWindow.xib +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/RootViewController.xib b/examples/StockPlot/RootViewController.xib deleted file mode 100644 index 046950821..000000000 --- a/examples/StockPlot/RootViewController.xib +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/examples/StockPlot/StockPlot-Info.plist b/examples/StockPlot/StockPlot-Info.plist deleted file mode 100644 index 1d8d9b7be..000000000 --- a/examples/StockPlot/StockPlot-Info.plist +++ /dev/null @@ -1,41 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleDisplayName - ${PRODUCT_NAME} - CFBundleExecutable - ${EXECUTABLE_NAME} - CFBundleIcons~ipad - - CFBundleIdentifier - $(PRODUCT_BUNDLE_IDENTIFIER) - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - ${PRODUCT_NAME} - CFBundlePackageType - APPL - CFBundleSignature - ???? - CFBundleVersion - 1.0 - LSRequiresIPhoneOS - - NSMainNibFile - MainWindow - UILaunchStoryboardName - Launch Screen - UIStatusBarStyle - UIStatusBarStyleDefault - UISupportedInterfaceOrientations - - UIInterfaceOrientationPortrait - UIInterfaceOrientationLandscapeLeft - UIInterfaceOrientationLandscapeRight - UIInterfaceOrientationPortraitUpsideDown - - - diff --git a/examples/StockPlot/StockPlot.png b/examples/StockPlot/StockPlot.png deleted file mode 100644 index 8c1c5ca30..000000000 Binary files a/examples/StockPlot/StockPlot.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot.xcodeproj/project.pbxproj b/examples/StockPlot/StockPlot.xcodeproj/project.pbxproj deleted file mode 100644 index 759fa8d7b..000000000 --- a/examples/StockPlot/StockPlot.xcodeproj/project.pbxproj +++ /dev/null @@ -1,470 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 47; - objects = { - -/* Begin PBXBuildFile section */ - 1D3623260D0F684500981E51 /* StockPlotAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* StockPlotAppDelegate.m */; }; - 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */; }; - 2899E5600DE3E45000AC0155 /* RootViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 2899E55F0DE3E45000AC0155 /* RootViewController.xib */; }; - 28AD73600D9D9599002E5188 /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 28AD735F0D9D9599002E5188 /* MainWindow.xib */; }; - 28C286E10D94DF7D0034E888 /* RootViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 28C286E00D94DF7D0034E888 /* RootViewController.m */; }; - AB0363AA0FEF3681007B09A9 /* YHOO.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA6090FEB6DAA008DB04A /* YHOO.plist */; }; - AB0363AB0FEF3684007B09A9 /* MSFT.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA60A0FEB6DAA008DB04A /* MSFT.plist */; }; - AB0363AC0FEF3687007B09A9 /* GOOG.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA60B0FEB6DAA008DB04A /* GOOG.plist */; }; - AB0363AD0FEF368A007B09A9 /* AAPL.plist in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA60C0FEB6DAA008DB04A /* AAPL.plist */; }; - AB0364770FEF4603007B09A9 /* caution.png in Resources */ = {isa = PBXBuildFile; fileRef = AB0364760FEF4603007B09A9 /* caution.png */; }; - AB4913C80FECC2B8008A08AB /* APYahooDataPuller.m in Sources */ = {isa = PBXBuildFile; fileRef = AB4913C60FECC2B8008A08AB /* APYahooDataPuller.m */; }; - AB4913C90FECC2B8008A08AB /* NSDictionary+APFinancialData.m in Sources */ = {isa = PBXBuildFile; fileRef = AB4913C70FECC2B8008A08AB /* NSDictionary+APFinancialData.m */; }; - AB6FA4A40FEB579B008DB04A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = AB6FA4A30FEB579B008DB04A /* QuartzCore.framework */; }; - AB6FA5590FEB6235008DB04A /* APYahooDataPullerGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = AB6FA5570FEB6235008DB04A /* APYahooDataPullerGraph.m */; }; - AB6FA55A0FEB6235008DB04A /* APYahooDataPullerGraph.xib in Resources */ = {isa = PBXBuildFile; fileRef = AB6FA5580FEB6235008DB04A /* APYahooDataPullerGraph.xib */; }; - C36157E919D79AAC0036ACDA /* Launch Screen.xib in Resources */ = {isa = PBXBuildFile; fileRef = C36157E819D79AAC0036ACDA /* Launch Screen.xib */; }; - C3CD284817DE9D1F008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD284717DE9D1F008EED1E /* Accelerate.framework */; }; - C3D3937019FD6CBF00148319 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = C3D3936F19FD6CBF00148319 /* Images.xcassets */; }; - C3D414DF1A7D84CC00B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C3D414DC1A7D84BF00B6F5D6 /* libCorePlot-CocoaTouch.a */; }; -/* End PBXBuildFile section */ - -/* Begin PBXContainerItemProxy section */ - C3D414D31A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 8DC2EF5B0486A6940098B216; - remoteInfo = CorePlot; - }; - C3D414D51A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = 0730F600109492D800E95162; - remoteInfo = UnitTests; - }; - C3D414D71A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09781A46185200D45436; - remoteInfo = CorePlot_iOS; - }; - C3D414D91A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09821A46185300D45436; - remoteInfo = CorePlot_iOSTests; - }; - C3D414DB1A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09BA1A4619A900D45436; - remoteInfo = "CorePlot-CocoaTouch"; - }; - C3D414DD1A7D84BF00B6F5D6 /* PBXContainerItemProxy */ = { - isa = PBXContainerItemProxy; - containerPortal = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - proxyType = 2; - remoteGlobalIDString = C38A09C41A4619A900D45436; - remoteInfo = "CorePlot-CocoaTouchTests"; - }; -/* End PBXContainerItemProxy section */ - -/* Begin PBXFileReference section */ - 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1D3623240D0F684500981E51 /* StockPlotAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StockPlotAppDelegate.h; sourceTree = ""; }; - 1D3623250D0F684500981E51 /* StockPlotAppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StockPlotAppDelegate.m; sourceTree = ""; }; - 1D6058910D05DD3D006BFB54 /* StockPlot.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = StockPlot.app; sourceTree = BUILT_PRODUCTS_DIR; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - 2899E55F0DE3E45000AC0155 /* RootViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = RootViewController.xib; sourceTree = ""; }; - 28A0AAE50D9B0CCF005BE974 /* StockPlot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StockPlot_Prefix.pch; sourceTree = ""; }; - 28AD735F0D9D9599002E5188 /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = ""; }; - 28C286DF0D94DF7D0034E888 /* RootViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RootViewController.h; sourceTree = ""; }; - 28C286E00D94DF7D0034E888 /* RootViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RootViewController.m; sourceTree = ""; }; - 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; - 8D1107310486CEB800E47090 /* StockPlot-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "StockPlot-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; - AB0364760FEF4603007B09A9 /* caution.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = caution.png; sourceTree = SOURCE_ROOT; }; - AB4913C50FECC2B8008A08AB /* APYahooDataPuller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = APYahooDataPuller.h; path = Classes/APYahooDataPuller.h; sourceTree = SOURCE_ROOT; }; - AB4913C60FECC2B8008A08AB /* APYahooDataPuller.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = APYahooDataPuller.m; path = Classes/APYahooDataPuller.m; sourceTree = SOURCE_ROOT; }; - AB4913C70FECC2B8008A08AB /* NSDictionary+APFinancialData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSDictionary+APFinancialData.m"; path = "Classes/NSDictionary+APFinancialData.m"; sourceTree = SOURCE_ROOT; }; - AB6FA4A30FEB579B008DB04A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - AB6FA4DE0FEB59DB008DB04A /* NSDictionary+APFinancialData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSDictionary+APFinancialData.h"; sourceTree = ""; }; - AB6FA5560FEB6235008DB04A /* APYahooDataPullerGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = APYahooDataPullerGraph.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - AB6FA5570FEB6235008DB04A /* APYahooDataPullerGraph.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = APYahooDataPullerGraph.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - AB6FA5580FEB6235008DB04A /* APYahooDataPullerGraph.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = APYahooDataPullerGraph.xib; path = Classes/APYahooDataPullerGraph.xib; sourceTree = ""; }; - AB6FA6090FEB6DAA008DB04A /* YHOO.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = YHOO.plist; sourceTree = SOURCE_ROOT; }; - AB6FA60A0FEB6DAA008DB04A /* MSFT.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = MSFT.plist; sourceTree = SOURCE_ROOT; }; - AB6FA60B0FEB6DAA008DB04A /* GOOG.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = GOOG.plist; sourceTree = SOURCE_ROOT; }; - AB6FA60C0FEB6DAA008DB04A /* AAPL.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = AAPL.plist; sourceTree = SOURCE_ROOT; }; - C36157E819D79AAC0036ACDA /* Launch Screen.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = "Launch Screen.xib"; sourceTree = ""; }; - C3CA9B5B19E203B2008DF7A3 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = ../../framework/xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; - C3CD284717DE9D1F008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; - C3D3936F19FD6CBF00148319 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = StockPlot/Images.xcassets; sourceTree = ""; }; - C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = CorePlot.xcodeproj; path = ../../framework/CorePlot.xcodeproj; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, - 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, - 2892E4100DC94CBA00A64D0F /* CoreGraphics.framework in Frameworks */, - AB6FA4A40FEB579B008DB04A /* QuartzCore.framework in Frameworks */, - C3CD284817DE9D1F008EED1E /* Accelerate.framework in Frameworks */, - C3D414DF1A7D84CC00B6F5D6 /* libCorePlot-CocoaTouch.a in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 080E96DDFE201D6D7F000001 /* Classes */ = { - isa = PBXGroup; - children = ( - AB4913C50FECC2B8008A08AB /* APYahooDataPuller.h */, - AB4913C60FECC2B8008A08AB /* APYahooDataPuller.m */, - AB6FA4DE0FEB59DB008DB04A /* NSDictionary+APFinancialData.h */, - AB4913C70FECC2B8008A08AB /* NSDictionary+APFinancialData.m */, - 28C286DF0D94DF7D0034E888 /* RootViewController.h */, - 28C286E00D94DF7D0034E888 /* RootViewController.m */, - 1D3623240D0F684500981E51 /* StockPlotAppDelegate.h */, - 1D3623250D0F684500981E51 /* StockPlotAppDelegate.m */, - AB6FA5560FEB6235008DB04A /* APYahooDataPullerGraph.h */, - AB6FA5570FEB6235008DB04A /* APYahooDataPullerGraph.m */, - ); - path = Classes; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - 1D6058910D05DD3D006BFB54 /* StockPlot.app */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { - isa = PBXGroup; - children = ( - C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */, - 080E96DDFE201D6D7F000001 /* Classes */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - ); - indentWidth = 4; - name = CustomTemplate; - sourceTree = ""; - tabWidth = 4; - usesTabs = 0; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - 28A0AAE50D9B0CCF005BE974 /* StockPlot_Prefix.pch */, - 29B97316FDCFA39411CA2CEA /* main.m */, - C3CA9B5B19E203B2008DF7A3 /* CorePlotWarnings.xcconfig */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - C3D3936F19FD6CBF00148319 /* Images.xcassets */, - AB0364760FEF4603007B09A9 /* caution.png */, - AB6FA6090FEB6DAA008DB04A /* YHOO.plist */, - AB6FA60A0FEB6DAA008DB04A /* MSFT.plist */, - AB6FA60B0FEB6DAA008DB04A /* GOOG.plist */, - AB6FA60C0FEB6DAA008DB04A /* AAPL.plist */, - AB6FA5580FEB6235008DB04A /* APYahooDataPullerGraph.xib */, - 2899E55F0DE3E45000AC0155 /* RootViewController.xib */, - 28AD735F0D9D9599002E5188 /* MainWindow.xib */, - 8D1107310486CEB800E47090 /* StockPlot-Info.plist */, - C36157E819D79AAC0036ACDA /* Launch Screen.xib */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, - 1D30AB110D05D00D00671497 /* Foundation.framework */, - 2892E40F0DC94CBA00A64D0F /* CoreGraphics.framework */, - AB6FA4A30FEB579B008DB04A /* QuartzCore.framework */, - C3CD284717DE9D1F008EED1E /* Accelerate.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - C3D414C81A7D84BF00B6F5D6 /* Products */ = { - isa = PBXGroup; - children = ( - C3D414D41A7D84BF00B6F5D6 /* CorePlot.framework */, - C3D414D61A7D84BF00B6F5D6 /* UnitTests.xctest */, - C3D414D81A7D84BF00B6F5D6 /* CorePlot.framework */, - C3D414DA1A7D84BF00B6F5D6 /* UnitTests iOS.xctest */, - C3D414DC1A7D84BF00B6F5D6 /* libCorePlot-CocoaTouch.a */, - C3D414DE1A7D84BF00B6F5D6 /* CorePlot-CocoaTouchTests.xctest */, - ); - name = Products; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXNativeTarget section */ - 1D6058900D05DD3D006BFB54 /* StockPlot */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "StockPlot" */; - buildPhases = ( - 1D60588D0D05DD3D006BFB54 /* Resources */, - 1D60588E0D05DD3D006BFB54 /* Sources */, - 1D60588F0D05DD3D006BFB54 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = StockPlot; - productName = StockPlot; - productReference = 1D6058910D05DD3D006BFB54 /* StockPlot.app */; - productType = "com.apple.product-type.application"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0700; - TargetAttributes = { - 1D6058900D05DD3D006BFB54 = { - DevelopmentTeam = 28ZA45DE7D; - }; - }; - }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "StockPlot" */; - compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - en, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; - projectDirPath = ""; - projectReferences = ( - { - ProductGroup = C3D414C81A7D84BF00B6F5D6 /* Products */; - ProjectRef = C3D414C71A7D84BF00B6F5D6 /* CorePlot.xcodeproj */; - }, - ); - projectRoot = ""; - targets = ( - 1D6058900D05DD3D006BFB54 /* StockPlot */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXReferenceProxy section */ - C3D414D41A7D84BF00B6F5D6 /* CorePlot.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CorePlot.framework; - remoteRef = C3D414D31A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414D61A7D84BF00B6F5D6 /* UnitTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = UnitTests.xctest; - remoteRef = C3D414D51A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414D81A7D84BF00B6F5D6 /* CorePlot.framework */ = { - isa = PBXReferenceProxy; - fileType = wrapper.framework; - path = CorePlot.framework; - remoteRef = C3D414D71A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414DA1A7D84BF00B6F5D6 /* UnitTests iOS.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "UnitTests iOS.xctest"; - remoteRef = C3D414D91A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414DC1A7D84BF00B6F5D6 /* libCorePlot-CocoaTouch.a */ = { - isa = PBXReferenceProxy; - fileType = archive.ar; - path = "libCorePlot-CocoaTouch.a"; - remoteRef = C3D414DB1A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; - C3D414DE1A7D84BF00B6F5D6 /* CorePlot-CocoaTouchTests.xctest */ = { - isa = PBXReferenceProxy; - fileType = wrapper.cfbundle; - path = "CorePlot-CocoaTouchTests.xctest"; - remoteRef = C3D414DD1A7D84BF00B6F5D6 /* PBXContainerItemProxy */; - sourceTree = BUILT_PRODUCTS_DIR; - }; -/* End PBXReferenceProxy section */ - -/* Begin PBXResourcesBuildPhase section */ - 1D60588D0D05DD3D006BFB54 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 28AD73600D9D9599002E5188 /* MainWindow.xib in Resources */, - 2899E5600DE3E45000AC0155 /* RootViewController.xib in Resources */, - AB6FA55A0FEB6235008DB04A /* APYahooDataPullerGraph.xib in Resources */, - AB0363AA0FEF3681007B09A9 /* YHOO.plist in Resources */, - C3D3937019FD6CBF00148319 /* Images.xcassets in Resources */, - AB0363AB0FEF3684007B09A9 /* MSFT.plist in Resources */, - AB0363AC0FEF3687007B09A9 /* GOOG.plist in Resources */, - AB0363AD0FEF368A007B09A9 /* AAPL.plist in Resources */, - AB0364770FEF4603007B09A9 /* caution.png in Resources */, - C36157E919D79AAC0036ACDA /* Launch Screen.xib in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 1D60588E0D05DD3D006BFB54 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 1D60589B0D05DD56006BFB54 /* main.m in Sources */, - 1D3623260D0F684500981E51 /* StockPlotAppDelegate.m in Sources */, - 28C286E10D94DF7D0034E888 /* RootViewController.m in Sources */, - AB6FA5590FEB6235008DB04A /* APYahooDataPullerGraph.m in Sources */, - AB4913C80FECC2B8008A08AB /* APYahooDataPuller.m in Sources */, - AB4913C90FECC2B8008A08AB /* NSDictionary+APFinancialData.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 1D6058940D05DD3E006BFB54 /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C3CA9B5B19E203B2008DF7A3 /* CorePlotWarnings.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = StockPlot_Prefix.pch; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "StockPlot-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = StockPlot; - }; - name = Debug; - }; - 1D6058950D05DD3E006BFB54 /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C3CA9B5B19E203B2008DF7A3 /* CorePlotWarnings.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; - ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Distribution"; - "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Distribution"; - COPY_PHASE_STRIP = NO; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = StockPlot_Prefix.pch; - HEADER_SEARCH_PATHS = ""; - INFOPLIST_FILE = "StockPlot-Info.plist"; - PRODUCT_BUNDLE_IDENTIFIER = "org.CorePlot.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = StockPlot; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - ONLY_ACTIVE_ARCH = YES; - OTHER_LDFLAGS = ( - "-all_load", - "-ObjC", - ); - SDKROOT = iphoneos; - SYMROOT = "$(SRCROOT)/../../build"; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ""; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - OTHER_LDFLAGS = ( - "-all_load", - "-ObjC", - ); - SDKROOT = iphoneos; - USER_HEADER_SEARCH_PATHS = "\"${PROJECT_DIR}/../../framework\"/**"; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "StockPlot" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1D6058940D05DD3E006BFB54 /* Debug */, - 1D6058950D05DD3E006BFB54 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "StockPlot" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/examples/StockPlot/StockPlot.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/examples/StockPlot/StockPlot.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 3318309c7..000000000 --- a/examples/StockPlot/StockPlot.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Contents.json b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Contents.json deleted file mode 100644 index 340f2376e..000000000 --- a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Contents.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "images" : [ - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-Small.png", - "scale" : "1x" - }, - { - "size" : "29x29", - "idiom" : "iphone", - "filename" : "Icon-Small@2x.png", - "scale" : "2x" - }, - { - "size" : "40x40", - "idiom" : "iphone", - "filename" : "Icon-Spotlight-40@2x.png", - "scale" : "2x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon.png", - "scale" : "1x" - }, - { - "size" : "57x57", - "idiom" : "iphone", - "filename" : "Icon@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@2x.png", - "scale" : "2x" - }, - { - "size" : "60x60", - "idiom" : "iphone", - "filename" : "Icon-60@3x.png", - "scale" : "3x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png deleted file mode 100644 index 5ce9f6593..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@2x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png deleted file mode 100644 index 0786734de..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-60@3x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small.png deleted file mode 100644 index a40598c34..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png deleted file mode 100644 index e4b5c2785..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Small@2x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png deleted file mode 100644 index 390cd034f..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon-Spotlight-40@2x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon.png deleted file mode 100644 index ac669215a..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon@2x.png b/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon@2x.png deleted file mode 100644 index dd7353607..000000000 Binary files a/examples/StockPlot/StockPlot/Images.xcassets/AppIcon.appiconset/Icon@2x.png and /dev/null differ diff --git a/examples/StockPlot/StockPlot/Images.xcassets/LaunchImage.launchimage/Contents.json b/examples/StockPlot/StockPlot/Images.xcassets/LaunchImage.launchimage/Contents.json deleted file mode 100644 index e6c8ec6a6..000000000 --- a/examples/StockPlot/StockPlot/Images.xcassets/LaunchImage.launchimage/Contents.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "images" : [ - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "landscape", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "736h", - "scale" : "3x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "8.0", - "subtype" : "667h", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "minimum-system-version" : "7.0", - "subtype" : "retina4", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "1x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "scale" : "2x" - }, - { - "orientation" : "portrait", - "idiom" : "iphone", - "extent" : "full-screen", - "subtype" : "retina4", - "scale" : "2x" - } - ], - "info" : { - "version" : 1, - "author" : "xcode" - } -} \ No newline at end of file diff --git a/examples/StockPlot/StockPlot_Prefix.pch b/examples/StockPlot/StockPlot_Prefix.pch deleted file mode 100644 index d6179e313..000000000 --- a/examples/StockPlot/StockPlot_Prefix.pch +++ /dev/null @@ -1,14 +0,0 @@ -// -// Prefix header for all source files of the 'StockPlot' target in the 'StockPlot' project -// -#import - -#ifndef __IPHONE_3_0 -#warning "This project uses features only available in iPhone SDK 3.0 and later." -#endif - - -#ifdef __OBJC__ - #import - #import -#endif diff --git a/examples/StockPlot/YHOO.plist b/examples/StockPlot/YHOO.plist deleted file mode 100644 index 08a118eac..000000000 --- a/examples/StockPlot/YHOO.plist +++ /dev/null @@ -1,1107 +0,0 @@ - - - - - endDate - 2009-06-19T06:53:47Z - financialData - - - adjClose - 15.34 - close - 15.34 - date - 2009-06-18T04:00:00Z - high - 15.64 - low - 15.23 - open - 15.62 - volume - 16185400 - - - adjClose - 15.6 - close - 15.6 - date - 2009-06-17T04:00:00Z - high - 16.03 - low - 15.46 - open - 15.91 - volume - 16159600 - - - adjClose - 15.96 - close - 15.96 - date - 2009-06-16T04:00:00Z - high - 16.38 - low - 15.9 - open - 16.33 - volume - 15116000 - - - adjClose - 16.4 - close - 16.4 - date - 2009-06-15T04:00:00Z - high - 16.68 - low - 16.13 - open - 16.56 - volume - 23251700 - - - adjClose - 16.4 - close - 16.4 - date - 2009-06-12T04:00:00Z - high - 16.47 - low - 16.1 - open - 16.17 - volume - 16962900 - - - adjClose - 16.19 - close - 16.19 - date - 2009-06-11T04:00:00Z - high - 16.46 - low - 16.15 - open - 16.26 - volume - 14787400 - - - adjClose - 16.32 - close - 16.32 - date - 2009-06-10T04:00:00Z - high - 16.72 - low - 16.1 - open - 16.7 - volume - 15761000 - - - adjClose - 16.4 - close - 16.4 - date - 2009-06-09T04:00:00Z - high - 16.5 - low - 16.18 - open - 16.23 - volume - 13083200 - - - adjClose - 16.19 - close - 16.19 - date - 2009-06-08T04:00:00Z - high - 16.49 - low - 16.04 - open - 16.47 - volume - 13680700 - - - adjClose - 16.64 - close - 16.64 - date - 2009-06-05T04:00:00Z - high - 16.99 - low - 16.3 - open - 16.77 - volume - 17311400 - - - adjClose - 16.65 - close - 16.65 - date - 2009-06-04T04:00:00Z - high - 16.71 - low - 16.04 - open - 16.4 - volume - 19001400 - - - adjClose - 16.3 - close - 16.3 - date - 2009-06-03T04:00:00Z - high - 16.5 - low - 15.67 - open - 16.5 - volume - 26358100 - - - adjClose - 16.62 - close - 16.62 - date - 2009-06-02T04:00:00Z - high - 16.75 - low - 16.25 - open - 16.6 - volume - 15286700 - - - adjClose - 16.58 - close - 16.58 - date - 2009-06-01T04:00:00Z - high - 16.65 - low - 16.13 - open - 16.17 - volume - 27926100 - - - adjClose - 15.84 - close - 15.84 - date - 2009-05-29T04:00:00Z - high - 15.84 - low - 15.11 - open - 15.19 - volume - 29557500 - - - adjClose - 15.09 - close - 15.09 - date - 2009-05-28T04:00:00Z - high - 15.24 - low - 14.69 - open - 15.09 - volume - 19131600 - - - adjClose - 14.94 - close - 14.94 - date - 2009-05-27T04:00:00Z - high - 15.53 - low - 14.88 - open - 15.27 - volume - 18977400 - - - adjClose - 15.28 - close - 15.28 - date - 2009-05-26T04:00:00Z - high - 15.44 - low - 14.67 - open - 14.68 - volume - 19953000 - - - adjClose - 14.98 - close - 14.98 - date - 2009-05-22T04:00:00Z - high - 15.17 - low - 14.75 - open - 14.89 - volume - 19150500 - - - adjClose - 14.87 - close - 14.87 - date - 2009-05-21T04:00:00Z - high - 15.12 - low - 14.62 - open - 14.92 - volume - 15186800 - - - adjClose - 14.96 - close - 14.96 - date - 2009-05-20T04:00:00Z - high - 15.31 - low - 14.8 - open - 15.08 - volume - 15781600 - - - adjClose - 15.18 - close - 15.18 - date - 2009-05-19T04:00:00Z - high - 15.34 - low - 15.02 - open - 15.06 - volume - 13676000 - - - adjClose - 15.17 - close - 15.17 - date - 2009-05-18T04:00:00Z - high - 15.18 - low - 14.74 - open - 15.1 - volume - 18629500 - - - adjClose - 14.91 - close - 14.91 - date - 2009-05-15T04:00:00Z - high - 15.1 - low - 14.86 - open - 15 - volume - 22525900 - - - adjClose - 14.76 - close - 14.76 - date - 2009-05-14T04:00:00Z - high - 14.86 - low - 14.4 - open - 14.5 - volume - 20841800 - - - adjClose - 14.52 - close - 14.52 - date - 2009-05-13T04:00:00Z - high - 14.95 - low - 14.5 - open - 14.92 - volume - 23585400 - - - adjClose - 15.1 - close - 15.1 - date - 2009-05-12T04:00:00Z - high - 15.5 - low - 14.9 - open - 15.5 - volume - 31403300 - - - adjClose - 15.54 - close - 15.54 - date - 2009-05-11T04:00:00Z - high - 15.83 - low - 14.81 - open - 14.9 - volume - 39492400 - - - adjClose - 15.15 - close - 15.15 - date - 2009-05-08T04:00:00Z - high - 15.3 - low - 14.7 - open - 14.88 - volume - 22461200 - - - adjClose - 14.8 - close - 14.8 - date - 2009-05-07T04:00:00Z - high - 15.1 - low - 14.38 - open - 15.03 - volume - 24328500 - - - adjClose - 14.85 - close - 14.85 - date - 2009-05-06T04:00:00Z - high - 15 - low - 14.52 - open - 14.8 - volume - 19105800 - - - adjClose - 14.74 - close - 14.74 - date - 2009-05-05T04:00:00Z - high - 14.99 - low - 14.18 - open - 14.55 - volume - 35233200 - - - adjClose - 14.18 - close - 14.18 - date - 2009-05-04T04:00:00Z - high - 14.25 - low - 13.96 - open - 14.2 - volume - 25094600 - - - adjClose - 14.14 - close - 14.14 - date - 2009-05-01T04:00:00Z - high - 14.5 - low - 13.91 - open - 14.5 - volume - 23721700 - - - adjClose - 14.29 - close - 14.29 - date - 2009-04-30T04:00:00Z - high - 14.6 - low - 14.12 - open - 14.12 - volume - 25883300 - - - adjClose - 14.02 - close - 14.02 - date - 2009-04-29T04:00:00Z - high - 14.35 - low - 13.7 - open - 13.7 - volume - 16570900 - - - adjClose - 13.64 - close - 13.64 - date - 2009-04-28T04:00:00Z - high - 14.05 - low - 13.6 - open - 13.74 - volume - 18856500 - - - adjClose - 13.89 - close - 13.89 - date - 2009-04-27T04:00:00Z - high - 14.55 - low - 13.88 - open - 14.48 - volume - 22640600 - - - adjClose - 14.73 - close - 14.73 - date - 2009-04-24T04:00:00Z - high - 14.94 - low - 14.36 - open - 14.79 - volume - 25803000 - - - adjClose - 14.55 - close - 14.55 - date - 2009-04-23T04:00:00Z - high - 14.74 - low - 14.11 - open - 14.56 - volume - 32943200 - - - adjClose - 14.48 - close - 14.48 - date - 2009-04-22T04:00:00Z - high - 15.39 - low - 14.41 - open - 14.62 - volume - 65407800 - - - adjClose - 14.38 - close - 14.38 - date - 2009-04-21T04:00:00Z - high - 14.59 - low - 13.71 - open - 13.94 - volume - 54237700 - - - adjClose - 13.66 - close - 13.66 - date - 2009-04-20T04:00:00Z - high - 14.25 - low - 13.6 - open - 14.16 - volume - 13470500 - - - adjClose - 14.39 - close - 14.39 - date - 2009-04-17T04:00:00Z - high - 14.52 - low - 14.03 - open - 14.43 - volume - 19800400 - - - adjClose - 14.43 - close - 14.43 - date - 2009-04-16T04:00:00Z - high - 14.53 - low - 14.05 - open - 14.15 - volume - 19156500 - - - adjClose - 14.02 - close - 14.02 - date - 2009-04-15T04:00:00Z - high - 14.09 - low - 13.77 - open - 13.93 - volume - 12383200 - - - adjClose - 14.07 - close - 14.07 - date - 2009-04-14T04:00:00Z - high - 14.42 - low - 14 - open - 14.4 - volume - 15151700 - - - adjClose - 14.42 - close - 14.42 - date - 2009-04-13T04:00:00Z - high - 14.54 - low - 13.86 - open - 14.02 - volume - 35067600 - - - adjClose - 13.47 - close - 13.47 - date - 2009-04-09T04:00:00Z - high - 13.59 - low - 13.07 - open - 13.14 - volume - 17285800 - - - adjClose - 12.92 - close - 12.92 - date - 2009-04-08T04:00:00Z - high - 13.01 - low - 12.75 - open - 12.9 - volume - 11241000 - - - adjClose - 12.81 - close - 12.81 - date - 2009-04-07T04:00:00Z - high - 13.1 - low - 12.68 - open - 13 - volume - 12306400 - - - adjClose - 13.23 - close - 13.23 - date - 2009-04-06T04:00:00Z - high - 13.24 - low - 12.99 - open - 13.08 - volume - 11935700 - - - adjClose - 13.34 - close - 13.34 - date - 2009-04-03T04:00:00Z - high - 13.39 - low - 12.78 - open - 12.95 - volume - 18534900 - - - adjClose - 12.95 - close - 12.95 - date - 2009-04-02T04:00:00Z - high - 13.14 - low - 12.8 - open - 13.04 - volume - 28823100 - - - adjClose - 12.75 - close - 12.75 - date - 2009-04-01T04:00:00Z - high - 13.12 - low - 12.6 - open - 12.7 - volume - 14540400 - - - adjClose - 12.81 - close - 12.81 - date - 2009-03-31T04:00:00Z - high - 13.1 - low - 12.67 - open - 12.76 - volume - 11882100 - - - adjClose - 12.7 - close - 12.7 - date - 2009-03-30T04:00:00Z - high - 13.14 - low - 12.51 - open - 12.93 - volume - 16558800 - - - adjClose - 13.18 - close - 13.18 - date - 2009-03-27T04:00:00Z - high - 13.61 - low - 13.12 - open - 13.17 - volume - 22426200 - - - adjClose - 13.35 - close - 13.35 - date - 2009-03-26T04:00:00Z - high - 13.61 - low - 13 - open - 13.55 - volume - 24223400 - - - adjClose - 13.55 - close - 13.55 - date - 2009-03-25T04:00:00Z - high - 13.88 - low - 13.35 - open - 13.69 - volume - 16746400 - - - adjClose - 13.63 - close - 13.63 - date - 2009-03-24T04:00:00Z - high - 14.02 - low - 13.56 - open - 13.98 - volume - 17293600 - - - adjClose - 14.09 - close - 14.09 - date - 2009-03-23T04:00:00Z - high - 14.12 - low - 13.62 - open - 13.79 - volume - 18200000 - - - adjClose - 13.6 - close - 13.6 - date - 2009-03-20T04:00:00Z - high - 13.87 - low - 13.51 - open - 13.63 - volume - 22079300 - - - adjClose - 13.74 - close - 13.74 - date - 2009-03-19T04:00:00Z - high - 14.14 - low - 13.61 - open - 13.68 - volume - 25954300 - - - adjClose - 13.42 - close - 13.42 - date - 2009-03-18T04:00:00Z - high - 13.95 - low - 13.23 - open - 13.81 - volume - 26324300 - - - adjClose - 13.99 - close - 13.99 - date - 2009-03-17T04:00:00Z - high - 14.04 - low - 13.22 - open - 13.35 - volume - 16719400 - - - adjClose - 13.22 - close - 13.22 - date - 2009-03-16T04:00:00Z - high - 13.66 - low - 13.2 - open - 13.66 - volume - 19448800 - - - adjClose - 13.51 - close - 13.51 - date - 2009-03-13T04:00:00Z - high - 13.64 - low - 13.27 - open - 13.58 - volume - 12522600 - - - overallHigh - 16.99 - overallLow - 12.51 - startDate - 2009-03-13T06:53:47Z - symbol - YHOO - - diff --git a/examples/StockPlot/caution.png b/examples/StockPlot/caution.png deleted file mode 100644 index ec4b70669..000000000 Binary files a/examples/StockPlot/caution.png and /dev/null differ diff --git a/examples/StockPlot/main.m b/examples/StockPlot/main.m deleted file mode 100644 index 9ca0680af..000000000 --- a/examples/StockPlot/main.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// main.m -// StockPlot -// -// Created by Jonathan Saggau on 6/19/09. -// Copyright __MyCompanyName__ 2009. All rights reserved. -// - -#import - -int main(int argc, char *argv[]) -{ - @autoreleasepool { - int retVal = UIApplicationMain(argc, argv, nil, nil); - - return retVal; - } -} diff --git a/framework/CocoaPods/CorePlot.h b/framework/CocoaPods/CorePlot.h index 93a0fbd03..c3660a97e 100644 --- a/framework/CocoaPods/CorePlot.h +++ b/framework/CocoaPods/CorePlot.h @@ -1,4 +1,6 @@ -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#import "TargetConditionals.h" + +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #import #import #else @@ -36,19 +38,19 @@ #import "CPTLineCap.h" #import "CPTLineStyle.h" #import "CPTMutableLineStyle.h" -#import "CPTMutableNumericData.h" #import "CPTMutableNumericData+TypeConversion.h" +#import "CPTMutableNumericData.h" #import "CPTMutablePlotRange.h" #import "CPTMutableShadow.h" #import "CPTMutableTextStyle.h" -#import "CPTNumericData.h" #import "CPTNumericData+TypeConversion.h" +#import "CPTNumericData.h" #import "CPTNumericDataType.h" +#import "CPTPathExtensions.h" #import "CPTPieChart.h" +#import "CPTPlatformSpecificCategories.h" #import "CPTPlatformSpecificDefines.h" #import "CPTPlatformSpecificFunctions.h" -#import "CPTPlatformSpecificCategories.h" -#import "CPTPathExtensions.h" #import "CPTPlot.h" #import "CPTPlotArea.h" #import "CPTPlotAreaFrame.h" diff --git a/framework/CorePlot-CocoaTouch.h b/framework/CorePlot-CocoaTouch.h index 9be2b42d5..5b8bd9349 100644 --- a/framework/CorePlot-CocoaTouch.h +++ b/framework/CorePlot-CocoaTouch.h @@ -32,19 +32,19 @@ #import "CPTLineCap.h" #import "CPTLineStyle.h" #import "CPTMutableLineStyle.h" -#import "CPTMutableNumericData.h" #import "CPTMutableNumericData+TypeConversion.h" +#import "CPTMutableNumericData.h" #import "CPTMutablePlotRange.h" #import "CPTMutableShadow.h" #import "CPTMutableTextStyle.h" -#import "CPTNumericData.h" #import "CPTNumericData+TypeConversion.h" +#import "CPTNumericData.h" #import "CPTNumericDataType.h" +#import "CPTPathExtensions.h" #import "CPTPieChart.h" +#import "CPTPlatformSpecificCategories.h" #import "CPTPlatformSpecificDefines.h" #import "CPTPlatformSpecificFunctions.h" -#import "CPTPlatformSpecificCategories.h" -#import "CPTPathExtensions.h" #import "CPTPlot.h" #import "CPTPlotArea.h" #import "CPTPlotAreaFrame.h" diff --git a/framework/CorePlot-CocoaTouch.xcodeproj/project.pbxproj b/framework/CorePlot-CocoaTouch.xcodeproj/project.pbxproj deleted file mode 100644 index 993f75e21..000000000 --- a/framework/CorePlot-CocoaTouch.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1339 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 47; - objects = { - -/* Begin PBXAggregateTarget section */ - 0799D97A137318CF0026072C /* Universal Library */ = { - isa = PBXAggregateTarget; - buildConfigurationList = 0799D97D137318CF0026072C /* Build configuration list for PBXAggregateTarget "Universal Library" */; - buildPhases = ( - 0799D97F137318D80026072C /* ShellScript */, - ); - dependencies = ( - ); - name = "Universal Library"; - productName = "Universal Library"; - }; - C3566B8010EED04900FB3866 /* Documentation */ = { - isa = PBXAggregateTarget; - buildConfigurationList = C3566B8410EED06800FB3866 /* Build configuration list for PBXAggregateTarget "Documentation" */; - buildPhases = ( - C3566B7F10EED04900FB3866 /* ShellScript */, - ); - dependencies = ( - ); - name = Documentation; - productName = Documentation; - }; -/* End PBXAggregateTarget section */ - -/* Begin PBXBuildFile section */ - 070CB82A0FC9DE4B00F3152B /* CPTGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82990FB89E610035D8DA /* CPTGradient.m */; }; - 070CB82B0FC9DE5500F3152B /* CPTImage.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B829B0FB89E610035D8DA /* CPTImage.m */; }; - 070CB82C0FC9DE5600F3152B /* CPTLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82700FB89E610035D8DA /* CPTLayer.m */; }; - 070CB82D0FC9DE5700F3152B /* CPTLineStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B829D0FB89E610035D8DA /* CPTLineStyle.m */; }; - 070CB8340FC9DEA800F3152B /* CPTColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 070CB8300FC9DEA800F3152B /* CPTColor.h */; settings = {ATTRIBUTES = (); }; }; - 070CB8350FC9DEA800F3152B /* CPTColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 070CB8310FC9DEA800F3152B /* CPTColor.m */; }; - 070CB8360FC9DEA800F3152B /* CPTColorSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 070CB8320FC9DEA800F3152B /* CPTColorSpace.h */; settings = {ATTRIBUTES = (); }; }; - 070CB8370FC9DEA800F3152B /* CPTColorSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = 070CB8330FC9DEA800F3152B /* CPTColorSpace.m */; }; - 070CB8430FC9DED400F3152B /* CPTAxis.h in Headers */ = {isa = PBXBuildFile; fileRef = 070CB8390FC9DED400F3152B /* CPTAxis.h */; settings = {ATTRIBUTES = (); }; }; - 070CB8440FC9DED400F3152B /* CPTAxis.m in Sources */ = {isa = PBXBuildFile; fileRef = 070CB83A0FC9DED400F3152B /* CPTAxis.m */; }; - 070CB8470FC9DED400F3152B /* CPTAxisSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 070CB83D0FC9DED400F3152B /* CPTAxisSet.h */; settings = {ATTRIBUTES = (); }; }; - 070CB8480FC9DED400F3152B /* CPTAxisSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 070CB83E0FC9DED400F3152B /* CPTAxisSet.m */; }; - 070CB85E0FC9DF4700F3152B /* CPTTextLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B829F0FB89E610035D8DA /* CPTTextLayer.m */; }; - 0718DE4D11D1EDBA00AF4851 /* CPTAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0718DE4511D1EDBA00AF4851 /* CPTAnnotation.h */; settings = {ATTRIBUTES = (); }; }; - 0718DE4E11D1EDBA00AF4851 /* CPTAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0718DE4611D1EDBA00AF4851 /* CPTAnnotation.m */; }; - 0718DE4F11D1EDBA00AF4851 /* CPTAnnotationHostLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0718DE4711D1EDBA00AF4851 /* CPTAnnotationHostLayer.h */; settings = {ATTRIBUTES = (); }; }; - 0718DE5011D1EDBA00AF4851 /* CPTAnnotationHostLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 0718DE4811D1EDBA00AF4851 /* CPTAnnotationHostLayer.m */; }; - 0718DE5111D1EDBA00AF4851 /* CPTLayerAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0718DE4911D1EDBA00AF4851 /* CPTLayerAnnotation.h */; settings = {ATTRIBUTES = (); }; }; - 0718DE5211D1EDBA00AF4851 /* CPTLayerAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0718DE4A11D1EDBA00AF4851 /* CPTLayerAnnotation.m */; }; - 0718DE5311D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 0718DE4B11D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.h */; settings = {ATTRIBUTES = (); }; }; - 0718DE5411D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 0718DE4C11D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.m */; }; - 072E3F9F0FE2FF7300ACF62F /* CPTTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = 072E3F9B0FE2FF7300ACF62F /* CPTTheme.h */; settings = {ATTRIBUTES = (); }; }; - 072E3FA00FE2FF7300ACF62F /* CPTTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 072E3F9C0FE2FF7300ACF62F /* CPTTheme.m */; }; - 074D7BC50FD6B65F006011BC /* CPTXYPlotSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 074D7BC30FD6B65E006011BC /* CPTXYPlotSpace.h */; settings = {ATTRIBUTES = (); }; }; - 074D7BC60FD6B65F006011BC /* CPTXYPlotSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = 074D7BC40FD6B65F006011BC /* CPTXYPlotSpace.m */; }; - 074FADF9112024C500394B90 /* CPTConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 074FADF7112024C500394B90 /* CPTConstraints.h */; settings = {ATTRIBUTES = (); }; }; - 074FADFA112024C500394B90 /* CPTConstraints.m in Sources */ = {isa = PBXBuildFile; fileRef = 074FADF8112024C500394B90 /* CPTConstraints.m */; }; - 0772B4F310E26A12009CD04C /* CPTTradingRangePlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0772B4F110E26A12009CD04C /* CPTTradingRangePlot.h */; settings = {ATTRIBUTES = (); }; }; - 0772B4F410E26A12009CD04C /* CPTTradingRangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 0772B4F210E26A12009CD04C /* CPTTradingRangePlot.m */; }; - 077F28550FE18048000BCA52 /* CPTBorderedLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 077F28510FE18048000BCA52 /* CPTBorderedLayer.h */; settings = {ATTRIBUTES = (); }; }; - 077F28560FE18048000BCA52 /* CPTBorderedLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 077F28520FE18048000BCA52 /* CPTBorderedLayer.m */; }; - 077F28570FE18048000BCA52 /* CPTPathExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 077F28530FE18048000BCA52 /* CPTPathExtensions.h */; settings = {ATTRIBUTES = (); }; }; - 077F28580FE18048000BCA52 /* CPTPathExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 077F28540FE18048000BCA52 /* CPTPathExtensions.m */; }; - 0789EFBE0FB9F97F00C0A613 /* CPTPlatformSpecificCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = 0789EFB80FB9F97F00C0A613 /* CPTPlatformSpecificCategories.h */; settings = {ATTRIBUTES = (); }; }; - 0789EFBF0FB9F97F00C0A613 /* CPTPlatformSpecificCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = 0789EFB90FB9F97F00C0A613 /* CPTPlatformSpecificCategories.m */; }; - 0789EFC00FB9F97F00C0A613 /* CPTPlatformSpecificDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = 0789EFBA0FB9F97F00C0A613 /* CPTPlatformSpecificDefines.h */; settings = {ATTRIBUTES = (); }; }; - 0789EFC10FB9F97F00C0A613 /* CPTPlatformSpecificDefines.m in Sources */ = {isa = PBXBuildFile; fileRef = 0789EFBB0FB9F97F00C0A613 /* CPTPlatformSpecificDefines.m */; }; - 0789EFC20FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = 0789EFBC0FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.h */; settings = {ATTRIBUTES = (); }; }; - 0789EFC30FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = 0789EFBD0FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.m */; }; - 07A2E71E102DFAD300809BC5 /* CPTTimeFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 07A2E71C102DFAD300809BC5 /* CPTTimeFormatter.h */; settings = {ATTRIBUTES = (); }; }; - 07A2E71F102DFAD300809BC5 /* CPTTimeFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 07A2E71D102DFAD300809BC5 /* CPTTimeFormatter.m */; }; - 07A5E24C104E47E900B7AB80 /* CPTTextLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B829E0FB89E610035D8DA /* CPTTextLayer.h */; settings = {ATTRIBUTES = (); }; }; - 07A62FB50FE2234900CD765C /* CPTTextStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 07A62FB30FE2234900CD765C /* CPTTextStyle.h */; settings = {ATTRIBUTES = (); }; }; - 07A62FB60FE2234900CD765C /* CPTTextStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 07A62FB40FE2234900CD765C /* CPTTextStyle.m */; }; - 07AEF30310BBF99A0012BEFF /* CPTResponder.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AEF30110BBF99A0012BEFF /* CPTResponder.h */; settings = {ATTRIBUTES = (); }; }; - 07B69AB912B6281100F4C16C /* CPTMutableTextStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B69AB712B6281100F4C16C /* CPTMutableTextStyle.h */; settings = {ATTRIBUTES = (); }; }; - 07B69ABA12B6281100F4C16C /* CPTMutableTextStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 07B69AB812B6281100F4C16C /* CPTMutableTextStyle.m */; }; - 07B69B7112B62E9600F4C16C /* CPTMutableLineStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B69B6F12B62E9600F4C16C /* CPTMutableLineStyle.h */; settings = {ATTRIBUTES = (); }; }; - 07B69B7212B62E9600F4C16C /* CPTMutableLineStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 07B69B7012B62E9600F4C16C /* CPTMutableLineStyle.m */; }; - 07FCF2D4115B54DE00E46606 /* _CPTSlateTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 07FCF2D2115B54DE00E46606 /* _CPTSlateTheme.m */; }; - BC4FAF29100D7DF300811DD3 /* NSDecimalNumberExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82B10FB89E610035D8DA /* NSDecimalNumberExtensions.h */; settings = {ATTRIBUTES = (); }; }; - BC74A2C210FC087800E7E90D /* CPTPieChart.h in Headers */ = {isa = PBXBuildFile; fileRef = BC74A2C010FC087800E7E90D /* CPTPieChart.h */; settings = {ATTRIBUTES = (); }; }; - BC74A2C310FC087800E7E90D /* CPTPieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = BC74A2C110FC087800E7E90D /* CPTPieChart.m */; }; - BC79F1D50FD1DC1A00510976 /* CPTGraphHostingView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC79F1D30FD1DC1A00510976 /* CPTGraphHostingView.h */; settings = {ATTRIBUTES = (); }; }; - BC79F1D60FD1DC1A00510976 /* CPTGraphHostingView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC79F1D40FD1DC1A00510976 /* CPTGraphHostingView.m */; }; - BC89A79A1024AB19009D5261 /* CorePlotProbes.d in Sources */ = {isa = PBXBuildFile; fileRef = BC89A7991024AB19009D5261 /* CorePlotProbes.d */; }; - BC9B834E0FB8A1400035D8DA /* CPTPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82D30FB89E610035D8DA /* CPTPlot.m */; }; - BC9B834F0FB8A1400035D8DA /* CPTScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82D50FB89E610035D8DA /* CPTScatterPlot.m */; }; - BC9B83500FB8A1400035D8DA /* CPTBarPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82DB0FB89E610035D8DA /* CPTBarPlot.m */; }; - BC9B83510FB8A1400035D8DA /* CPTPlotSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82D10FB89E610035D8DA /* CPTPlotSymbol.m */; }; - BC9B83520FB8A1400035D8DA /* CPTPlotSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82C70FB89E610035D8DA /* CPTPlotSpace.m */; }; - BC9B83550FB8A1400035D8DA /* CPTPlotAreaFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82C20FB89E610035D8DA /* CPTPlotAreaFrame.m */; }; - BC9B83560FB8A1400035D8DA /* CPTGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82B70FB89E610035D8DA /* CPTGraph.m */; }; - BC9B83570FB8A1400035D8DA /* CPTXYGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82B90FB89E610035D8DA /* CPTXYGraph.m */; }; - BC9B835A0FB8A1400035D8DA /* NSDecimalNumberExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82B20FB89E610035D8DA /* NSDecimalNumberExtensions.m */; }; - BC9B835B0FB8A1400035D8DA /* NSNumberExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82B40FB89E610035D8DA /* NSNumberExtensions.m */; }; - BC9B835D0FB8A1400035D8DA /* CPTDefinitions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82A40FB89E610035D8DA /* CPTDefinitions.m */; }; - BC9B835E0FB8A1400035D8DA /* CPTExceptions.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82A60FB89E610035D8DA /* CPTExceptions.m */; }; - BC9B835F0FB8A1400035D8DA /* CPTUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82A80FB89E610035D8DA /* CPTUtilities.m */; }; - BC9B83600FB8A1400035D8DA /* CPTPlotRange.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82AC0FB89E610035D8DA /* CPTPlotRange.m */; }; - BC9B83610FB8A1400035D8DA /* CPTFill.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B82890FB89E610035D8DA /* CPTFill.m */; }; - BC9B83620FB8A1400035D8DA /* _CPTFillColor.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B828B0FB89E610035D8DA /* _CPTFillColor.m */; }; - BC9B83630FB8A1400035D8DA /* _CPTFillGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B828D0FB89E610035D8DA /* _CPTFillGradient.m */; }; - BC9B83640FB8A1400035D8DA /* _CPTFillImage.m in Sources */ = {isa = PBXBuildFile; fileRef = BC9B828F0FB89E610035D8DA /* _CPTFillImage.m */; }; - BC9B836E0FB8A1700035D8DA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC9B82690FB89BD10035D8DA /* QuartzCore.framework */; }; - BC9B836F0FB8A1700035D8DA /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; - BC9B83700FB8A1700035D8DA /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; - BC9B83710FB8A1700035D8DA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; - BC9B83C30FB8AC4B0035D8DA /* CorePlot-CocoaTouch.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B83C20FB8AC4B0035D8DA /* CorePlot-CocoaTouch.h */; settings = {ATTRIBUTES = (); }; }; - BCC7EA451006BF5700B39451 /* _CPTPlainBlackTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC7EA3F1006BF5700B39451 /* _CPTPlainBlackTheme.h */; settings = {ATTRIBUTES = (); }; }; - BCC7EA461006BF5700B39451 /* _CPTPlainBlackTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC7EA401006BF5700B39451 /* _CPTPlainBlackTheme.m */; }; - BCC7EA471006BF5700B39451 /* _CPTPlainWhiteTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC7EA411006BF5700B39451 /* _CPTPlainWhiteTheme.h */; settings = {ATTRIBUTES = (); }; }; - BCC7EA481006BF5700B39451 /* _CPTPlainWhiteTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC7EA421006BF5700B39451 /* _CPTPlainWhiteTheme.m */; }; - BCC7EA491006BF5700B39451 /* _CPTStocksTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BCC7EA431006BF5700B39451 /* _CPTStocksTheme.h */; settings = {ATTRIBUTES = (); }; }; - BCC7EA4A1006BF5700B39451 /* _CPTStocksTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = BCC7EA441006BF5700B39451 /* _CPTStocksTheme.m */; }; - C304565313F4AC9A004D04BC /* _CPTDarkGradientTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = C304565213F4AC9A004D04BC /* _CPTDarkGradientTheme.h */; settings = {ATTRIBUTES = (); }; }; - C30550E91399BE2000E0151F /* CPTLegendEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = C30550E71399BE2000E0151F /* CPTLegendEntry.h */; settings = {ATTRIBUTES = (); }; }; - C30550EA1399BE2000E0151F /* CPTLegendEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = C30550E81399BE2000E0151F /* CPTLegendEntry.m */; }; - C30C85AB1047428100181766 /* CPTPlotGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = C30C85A91047428100181766 /* CPTPlotGroup.h */; settings = {ATTRIBUTES = (); }; }; - C30C85AC1047428100181766 /* CPTPlotGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = C30C85AA1047428100181766 /* CPTPlotGroup.m */; }; - C318F4C111EA18A400595FF9 /* CPTLimitBand.h in Headers */ = {isa = PBXBuildFile; fileRef = C318F4BF11EA18A400595FF9 /* CPTLimitBand.h */; settings = {ATTRIBUTES = (); }; }; - C318F4C211EA18A400595FF9 /* CPTLimitBand.m in Sources */ = {isa = PBXBuildFile; fileRef = C318F4C011EA18A400595FF9 /* CPTLimitBand.m */; }; - C31A40BF17ABD6C60020C5C6 /* CPTFunctionDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C31A40BD17ABD6C60020C5C6 /* CPTFunctionDataSource.h */; }; - C31A40C017ABD6C60020C5C6 /* CPTFunctionDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = C31A40BE17ABD6C60020C5C6 /* CPTFunctionDataSource.m */; }; - C3286C0715D8769800A436A8 /* _CPTMaskLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = C3286C0515D8769800A436A8 /* _CPTMaskLayer.h */; settings = {ATTRIBUTES = (); }; }; - C3286C0815D8769800A436A8 /* _CPTMaskLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = C3286C0615D8769800A436A8 /* _CPTMaskLayer.m */; }; - C32EE1BD13EC4AF900038266 /* CPTShadow.h in Headers */ = {isa = PBXBuildFile; fileRef = C32EE1BB13EC4AF900038266 /* CPTShadow.h */; settings = {ATTRIBUTES = (); }; }; - C32EE1BE13EC4AF900038266 /* CPTShadow.m in Sources */ = {isa = PBXBuildFile; fileRef = C32EE1BC13EC4AF900038266 /* CPTShadow.m */; }; - C32EE1C813EC4C7200038266 /* CPTMutableShadow.h in Headers */ = {isa = PBXBuildFile; fileRef = C32EE1C613EC4C7200038266 /* CPTMutableShadow.h */; settings = {ATTRIBUTES = (); }; }; - C32EE1C913EC4C7200038266 /* CPTMutableShadow.m in Sources */ = {isa = PBXBuildFile; fileRef = C32EE1C713EC4C7200038266 /* CPTMutableShadow.m */; }; - C3392A361225F63B008DA6BD /* CPTNumericData+TypeConversion.m in Sources */ = {isa = PBXBuildFile; fileRef = C3392A351225F63B008DA6BD /* CPTNumericData+TypeConversion.m */; }; - C3408C4615FC1CA8004F1D70 /* _CPTBorderLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = C3408C4415FC1CA8004F1D70 /* _CPTBorderLayer.h */; settings = {ATTRIBUTES = (); }; }; - C3408C4715FC1CA8004F1D70 /* _CPTBorderLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = C3408C4515FC1CA8004F1D70 /* _CPTBorderLayer.m */; }; - C3436C4F13F4AC4400739AC2 /* _CPTDarkGradientTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = C3436C4E13F4AC4400739AC2 /* _CPTDarkGradientTheme.m */; }; - C3436C5113F4AC6000739AC2 /* _CPTSlateTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = C3436C5013F4AC6000739AC2 /* _CPTSlateTheme.h */; settings = {ATTRIBUTES = (); }; }; - C349DCB0151AAFAB00BFD6A7 /* CPTCalendarFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = C349DCAE151AAFAB00BFD6A7 /* CPTCalendarFormatter.h */; settings = {ATTRIBUTES = (); }; }; - C349DCB1151AAFAB00BFD6A7 /* CPTCalendarFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C349DCAF151AAFAB00BFD6A7 /* CPTCalendarFormatter.m */; }; - C35A65A511025EDF00FE24BB /* CPTPlotArea.h in Headers */ = {isa = PBXBuildFile; fileRef = C35A65A311025EDF00FE24BB /* CPTPlotArea.h */; settings = {ATTRIBUTES = (); }; }; - C35A65A611025EDF00FE24BB /* CPTPlotArea.m in Sources */ = {isa = PBXBuildFile; fileRef = C35A65A411025EDF00FE24BB /* CPTPlotArea.m */; }; - C35A65B311025F8A00FE24BB /* CPTGridLines.h in Headers */ = {isa = PBXBuildFile; fileRef = C35A65B111025F8A00FE24BB /* CPTGridLines.h */; settings = {ATTRIBUTES = (); }; }; - C35A65B411025F8A00FE24BB /* CPTGridLines.m in Sources */ = {isa = PBXBuildFile; fileRef = C35A65B211025F8A00FE24BB /* CPTGridLines.m */; }; - C35A65B911025FA900FE24BB /* CPTAxisLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = C35A65B511025FA900FE24BB /* CPTAxisLabel.h */; settings = {ATTRIBUTES = (); }; }; - C35A65BA11025FA900FE24BB /* CPTAxisLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = C35A65B611025FA900FE24BB /* CPTAxisLabel.m */; }; - C35A65BB11025FA900FE24BB /* CPTAxisTitle.h in Headers */ = {isa = PBXBuildFile; fileRef = C35A65B711025FA900FE24BB /* CPTAxisTitle.h */; settings = {ATTRIBUTES = (); }; }; - C35A65BC11025FA900FE24BB /* CPTAxisTitle.m in Sources */ = {isa = PBXBuildFile; fileRef = C35A65B811025FA900FE24BB /* CPTAxisTitle.m */; }; - C35A65BF11025FB300FE24BB /* CPTAxisLabelGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = C35A65BD11025FB300FE24BB /* CPTAxisLabelGroup.h */; settings = {ATTRIBUTES = (); }; }; - C35A65C011025FB300FE24BB /* CPTAxisLabelGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = C35A65BE11025FB300FE24BB /* CPTAxisLabelGroup.m */; }; - C35A65C711025FCC00FE24BB /* CPTXYAxis.h in Headers */ = {isa = PBXBuildFile; fileRef = C35A65C111025FCC00FE24BB /* CPTXYAxis.h */; settings = {ATTRIBUTES = (); }; }; - C35A65C811025FCC00FE24BB /* CPTXYAxis.m in Sources */ = {isa = PBXBuildFile; fileRef = C35A65C211025FCC00FE24BB /* CPTXYAxis.m */; }; - C35A65C911025FCC00FE24BB /* CPTXYAxisSet.h in Headers */ = {isa = PBXBuildFile; fileRef = C35A65C311025FCC00FE24BB /* CPTXYAxisSet.h */; settings = {ATTRIBUTES = (); }; }; - C35A65CA11025FCC00FE24BB /* CPTXYAxisSet.m in Sources */ = {isa = PBXBuildFile; fileRef = C35A65C411025FCC00FE24BB /* CPTXYAxisSet.m */; }; - C35A66071102723E00FE24BB /* CPTTextStylePlatformSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = C35A66051102723E00FE24BB /* CPTTextStylePlatformSpecific.h */; settings = {ATTRIBUTES = (); }; }; - C35A66081102723E00FE24BB /* CPTTextStylePlatformSpecific.m in Sources */ = {isa = PBXBuildFile; fileRef = C35A66061102723E00FE24BB /* CPTTextStylePlatformSpecific.m */; }; - C3791D05191D4C2F001EC514 /* CPTImagePlatformSpecific.m in Sources */ = {isa = PBXBuildFile; fileRef = C3791D03191D4C2F001EC514 /* CPTImagePlatformSpecific.m */; }; - C38DD49711A04B99002A68E7 /* CPTGridLineGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = C38DD49511A04B99002A68E7 /* CPTGridLineGroup.h */; settings = {ATTRIBUTES = (); }; }; - C38DD49811A04B99002A68E7 /* CPTGridLineGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = C38DD49611A04B99002A68E7 /* CPTGridLineGroup.m */; }; - C3920ACF1395B7680045F3BB /* CPTLegend.h in Headers */ = {isa = PBXBuildFile; fileRef = C3920ACD1395B7680045F3BB /* CPTLegend.h */; settings = {ATTRIBUTES = (); }; }; - C3920AD01395B7680045F3BB /* CPTLegend.m in Sources */ = {isa = PBXBuildFile; fileRef = C3920ACE1395B7680045F3BB /* CPTLegend.m */; }; - C3978E1013CE65C600A420D9 /* NSCoderExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = C3978E0E13CE65C600A420D9 /* NSCoderExtensions.h */; settings = {ATTRIBUTES = (); }; }; - C3978E1113CE65C600A420D9 /* NSCoderExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = C3978E0F13CE65C600A420D9 /* NSCoderExtensions.m */; }; - C3A695E1146A196100AF5653 /* CPTMutablePlotRange.h in Headers */ = {isa = PBXBuildFile; fileRef = C3A695DF146A196100AF5653 /* CPTMutablePlotRange.h */; settings = {ATTRIBUTES = (); }; }; - C3A695E2146A196100AF5653 /* CPTMutablePlotRange.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A695E0146A196100AF5653 /* CPTMutablePlotRange.m */; }; - C3B623C0107EC9370009EF0B /* CPTBarPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82DA0FB89E610035D8DA /* CPTBarPlot.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C1107EC9400009EF0B /* CPTDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82A30FB89E610035D8DA /* CPTDefinitions.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C2107EC9430009EF0B /* CPTExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82A50FB89E610035D8DA /* CPTExceptions.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C3107EC94D0009EF0B /* CPTFill.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82880FB89E610035D8DA /* CPTFill.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C4107EC94E0009EF0B /* CPTGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82980FB89E610035D8DA /* CPTGradient.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C5107EC9500009EF0B /* CPTGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82B60FB89E610035D8DA /* CPTGraph.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C6107EC9510009EF0B /* CPTImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B829A0FB89E610035D8DA /* CPTImage.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C7107EC9540009EF0B /* CPTLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B826F0FB89E610035D8DA /* CPTLayer.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C8107EC9570009EF0B /* CPTLineStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B829C0FB89E610035D8DA /* CPTLineStyle.h */; settings = {ATTRIBUTES = (); }; }; - C3B623C9107EC95C0009EF0B /* CPTPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82D20FB89E610035D8DA /* CPTPlot.h */; settings = {ATTRIBUTES = (); }; }; - C3B623CA107EC95E0009EF0B /* CPTPlotAreaFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82C10FB89E610035D8DA /* CPTPlotAreaFrame.h */; settings = {ATTRIBUTES = (); }; }; - C3B623CB107EC9610009EF0B /* CPTPlotRange.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82AB0FB89E610035D8DA /* CPTPlotRange.h */; settings = {ATTRIBUTES = (); }; }; - C3B623CC107EC9620009EF0B /* CPTPlotSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82C60FB89E610035D8DA /* CPTPlotSpace.h */; settings = {ATTRIBUTES = (); }; }; - C3B623CD107EC9630009EF0B /* CPTPlotSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82D00FB89E610035D8DA /* CPTPlotSymbol.h */; settings = {ATTRIBUTES = (); }; }; - C3B623CF107EC9680009EF0B /* CPTScatterPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82D40FB89E610035D8DA /* CPTScatterPlot.h */; settings = {ATTRIBUTES = (); }; }; - C3B623D1107EC96E0009EF0B /* CPTUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82A70FB89E610035D8DA /* CPTUtilities.h */; settings = {ATTRIBUTES = (); }; }; - C3B623D2107EC9760009EF0B /* CPTXYGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82B80FB89E610035D8DA /* CPTXYGraph.h */; settings = {ATTRIBUTES = (); }; }; - C3B623D3107EC97A0009EF0B /* NSNumberExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B82B30FB89E610035D8DA /* NSNumberExtensions.h */; settings = {ATTRIBUTES = (); }; }; - C3B623D4107EC9800009EF0B /* _CPTFillColor.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B828A0FB89E610035D8DA /* _CPTFillColor.h */; settings = {ATTRIBUTES = (); }; }; - C3B623D5107EC9820009EF0B /* _CPTFillGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B828C0FB89E610035D8DA /* _CPTFillGradient.h */; settings = {ATTRIBUTES = (); }; }; - C3B623D6107EC9830009EF0B /* _CPTFillImage.h in Headers */ = {isa = PBXBuildFile; fileRef = BC9B828E0FB89E610035D8DA /* _CPTFillImage.h */; settings = {ATTRIBUTES = (); }; }; - C3C68320166138E200340E39 /* CPTAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C68318166138E200340E39 /* CPTAnimation.h */; }; - C3C68321166138E200340E39 /* CPTAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C68319166138E200340E39 /* CPTAnimation.m */; }; - C3C68322166138E200340E39 /* CPTAnimationOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C6831A166138E200340E39 /* CPTAnimationOperation.h */; }; - C3C68323166138E200340E39 /* CPTAnimationOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C6831B166138E200340E39 /* CPTAnimationOperation.m */; }; - C3C68324166138E200340E39 /* CPTAnimationPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C6831C166138E200340E39 /* CPTAnimationPeriod.h */; }; - C3C68325166138E200340E39 /* CPTAnimationPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C6831D166138E200340E39 /* CPTAnimationPeriod.m */; }; - C3C68326166138E200340E39 /* _CPTAnimationTimingFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C6831E166138E200340E39 /* _CPTAnimationTimingFunctions.h */; }; - C3C68327166138E200340E39 /* _CPTAnimationTimingFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C6831F166138E200340E39 /* _CPTAnimationTimingFunctions.m */; }; - C3C683341661391A00340E39 /* _CPTAnimationCGFloatPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C683281661391A00340E39 /* _CPTAnimationCGFloatPeriod.h */; }; - C3C683351661391A00340E39 /* _CPTAnimationCGFloatPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C683291661391A00340E39 /* _CPTAnimationCGFloatPeriod.m */; }; - C3C683361661391A00340E39 /* _CPTAnimationCGPointPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C6832A1661391A00340E39 /* _CPTAnimationCGPointPeriod.h */; }; - C3C683371661391A00340E39 /* _CPTAnimationCGPointPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C6832B1661391A00340E39 /* _CPTAnimationCGPointPeriod.m */; }; - C3C683381661391A00340E39 /* _CPTAnimationCGRectPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C6832C1661391A00340E39 /* _CPTAnimationCGRectPeriod.h */; }; - C3C683391661391A00340E39 /* _CPTAnimationCGRectPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C6832D1661391A00340E39 /* _CPTAnimationCGRectPeriod.m */; }; - C3C6833A1661391A00340E39 /* _CPTAnimationCGSizePeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C6832E1661391A00340E39 /* _CPTAnimationCGSizePeriod.h */; }; - C3C6833B1661391A00340E39 /* _CPTAnimationCGSizePeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C6832F1661391A00340E39 /* _CPTAnimationCGSizePeriod.m */; }; - C3C6833C1661391A00340E39 /* _CPTAnimationNSDecimalPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C683301661391A00340E39 /* _CPTAnimationNSDecimalPeriod.h */; }; - C3C6833D1661391A00340E39 /* _CPTAnimationNSDecimalPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C683311661391A00340E39 /* _CPTAnimationNSDecimalPeriod.m */; }; - C3C6833E1661391A00340E39 /* _CPTAnimationPlotRangePeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C683321661391A00340E39 /* _CPTAnimationPlotRangePeriod.h */; }; - C3C6833F1661391A00340E39 /* _CPTAnimationPlotRangePeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C683331661391A00340E39 /* _CPTAnimationPlotRangePeriod.m */; }; - C3CAFB3B1229E48200F5C989 /* CPTMutableNumericData+TypeConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CAFB391229E48200F5C989 /* CPTMutableNumericData+TypeConversion.h */; settings = {ATTRIBUTES = (); }; }; - C3CAFB3C1229E48200F5C989 /* CPTMutableNumericData+TypeConversion.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CAFB3A1229E48200F5C989 /* CPTMutableNumericData+TypeConversion.m */; }; - C3CCA04813E8D94800CE6DB1 /* _CPTConstraintsFixed.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CCA04413E8D94800CE6DB1 /* _CPTConstraintsFixed.h */; settings = {ATTRIBUTES = (); }; }; - C3CCA04913E8D94800CE6DB1 /* _CPTConstraintsFixed.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CCA04513E8D94800CE6DB1 /* _CPTConstraintsFixed.m */; }; - C3CCA04A13E8D94800CE6DB1 /* _CPTConstraintsRelative.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CCA04613E8D94800CE6DB1 /* _CPTConstraintsRelative.h */; settings = {ATTRIBUTES = (); }; }; - C3CCA04B13E8D94800CE6DB1 /* _CPTConstraintsRelative.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CCA04713E8D94800CE6DB1 /* _CPTConstraintsRelative.m */; }; - C3CD282817DE957C008EED1E /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3CD282717DE957C008EED1E /* Accelerate.framework */; }; - C3D3AD3413DF8E9D0004EA73 /* CPTLineCap.h in Headers */ = {isa = PBXBuildFile; fileRef = C3D3AD3213DF8E9D0004EA73 /* CPTLineCap.h */; settings = {ATTRIBUTES = (); }; }; - C3D3AD3513DF8E9D0004EA73 /* CPTLineCap.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D3AD3313DF8E9D0004EA73 /* CPTLineCap.m */; }; - C3D68B091221650C00EB4863 /* CPTMutableNumericData.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CADE3D11B188C500D36017 /* CPTMutableNumericData.h */; settings = {ATTRIBUTES = (); }; }; - C3D68B0A1221650D00EB4863 /* CPTMutableNumericData.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CADE3E11B188C500D36017 /* CPTMutableNumericData.m */; }; - C3D68B0B1221650E00EB4863 /* CPTNumericData+TypeConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CADE3211B188A800D36017 /* CPTNumericData+TypeConversion.h */; settings = {ATTRIBUTES = (); }; }; - C3D68B0D1221651200EB4863 /* CPTNumericData.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CADE3011B188A800D36017 /* CPTNumericData.h */; settings = {ATTRIBUTES = (); }; }; - C3D68B0E1221651200EB4863 /* CPTNumericData.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CADE3111B188A800D36017 /* CPTNumericData.m */; }; - C3D68B0F1221651500EB4863 /* CPTNumericDataType.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CADE3911B188B600D36017 /* CPTNumericDataType.h */; settings = {ATTRIBUTES = (); }; }; - C3D68B101221651600EB4863 /* CPTNumericDataType.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CADE3A11B188B600D36017 /* CPTNumericDataType.m */; }; - C3D9825116BD406600DE7977 /* CorePlot_Prefix.pch in Headers */ = {isa = PBXBuildFile; fileRef = C3D9825016BD406600DE7977 /* CorePlot_Prefix.pch */; }; - C40CFB94107EC1B40057E828 /* _CPTXYTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = C40CFB92107EC1B40057E828 /* _CPTXYTheme.h */; settings = {ATTRIBUTES = (); }; }; - C40CFB95107EC1B40057E828 /* _CPTXYTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = C40CFB93107EC1B40057E828 /* _CPTXYTheme.m */; }; - D0C047BF12D6568500DA8047 /* CPTRangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C047BD12D6568500DA8047 /* CPTRangePlot.m */; }; - D0C047C012D6568500DA8047 /* CPTRangePlot.h in Headers */ = {isa = PBXBuildFile; fileRef = D0C047BE12D6568500DA8047 /* CPTRangePlot.h */; settings = {ATTRIBUTES = (); }; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 070CB8300FC9DEA800F3152B /* CPTColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTColor.h; path = Source/CPTColor.h; sourceTree = ""; }; - 070CB8310FC9DEA800F3152B /* CPTColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTColor.m; path = Source/CPTColor.m; sourceTree = ""; }; - 070CB8320FC9DEA800F3152B /* CPTColorSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTColorSpace.h; path = Source/CPTColorSpace.h; sourceTree = ""; }; - 070CB8330FC9DEA800F3152B /* CPTColorSpace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTColorSpace.m; path = Source/CPTColorSpace.m; sourceTree = ""; }; - 070CB8390FC9DED400F3152B /* CPTAxis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAxis.h; path = Source/CPTAxis.h; sourceTree = ""; }; - 070CB83A0FC9DED400F3152B /* CPTAxis.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAxis.m; path = Source/CPTAxis.m; sourceTree = ""; }; - 070CB83D0FC9DED400F3152B /* CPTAxisSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAxisSet.h; path = Source/CPTAxisSet.h; sourceTree = ""; }; - 070CB83E0FC9DED400F3152B /* CPTAxisSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAxisSet.m; path = Source/CPTAxisSet.m; sourceTree = ""; }; - 0718DE4511D1EDBA00AF4851 /* CPTAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAnnotation.h; path = Source/CPTAnnotation.h; sourceTree = ""; }; - 0718DE4611D1EDBA00AF4851 /* CPTAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAnnotation.m; path = Source/CPTAnnotation.m; sourceTree = ""; }; - 0718DE4711D1EDBA00AF4851 /* CPTAnnotationHostLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAnnotationHostLayer.h; path = Source/CPTAnnotationHostLayer.h; sourceTree = ""; }; - 0718DE4811D1EDBA00AF4851 /* CPTAnnotationHostLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAnnotationHostLayer.m; path = Source/CPTAnnotationHostLayer.m; sourceTree = ""; }; - 0718DE4911D1EDBA00AF4851 /* CPTLayerAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTLayerAnnotation.h; path = Source/CPTLayerAnnotation.h; sourceTree = ""; }; - 0718DE4A11D1EDBA00AF4851 /* CPTLayerAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTLayerAnnotation.m; path = Source/CPTLayerAnnotation.m; sourceTree = ""; }; - 0718DE4B11D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotSpaceAnnotation.h; path = Source/CPTPlotSpaceAnnotation.h; sourceTree = ""; }; - 0718DE4C11D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotSpaceAnnotation.m; path = Source/CPTPlotSpaceAnnotation.m; sourceTree = ""; }; - 071F3CDF10FBAB9D00D0A7B6 /* License.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = License.txt; path = ../License.txt; sourceTree = SOURCE_ROOT; }; - 072E3F9B0FE2FF7300ACF62F /* CPTTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTTheme.h; path = Source/CPTTheme.h; sourceTree = ""; }; - 072E3F9C0FE2FF7300ACF62F /* CPTTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTTheme.m; path = Source/CPTTheme.m; sourceTree = ""; }; - 074D7BC30FD6B65E006011BC /* CPTXYPlotSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTXYPlotSpace.h; path = Source/CPTXYPlotSpace.h; sourceTree = ""; }; - 074D7BC40FD6B65F006011BC /* CPTXYPlotSpace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTXYPlotSpace.m; path = Source/CPTXYPlotSpace.m; sourceTree = ""; }; - 074FADF7112024C500394B90 /* CPTConstraints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTConstraints.h; path = Source/CPTConstraints.h; sourceTree = ""; }; - 074FADF8112024C500394B90 /* CPTConstraints.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTConstraints.m; path = Source/CPTConstraints.m; sourceTree = ""; }; - 0772B4F110E26A12009CD04C /* CPTTradingRangePlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTTradingRangePlot.h; path = Source/CPTTradingRangePlot.h; sourceTree = ""; }; - 0772B4F210E26A12009CD04C /* CPTTradingRangePlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTTradingRangePlot.m; path = Source/CPTTradingRangePlot.m; sourceTree = ""; }; - 077F28510FE18048000BCA52 /* CPTBorderedLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTBorderedLayer.h; path = Source/CPTBorderedLayer.h; sourceTree = ""; }; - 077F28520FE18048000BCA52 /* CPTBorderedLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTBorderedLayer.m; path = Source/CPTBorderedLayer.m; sourceTree = ""; }; - 077F28530FE18048000BCA52 /* CPTPathExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPathExtensions.h; path = Source/CPTPathExtensions.h; sourceTree = ""; }; - 077F28540FE18048000BCA52 /* CPTPathExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPathExtensions.m; path = Source/CPTPathExtensions.m; sourceTree = ""; }; - 0789EFB80FB9F97F00C0A613 /* CPTPlatformSpecificCategories.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlatformSpecificCategories.h; sourceTree = ""; }; - 0789EFB90FB9F97F00C0A613 /* CPTPlatformSpecificCategories.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTPlatformSpecificCategories.m; sourceTree = ""; }; - 0789EFBA0FB9F97F00C0A613 /* CPTPlatformSpecificDefines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlatformSpecificDefines.h; sourceTree = ""; }; - 0789EFBB0FB9F97F00C0A613 /* CPTPlatformSpecificDefines.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTPlatformSpecificDefines.m; sourceTree = ""; }; - 0789EFBC0FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlatformSpecificFunctions.h; sourceTree = ""; }; - 0789EFBD0FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTPlatformSpecificFunctions.m; sourceTree = ""; }; - 07A2E71C102DFAD300809BC5 /* CPTTimeFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTTimeFormatter.h; path = Source/CPTTimeFormatter.h; sourceTree = ""; }; - 07A2E71D102DFAD300809BC5 /* CPTTimeFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTTimeFormatter.m; path = Source/CPTTimeFormatter.m; sourceTree = ""; }; - 07A62FB30FE2234900CD765C /* CPTTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = CPTTextStyle.h; path = Source/CPTTextStyle.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 07A62FB40FE2234900CD765C /* CPTTextStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTTextStyle.m; path = Source/CPTTextStyle.m; sourceTree = ""; }; - 07AEF30110BBF99A0012BEFF /* CPTResponder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTResponder.h; path = Source/CPTResponder.h; sourceTree = ""; }; - 07B69AB712B6281100F4C16C /* CPTMutableTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTMutableTextStyle.h; path = Source/CPTMutableTextStyle.h; sourceTree = ""; }; - 07B69AB812B6281100F4C16C /* CPTMutableTextStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTMutableTextStyle.m; path = Source/CPTMutableTextStyle.m; sourceTree = ""; }; - 07B69B6F12B62E9600F4C16C /* CPTMutableLineStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTMutableLineStyle.h; path = Source/CPTMutableLineStyle.h; sourceTree = ""; }; - 07B69B7012B62E9600F4C16C /* CPTMutableLineStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTMutableLineStyle.m; path = Source/CPTMutableLineStyle.m; sourceTree = ""; }; - 07FCF2D2115B54DE00E46606 /* _CPTSlateTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTSlateTheme.m; path = Source/_CPTSlateTheme.m; sourceTree = ""; }; - 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; - 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; - BC74A2C010FC087800E7E90D /* CPTPieChart.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPieChart.h; path = Source/CPTPieChart.h; sourceTree = ""; }; - BC74A2C110FC087800E7E90D /* CPTPieChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPieChart.m; path = Source/CPTPieChart.m; sourceTree = ""; }; - BC79F1D30FD1DC1A00510976 /* CPTGraphHostingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGraphHostingView.h; sourceTree = ""; }; - BC79F1D40FD1DC1A00510976 /* CPTGraphHostingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTGraphHostingView.m; sourceTree = ""; }; - BC89A7991024AB19009D5261 /* CorePlotProbes.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; name = CorePlotProbes.d; path = TestResources/CorePlotProbes.d; sourceTree = ""; }; - BC9B82690FB89BD10035D8DA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - BC9B826F0FB89E610035D8DA /* CPTLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTLayer.h; path = Source/CPTLayer.h; sourceTree = ""; }; - BC9B82700FB89E610035D8DA /* CPTLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTLayer.m; path = Source/CPTLayer.m; sourceTree = ""; }; - BC9B82880FB89E610035D8DA /* CPTFill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTFill.h; path = Source/CPTFill.h; sourceTree = SOURCE_ROOT; }; - BC9B82890FB89E610035D8DA /* CPTFill.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTFill.m; path = Source/CPTFill.m; sourceTree = SOURCE_ROOT; }; - BC9B828A0FB89E610035D8DA /* _CPTFillColor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTFillColor.h; path = Source/_CPTFillColor.h; sourceTree = SOURCE_ROOT; }; - BC9B828B0FB89E610035D8DA /* _CPTFillColor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTFillColor.m; path = Source/_CPTFillColor.m; sourceTree = SOURCE_ROOT; }; - BC9B828C0FB89E610035D8DA /* _CPTFillGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTFillGradient.h; path = Source/_CPTFillGradient.h; sourceTree = SOURCE_ROOT; }; - BC9B828D0FB89E610035D8DA /* _CPTFillGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTFillGradient.m; path = Source/_CPTFillGradient.m; sourceTree = SOURCE_ROOT; }; - BC9B828E0FB89E610035D8DA /* _CPTFillImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTFillImage.h; path = Source/_CPTFillImage.h; sourceTree = SOURCE_ROOT; }; - BC9B828F0FB89E610035D8DA /* _CPTFillImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTFillImage.m; path = Source/_CPTFillImage.m; sourceTree = SOURCE_ROOT; }; - BC9B82980FB89E610035D8DA /* CPTGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTGradient.h; path = Source/CPTGradient.h; sourceTree = ""; }; - BC9B82990FB89E610035D8DA /* CPTGradient.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTGradient.m; path = Source/CPTGradient.m; sourceTree = ""; }; - BC9B829A0FB89E610035D8DA /* CPTImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; name = CPTImage.h; path = Source/CPTImage.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - BC9B829B0FB89E610035D8DA /* CPTImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTImage.m; path = Source/CPTImage.m; sourceTree = ""; }; - BC9B829C0FB89E610035D8DA /* CPTLineStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTLineStyle.h; path = Source/CPTLineStyle.h; sourceTree = ""; }; - BC9B829D0FB89E610035D8DA /* CPTLineStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTLineStyle.m; path = Source/CPTLineStyle.m; sourceTree = ""; }; - BC9B829E0FB89E610035D8DA /* CPTTextLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTTextLayer.h; path = Source/CPTTextLayer.h; sourceTree = ""; }; - BC9B829F0FB89E610035D8DA /* CPTTextLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTTextLayer.m; path = Source/CPTTextLayer.m; sourceTree = ""; }; - BC9B82A30FB89E610035D8DA /* CPTDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTDefinitions.h; path = Source/CPTDefinitions.h; sourceTree = SOURCE_ROOT; }; - BC9B82A40FB89E610035D8DA /* CPTDefinitions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTDefinitions.m; path = Source/CPTDefinitions.m; sourceTree = SOURCE_ROOT; }; - BC9B82A50FB89E610035D8DA /* CPTExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTExceptions.h; path = Source/CPTExceptions.h; sourceTree = SOURCE_ROOT; }; - BC9B82A60FB89E610035D8DA /* CPTExceptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTExceptions.m; path = Source/CPTExceptions.m; sourceTree = SOURCE_ROOT; }; - BC9B82A70FB89E610035D8DA /* CPTUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTUtilities.h; path = Source/CPTUtilities.h; sourceTree = SOURCE_ROOT; }; - BC9B82A80FB89E610035D8DA /* CPTUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTUtilities.m; path = Source/CPTUtilities.m; sourceTree = SOURCE_ROOT; }; - BC9B82AB0FB89E610035D8DA /* CPTPlotRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotRange.h; path = Source/CPTPlotRange.h; sourceTree = SOURCE_ROOT; }; - BC9B82AC0FB89E610035D8DA /* CPTPlotRange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotRange.m; path = Source/CPTPlotRange.m; sourceTree = SOURCE_ROOT; }; - BC9B82B10FB89E610035D8DA /* NSDecimalNumberExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSDecimalNumberExtensions.h; path = Source/NSDecimalNumberExtensions.h; sourceTree = SOURCE_ROOT; }; - BC9B82B20FB89E610035D8DA /* NSDecimalNumberExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSDecimalNumberExtensions.m; path = Source/NSDecimalNumberExtensions.m; sourceTree = SOURCE_ROOT; }; - BC9B82B30FB89E610035D8DA /* NSNumberExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSNumberExtensions.h; path = Source/NSNumberExtensions.h; sourceTree = SOURCE_ROOT; }; - BC9B82B40FB89E610035D8DA /* NSNumberExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSNumberExtensions.m; path = Source/NSNumberExtensions.m; sourceTree = SOURCE_ROOT; }; - BC9B82B60FB89E610035D8DA /* CPTGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTGraph.h; path = Source/CPTGraph.h; sourceTree = SOURCE_ROOT; }; - BC9B82B70FB89E610035D8DA /* CPTGraph.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTGraph.m; path = Source/CPTGraph.m; sourceTree = SOURCE_ROOT; }; - BC9B82B80FB89E610035D8DA /* CPTXYGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTXYGraph.h; path = Source/CPTXYGraph.h; sourceTree = SOURCE_ROOT; }; - BC9B82B90FB89E610035D8DA /* CPTXYGraph.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTXYGraph.m; path = Source/CPTXYGraph.m; sourceTree = SOURCE_ROOT; }; - BC9B82C10FB89E610035D8DA /* CPTPlotAreaFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotAreaFrame.h; path = Source/CPTPlotAreaFrame.h; sourceTree = ""; }; - BC9B82C20FB89E610035D8DA /* CPTPlotAreaFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotAreaFrame.m; path = Source/CPTPlotAreaFrame.m; sourceTree = ""; }; - BC9B82C60FB89E610035D8DA /* CPTPlotSpace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotSpace.h; path = Source/CPTPlotSpace.h; sourceTree = SOURCE_ROOT; }; - BC9B82C70FB89E610035D8DA /* CPTPlotSpace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotSpace.m; path = Source/CPTPlotSpace.m; sourceTree = SOURCE_ROOT; }; - BC9B82D00FB89E610035D8DA /* CPTPlotSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotSymbol.h; path = Source/CPTPlotSymbol.h; sourceTree = SOURCE_ROOT; }; - BC9B82D10FB89E610035D8DA /* CPTPlotSymbol.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotSymbol.m; path = Source/CPTPlotSymbol.m; sourceTree = SOURCE_ROOT; }; - BC9B82D20FB89E610035D8DA /* CPTPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlot.h; path = Source/CPTPlot.h; sourceTree = SOURCE_ROOT; }; - BC9B82D30FB89E610035D8DA /* CPTPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlot.m; path = Source/CPTPlot.m; sourceTree = SOURCE_ROOT; }; - BC9B82D40FB89E610035D8DA /* CPTScatterPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTScatterPlot.h; path = Source/CPTScatterPlot.h; sourceTree = SOURCE_ROOT; }; - BC9B82D50FB89E610035D8DA /* CPTScatterPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTScatterPlot.m; path = Source/CPTScatterPlot.m; sourceTree = SOURCE_ROOT; }; - BC9B82DA0FB89E610035D8DA /* CPTBarPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTBarPlot.h; path = Source/CPTBarPlot.h; sourceTree = SOURCE_ROOT; }; - BC9B82DB0FB89E610035D8DA /* CPTBarPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTBarPlot.m; path = Source/CPTBarPlot.m; sourceTree = SOURCE_ROOT; }; - BC9B83470FB8A0A40035D8DA /* libCorePlot-CocoaTouch.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libCorePlot-CocoaTouch.a"; sourceTree = BUILT_PRODUCTS_DIR; }; - BC9B83C20FB8AC4B0035D8DA /* CorePlot-CocoaTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CorePlot-CocoaTouch.h"; sourceTree = SOURCE_ROOT; }; - BCC7EA3F1006BF5700B39451 /* _CPTPlainBlackTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTPlainBlackTheme.h; path = Source/_CPTPlainBlackTheme.h; sourceTree = ""; }; - BCC7EA401006BF5700B39451 /* _CPTPlainBlackTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTPlainBlackTheme.m; path = Source/_CPTPlainBlackTheme.m; sourceTree = ""; }; - BCC7EA411006BF5700B39451 /* _CPTPlainWhiteTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTPlainWhiteTheme.h; path = Source/_CPTPlainWhiteTheme.h; sourceTree = ""; }; - BCC7EA421006BF5700B39451 /* _CPTPlainWhiteTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTPlainWhiteTheme.m; path = Source/_CPTPlainWhiteTheme.m; sourceTree = ""; }; - BCC7EA431006BF5700B39451 /* _CPTStocksTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTStocksTheme.h; path = Source/_CPTStocksTheme.h; sourceTree = ""; }; - BCC7EA441006BF5700B39451 /* _CPTStocksTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTStocksTheme.m; path = Source/_CPTStocksTheme.m; sourceTree = ""; }; - C302230B1BB8B49700514011 /* CorePlotDebug.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotDebug.xcconfig; path = xcconfig/CorePlotDebug.xcconfig; sourceTree = ""; }; - C302230C1BB8B49700514011 /* CorePlotRelease.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotRelease.xcconfig; path = xcconfig/CorePlotRelease.xcconfig; sourceTree = ""; }; - C304565213F4AC9A004D04BC /* _CPTDarkGradientTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTDarkGradientTheme.h; path = Source/_CPTDarkGradientTheme.h; sourceTree = ""; }; - C30550E71399BE2000E0151F /* CPTLegendEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTLegendEntry.h; path = Source/CPTLegendEntry.h; sourceTree = ""; }; - C30550E81399BE2000E0151F /* CPTLegendEntry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTLegendEntry.m; path = Source/CPTLegendEntry.m; sourceTree = ""; }; - C30C85A91047428100181766 /* CPTPlotGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotGroup.h; path = Source/CPTPlotGroup.h; sourceTree = ""; }; - C30C85AA1047428100181766 /* CPTPlotGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotGroup.m; path = Source/CPTPlotGroup.m; sourceTree = ""; }; - C30E97A014B290650012204A /* DoxygenLayout.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = DoxygenLayout.xml; path = ../documentation/doxygen/DoxygenLayout.xml; sourceTree = ""; }; - C318F4BF11EA18A400595FF9 /* CPTLimitBand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTLimitBand.h; path = Source/CPTLimitBand.h; sourceTree = ""; }; - C318F4C011EA18A400595FF9 /* CPTLimitBand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTLimitBand.m; path = Source/CPTLimitBand.m; sourceTree = ""; }; - C31908A3199813D400B61898 /* CorePlot.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlot.xcconfig; path = xcconfig/CorePlot.xcconfig; sourceTree = ""; }; - C31A40BD17ABD6C60020C5C6 /* CPTFunctionDataSource.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTFunctionDataSource.h; path = Source/CPTFunctionDataSource.h; sourceTree = ""; }; - C31A40BE17ABD6C60020C5C6 /* CPTFunctionDataSource.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTFunctionDataSource.m; path = Source/CPTFunctionDataSource.m; sourceTree = ""; }; - C3286C0515D8769800A436A8 /* _CPTMaskLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTMaskLayer.h; path = Source/_CPTMaskLayer.h; sourceTree = ""; }; - C3286C0615D8769800A436A8 /* _CPTMaskLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTMaskLayer.m; path = Source/_CPTMaskLayer.m; sourceTree = ""; }; - C32EE1BB13EC4AF900038266 /* CPTShadow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTShadow.h; path = Source/CPTShadow.h; sourceTree = ""; }; - C32EE1BC13EC4AF900038266 /* CPTShadow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTShadow.m; path = Source/CPTShadow.m; sourceTree = ""; }; - C32EE1C613EC4C7200038266 /* CPTMutableShadow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTMutableShadow.h; path = Source/CPTMutableShadow.h; sourceTree = ""; }; - C32EE1C713EC4C7200038266 /* CPTMutableShadow.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTMutableShadow.m; path = Source/CPTMutableShadow.m; sourceTree = ""; }; - C3392A351225F63B008DA6BD /* CPTNumericData+TypeConversion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "CPTNumericData+TypeConversion.m"; path = "Source/CPTNumericData+TypeConversion.m"; sourceTree = ""; }; - C3408C4415FC1CA8004F1D70 /* _CPTBorderLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTBorderLayer.h; path = Source/_CPTBorderLayer.h; sourceTree = ""; }; - C3408C4515FC1CA8004F1D70 /* _CPTBorderLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTBorderLayer.m; path = Source/_CPTBorderLayer.m; sourceTree = ""; }; - C3436C4E13F4AC4400739AC2 /* _CPTDarkGradientTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTDarkGradientTheme.m; path = Source/_CPTDarkGradientTheme.m; sourceTree = ""; }; - C3436C5013F4AC6000739AC2 /* _CPTSlateTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTSlateTheme.h; path = Source/_CPTSlateTheme.h; sourceTree = ""; }; - C349DCAE151AAFAB00BFD6A7 /* CPTCalendarFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTCalendarFormatter.h; path = Source/CPTCalendarFormatter.h; sourceTree = ""; }; - C349DCAF151AAFAB00BFD6A7 /* CPTCalendarFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTCalendarFormatter.m; path = Source/CPTCalendarFormatter.m; sourceTree = ""; }; - C34F570C19D8CE4300446248 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; - C3566B8C10EED17400FB3866 /* doxygen touch.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "doxygen touch.config"; path = "../documentation/doxygen/doxygen touch.config"; sourceTree = SOURCE_ROOT; }; - C3566B8D10EED17400FB3866 /* doxygen-cocoa-touch-tags.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "doxygen-cocoa-touch-tags.xml"; path = "../documentation/doxygen/doxygen-cocoa-touch-tags.xml"; sourceTree = SOURCE_ROOT; }; - C3566B8E10EED1B000FB3866 /* mainpage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mainpage.h; path = Source/mainpage.h; sourceTree = ""; }; - C35A65A311025EDF00FE24BB /* CPTPlotArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTPlotArea.h; path = Source/CPTPlotArea.h; sourceTree = ""; }; - C35A65A411025EDF00FE24BB /* CPTPlotArea.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTPlotArea.m; path = Source/CPTPlotArea.m; sourceTree = ""; }; - C35A65B111025F8A00FE24BB /* CPTGridLines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTGridLines.h; path = Source/CPTGridLines.h; sourceTree = ""; }; - C35A65B211025F8A00FE24BB /* CPTGridLines.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTGridLines.m; path = Source/CPTGridLines.m; sourceTree = ""; }; - C35A65B511025FA900FE24BB /* CPTAxisLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAxisLabel.h; path = Source/CPTAxisLabel.h; sourceTree = ""; }; - C35A65B611025FA900FE24BB /* CPTAxisLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAxisLabel.m; path = Source/CPTAxisLabel.m; sourceTree = ""; }; - C35A65B711025FA900FE24BB /* CPTAxisTitle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAxisTitle.h; path = Source/CPTAxisTitle.h; sourceTree = ""; }; - C35A65B811025FA900FE24BB /* CPTAxisTitle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAxisTitle.m; path = Source/CPTAxisTitle.m; sourceTree = ""; }; - C35A65BD11025FB300FE24BB /* CPTAxisLabelGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAxisLabelGroup.h; path = Source/CPTAxisLabelGroup.h; sourceTree = ""; }; - C35A65BE11025FB300FE24BB /* CPTAxisLabelGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAxisLabelGroup.m; path = Source/CPTAxisLabelGroup.m; sourceTree = ""; }; - C35A65C111025FCC00FE24BB /* CPTXYAxis.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTXYAxis.h; path = Source/CPTXYAxis.h; sourceTree = ""; }; - C35A65C211025FCC00FE24BB /* CPTXYAxis.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTXYAxis.m; path = Source/CPTXYAxis.m; sourceTree = ""; }; - C35A65C311025FCC00FE24BB /* CPTXYAxisSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTXYAxisSet.h; path = Source/CPTXYAxisSet.h; sourceTree = ""; }; - C35A65C411025FCC00FE24BB /* CPTXYAxisSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTXYAxisSet.m; path = Source/CPTXYAxisSet.m; sourceTree = ""; }; - C35A66051102723E00FE24BB /* CPTTextStylePlatformSpecific.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTTextStylePlatformSpecific.h; path = iPhoneOnly/CPTTextStylePlatformSpecific.h; sourceTree = ""; }; - C35A66061102723E00FE24BB /* CPTTextStylePlatformSpecific.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = CPTTextStylePlatformSpecific.m; path = iPhoneOnly/CPTTextStylePlatformSpecific.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - C3791D03191D4C2F001EC514 /* CPTImagePlatformSpecific.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = CPTImagePlatformSpecific.m; path = iPhoneOnly/CPTImagePlatformSpecific.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - C38DD49511A04B99002A68E7 /* CPTGridLineGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTGridLineGroup.h; path = Source/CPTGridLineGroup.h; sourceTree = ""; }; - C38DD49611A04B99002A68E7 /* CPTGridLineGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTGridLineGroup.m; path = Source/CPTGridLineGroup.m; sourceTree = ""; }; - C3920ACD1395B7680045F3BB /* CPTLegend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTLegend.h; path = Source/CPTLegend.h; sourceTree = ""; }; - C3920ACE1395B7680045F3BB /* CPTLegend.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTLegend.m; path = Source/CPTLegend.m; sourceTree = ""; }; - C3978E0E13CE65C600A420D9 /* NSCoderExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NSCoderExtensions.h; path = Source/NSCoderExtensions.h; sourceTree = ""; }; - C3978E0F13CE65C600A420D9 /* NSCoderExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = NSCoderExtensions.m; path = Source/NSCoderExtensions.m; sourceTree = ""; }; - C3A695DF146A196100AF5653 /* CPTMutablePlotRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTMutablePlotRange.h; path = Source/CPTMutablePlotRange.h; sourceTree = ""; }; - C3A695E0146A196100AF5653 /* CPTMutablePlotRange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTMutablePlotRange.m; path = Source/CPTMutablePlotRange.m; sourceTree = ""; }; - C3B25EE11AC23A930063CCD8 /* CorePlot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CorePlot.h; sourceTree = ""; }; - C3C68318166138E200340E39 /* CPTAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAnimation.h; path = Source/CPTAnimation.h; sourceTree = ""; }; - C3C68319166138E200340E39 /* CPTAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAnimation.m; path = Source/CPTAnimation.m; sourceTree = ""; }; - C3C6831A166138E200340E39 /* CPTAnimationOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAnimationOperation.h; path = Source/CPTAnimationOperation.h; sourceTree = ""; }; - C3C6831B166138E200340E39 /* CPTAnimationOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAnimationOperation.m; path = Source/CPTAnimationOperation.m; sourceTree = ""; }; - C3C6831C166138E200340E39 /* CPTAnimationPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTAnimationPeriod.h; path = Source/CPTAnimationPeriod.h; sourceTree = ""; }; - C3C6831D166138E200340E39 /* CPTAnimationPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTAnimationPeriod.m; path = Source/CPTAnimationPeriod.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - C3C6831E166138E200340E39 /* _CPTAnimationTimingFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTAnimationTimingFunctions.h; path = Source/_CPTAnimationTimingFunctions.h; sourceTree = ""; }; - C3C6831F166138E200340E39 /* _CPTAnimationTimingFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTAnimationTimingFunctions.m; path = Source/_CPTAnimationTimingFunctions.m; sourceTree = ""; }; - C3C683281661391A00340E39 /* _CPTAnimationCGFloatPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTAnimationCGFloatPeriod.h; path = Source/_CPTAnimationCGFloatPeriod.h; sourceTree = ""; }; - C3C683291661391A00340E39 /* _CPTAnimationCGFloatPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTAnimationCGFloatPeriod.m; path = Source/_CPTAnimationCGFloatPeriod.m; sourceTree = ""; }; - C3C6832A1661391A00340E39 /* _CPTAnimationCGPointPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTAnimationCGPointPeriod.h; path = Source/_CPTAnimationCGPointPeriod.h; sourceTree = ""; }; - C3C6832B1661391A00340E39 /* _CPTAnimationCGPointPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTAnimationCGPointPeriod.m; path = Source/_CPTAnimationCGPointPeriod.m; sourceTree = ""; }; - C3C6832C1661391A00340E39 /* _CPTAnimationCGRectPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTAnimationCGRectPeriod.h; path = Source/_CPTAnimationCGRectPeriod.h; sourceTree = ""; }; - C3C6832D1661391A00340E39 /* _CPTAnimationCGRectPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTAnimationCGRectPeriod.m; path = Source/_CPTAnimationCGRectPeriod.m; sourceTree = ""; }; - C3C6832E1661391A00340E39 /* _CPTAnimationCGSizePeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTAnimationCGSizePeriod.h; path = Source/_CPTAnimationCGSizePeriod.h; sourceTree = ""; }; - C3C6832F1661391A00340E39 /* _CPTAnimationCGSizePeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTAnimationCGSizePeriod.m; path = Source/_CPTAnimationCGSizePeriod.m; sourceTree = ""; }; - C3C683301661391A00340E39 /* _CPTAnimationNSDecimalPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTAnimationNSDecimalPeriod.h; path = Source/_CPTAnimationNSDecimalPeriod.h; sourceTree = ""; }; - C3C683311661391A00340E39 /* _CPTAnimationNSDecimalPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTAnimationNSDecimalPeriod.m; path = Source/_CPTAnimationNSDecimalPeriod.m; sourceTree = ""; }; - C3C683321661391A00340E39 /* _CPTAnimationPlotRangePeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTAnimationPlotRangePeriod.h; path = Source/_CPTAnimationPlotRangePeriod.h; sourceTree = ""; }; - C3C683331661391A00340E39 /* _CPTAnimationPlotRangePeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTAnimationPlotRangePeriod.m; path = Source/_CPTAnimationPlotRangePeriod.m; sourceTree = ""; }; - C3CADE2F11B1886B00D36017 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = license.txt; path = Source/license.txt; sourceTree = ""; }; - C3CADE3011B188A800D36017 /* CPTNumericData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTNumericData.h; path = Source/CPTNumericData.h; sourceTree = ""; }; - C3CADE3111B188A800D36017 /* CPTNumericData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTNumericData.m; path = Source/CPTNumericData.m; sourceTree = ""; }; - C3CADE3211B188A800D36017 /* CPTNumericData+TypeConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "CPTNumericData+TypeConversion.h"; path = "Source/CPTNumericData+TypeConversion.h"; sourceTree = ""; }; - C3CADE3411B188A800D36017 /* CPTNumericData+TypeConversions_Generation.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; name = "CPTNumericData+TypeConversions_Generation.py"; path = "Source/CPTNumericData+TypeConversions_Generation.py"; sourceTree = ""; }; - C3CADE3911B188B600D36017 /* CPTNumericDataType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTNumericDataType.h; path = Source/CPTNumericDataType.h; sourceTree = ""; }; - C3CADE3A11B188B600D36017 /* CPTNumericDataType.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTNumericDataType.m; path = Source/CPTNumericDataType.m; sourceTree = ""; }; - C3CADE3D11B188C500D36017 /* CPTMutableNumericData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTMutableNumericData.h; path = Source/CPTMutableNumericData.h; sourceTree = ""; }; - C3CADE3E11B188C500D36017 /* CPTMutableNumericData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTMutableNumericData.m; path = Source/CPTMutableNumericData.m; sourceTree = ""; }; - C3CAFB391229E48200F5C989 /* CPTMutableNumericData+TypeConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "CPTMutableNumericData+TypeConversion.h"; path = "Source/CPTMutableNumericData+TypeConversion.h"; sourceTree = ""; }; - C3CAFB3A1229E48200F5C989 /* CPTMutableNumericData+TypeConversion.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "CPTMutableNumericData+TypeConversion.m"; path = "Source/CPTMutableNumericData+TypeConversion.m"; sourceTree = ""; }; - C3CCA04413E8D94800CE6DB1 /* _CPTConstraintsFixed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTConstraintsFixed.h; path = Source/_CPTConstraintsFixed.h; sourceTree = ""; }; - C3CCA04513E8D94800CE6DB1 /* _CPTConstraintsFixed.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTConstraintsFixed.m; path = Source/_CPTConstraintsFixed.m; sourceTree = ""; }; - C3CCA04613E8D94800CE6DB1 /* _CPTConstraintsRelative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTConstraintsRelative.h; path = Source/_CPTConstraintsRelative.h; sourceTree = ""; }; - C3CCA04713E8D94800CE6DB1 /* _CPTConstraintsRelative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTConstraintsRelative.m; path = Source/_CPTConstraintsRelative.m; sourceTree = ""; }; - C3CD282717DE957C008EED1E /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; - C3D3AD3213DF8E9D0004EA73 /* CPTLineCap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTLineCap.h; path = Source/CPTLineCap.h; sourceTree = ""; }; - C3D3AD3313DF8E9D0004EA73 /* CPTLineCap.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTLineCap.m; path = Source/CPTLineCap.m; sourceTree = ""; }; - C3D9825016BD406600DE7977 /* CorePlot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePlot_Prefix.pch; sourceTree = ""; }; - C40CFB92107EC1B40057E828 /* _CPTXYTheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = _CPTXYTheme.h; path = Source/_CPTXYTheme.h; sourceTree = ""; }; - C40CFB93107EC1B40057E828 /* _CPTXYTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = _CPTXYTheme.m; path = Source/_CPTXYTheme.m; sourceTree = ""; }; - D0C047BD12D6568500DA8047 /* CPTRangePlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CPTRangePlot.m; path = Source/CPTRangePlot.m; sourceTree = ""; }; - D0C047BE12D6568500DA8047 /* CPTRangePlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CPTRangePlot.h; path = Source/CPTRangePlot.h; sourceTree = ""; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - BC9B83450FB8A0A40035D8DA /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - BC9B836E0FB8A1700035D8DA /* QuartzCore.framework in Frameworks */, - BC9B836F0FB8A1700035D8DA /* UIKit.framework in Frameworks */, - BC9B83700FB8A1700035D8DA /* Foundation.framework in Frameworks */, - BC9B83710FB8A1700035D8DA /* CoreGraphics.framework in Frameworks */, - C3CD282817DE957C008EED1E /* Accelerate.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 070CB80F0FC9DDD500F3152B /* Drawing */ = { - isa = PBXGroup; - children = ( - 070CB8300FC9DEA800F3152B /* CPTColor.h */, - 070CB8310FC9DEA800F3152B /* CPTColor.m */, - 070CB8320FC9DEA800F3152B /* CPTColorSpace.h */, - 070CB8330FC9DEA800F3152B /* CPTColorSpace.m */, - BC9B82980FB89E610035D8DA /* CPTGradient.h */, - BC9B82990FB89E610035D8DA /* CPTGradient.m */, - BC9B829A0FB89E610035D8DA /* CPTImage.h */, - BC9B829B0FB89E610035D8DA /* CPTImage.m */, - C3D3AD3213DF8E9D0004EA73 /* CPTLineCap.h */, - C3D3AD3313DF8E9D0004EA73 /* CPTLineCap.m */, - BC9B829C0FB89E610035D8DA /* CPTLineStyle.h */, - BC9B829D0FB89E610035D8DA /* CPTLineStyle.m */, - 07B69B6F12B62E9600F4C16C /* CPTMutableLineStyle.h */, - 07B69B7012B62E9600F4C16C /* CPTMutableLineStyle.m */, - 077F28530FE18048000BCA52 /* CPTPathExtensions.h */, - 077F28540FE18048000BCA52 /* CPTPathExtensions.m */, - C32EE1BB13EC4AF900038266 /* CPTShadow.h */, - C32EE1BC13EC4AF900038266 /* CPTShadow.m */, - C32EE1C613EC4C7200038266 /* CPTMutableShadow.h */, - C32EE1C713EC4C7200038266 /* CPTMutableShadow.m */, - BC9B82870FB89E610035D8DA /* Fills */, - C32DDEE3191C674600E0FE84 /* iPhone Specific */, - ); - name = Drawing; - sourceTree = ""; - }; - 070CB8100FC9DDED00F3152B /* Text */ = { - isa = PBXGroup; - children = ( - BC9B829E0FB89E610035D8DA /* CPTTextLayer.h */, - BC9B829F0FB89E610035D8DA /* CPTTextLayer.m */, - 07A62FB30FE2234900CD765C /* CPTTextStyle.h */, - 07A62FB40FE2234900CD765C /* CPTTextStyle.m */, - 07B69AB712B6281100F4C16C /* CPTMutableTextStyle.h */, - 07B69AB812B6281100F4C16C /* CPTMutableTextStyle.m */, - C35A6602110271EB00FE24BB /* iPhone Specific */, - ); - name = Text; - sourceTree = ""; - }; - 070CB8380FC9DEB900F3152B /* Axes */ = { - isa = PBXGroup; - children = ( - 070CB8390FC9DED400F3152B /* CPTAxis.h */, - 070CB83A0FC9DED400F3152B /* CPTAxis.m */, - 070CB83D0FC9DED400F3152B /* CPTAxisSet.h */, - 070CB83E0FC9DED400F3152B /* CPTAxisSet.m */, - C35A65B111025F8A00FE24BB /* CPTGridLines.h */, - C35A65B211025F8A00FE24BB /* CPTGridLines.m */, - C38DD49511A04B99002A68E7 /* CPTGridLineGroup.h */, - C38DD49611A04B99002A68E7 /* CPTGridLineGroup.m */, - C35A65A811025F2000FE24BB /* Labels */, - C35A65A911025F2B00FE24BB /* XY Axes */, - ); - name = Axes; - sourceTree = ""; - }; - 0718DE4411D1ED7D00AF4851 /* Annotations */ = { - isa = PBXGroup; - children = ( - 0718DE4511D1EDBA00AF4851 /* CPTAnnotation.h */, - 0718DE4611D1EDBA00AF4851 /* CPTAnnotation.m */, - 0718DE4711D1EDBA00AF4851 /* CPTAnnotationHostLayer.h */, - 0718DE4811D1EDBA00AF4851 /* CPTAnnotationHostLayer.m */, - 0718DE4911D1EDBA00AF4851 /* CPTLayerAnnotation.h */, - 0718DE4A11D1EDBA00AF4851 /* CPTLayerAnnotation.m */, - 0718DE4B11D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.h */, - 0718DE4C11D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.m */, - ); - name = Annotations; - sourceTree = ""; - }; - 072E3F980FE2FF3E00ACF62F /* Themes */ = { - isa = PBXGroup; - children = ( - 072E3F9B0FE2FF7300ACF62F /* CPTTheme.h */, - 072E3F9C0FE2FF7300ACF62F /* CPTTheme.m */, - C40CFB92107EC1B40057E828 /* _CPTXYTheme.h */, - C40CFB93107EC1B40057E828 /* _CPTXYTheme.m */, - C304565213F4AC9A004D04BC /* _CPTDarkGradientTheme.h */, - C3436C4E13F4AC4400739AC2 /* _CPTDarkGradientTheme.m */, - BCC7EA3F1006BF5700B39451 /* _CPTPlainBlackTheme.h */, - BCC7EA401006BF5700B39451 /* _CPTPlainBlackTheme.m */, - BCC7EA411006BF5700B39451 /* _CPTPlainWhiteTheme.h */, - BCC7EA421006BF5700B39451 /* _CPTPlainWhiteTheme.m */, - C3436C5013F4AC6000739AC2 /* _CPTSlateTheme.h */, - 07FCF2D2115B54DE00E46606 /* _CPTSlateTheme.m */, - BCC7EA431006BF5700B39451 /* _CPTStocksTheme.h */, - BCC7EA441006BF5700B39451 /* _CPTStocksTheme.m */, - ); - name = Themes; - sourceTree = ""; - }; - 077F28500FE18011000BCA52 /* Layers */ = { - isa = PBXGroup; - children = ( - BC9B826F0FB89E610035D8DA /* CPTLayer.h */, - BC9B82700FB89E610035D8DA /* CPTLayer.m */, - 077F28510FE18048000BCA52 /* CPTBorderedLayer.h */, - 077F28520FE18048000BCA52 /* CPTBorderedLayer.m */, - C3408C4415FC1CA8004F1D70 /* _CPTBorderLayer.h */, - C3408C4515FC1CA8004F1D70 /* _CPTBorderLayer.m */, - C3286C0515D8769800A436A8 /* _CPTMaskLayer.h */, - C3286C0615D8769800A436A8 /* _CPTMaskLayer.m */, - 07AEF30110BBF99A0012BEFF /* CPTResponder.h */, - ); - name = Layers; - sourceTree = ""; - }; - 0789EFB70FB9F97F00C0A613 /* iPhone Specific */ = { - isa = PBXGroup; - children = ( - 0789EFBA0FB9F97F00C0A613 /* CPTPlatformSpecificDefines.h */, - 0789EFBB0FB9F97F00C0A613 /* CPTPlatformSpecificDefines.m */, - 0789EFB80FB9F97F00C0A613 /* CPTPlatformSpecificCategories.h */, - 0789EFB90FB9F97F00C0A613 /* CPTPlatformSpecificCategories.m */, - 0789EFBC0FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.h */, - 0789EFBD0FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.m */, - BC79F1D30FD1DC1A00510976 /* CPTGraphHostingView.h */, - BC79F1D40FD1DC1A00510976 /* CPTGraphHostingView.m */, - ); - name = "iPhone Specific"; - path = iPhoneOnly; - sourceTree = ""; - }; - 07A2E717102DF9A500809BC5 /* Formatters */ = { - isa = PBXGroup; - children = ( - C349DCAE151AAFAB00BFD6A7 /* CPTCalendarFormatter.h */, - C349DCAF151AAFAB00BFD6A7 /* CPTCalendarFormatter.m */, - 07A2E71C102DFAD300809BC5 /* CPTTimeFormatter.h */, - 07A2E71D102DFAD300809BC5 /* CPTTimeFormatter.m */, - ); - name = Formatters; - sourceTree = ""; - }; - 19C28FACFE9D520D11CA2CBB /* Products */ = { - isa = PBXGroup; - children = ( - BC9B83470FB8A0A40035D8DA /* libCorePlot-CocoaTouch.a */, - ); - name = Products; - sourceTree = ""; - }; - 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { - isa = PBXGroup; - children = ( - BC9B82520FB89B420035D8DA /* Source */, - 0789EFB70FB9F97F00C0A613 /* iPhone Specific */, - C3566B8610EED12700FB3866 /* Documentation */, - C3B25EE01AC23A930063CCD8 /* CocoaPods */, - 29B97315FDCFA39411CA2CEA /* Other Sources */, - 29B97317FDCFA39411CA2CEA /* Resources */, - 29B97323FDCFA39411CA2CEA /* Frameworks */, - 19C28FACFE9D520D11CA2CBB /* Products */, - ); - indentWidth = 4; - name = CustomTemplate; - sourceTree = ""; - tabWidth = 4; - usesTabs = 0; - }; - 29B97315FDCFA39411CA2CEA /* Other Sources */ = { - isa = PBXGroup; - children = ( - BC89A7991024AB19009D5261 /* CorePlotProbes.d */, - BC9B83C20FB8AC4B0035D8DA /* CorePlot-CocoaTouch.h */, - C3D9825016BD406600DE7977 /* CorePlot_Prefix.pch */, - C302230B1BB8B49700514011 /* CorePlotDebug.xcconfig */, - C302230C1BB8B49700514011 /* CorePlotRelease.xcconfig */, - C31908A3199813D400B61898 /* CorePlot.xcconfig */, - C34F570C19D8CE4300446248 /* CorePlotWarnings.xcconfig */, - ); - name = "Other Sources"; - sourceTree = ""; - }; - 29B97317FDCFA39411CA2CEA /* Resources */ = { - isa = PBXGroup; - children = ( - 071F3CDF10FBAB9D00D0A7B6 /* License.txt */, - ); - name = Resources; - sourceTree = ""; - }; - 29B97323FDCFA39411CA2CEA /* Frameworks */ = { - isa = PBXGroup; - children = ( - BC9B82690FB89BD10035D8DA /* QuartzCore.framework */, - 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, - 1D30AB110D05D00D00671497 /* Foundation.framework */, - 288765A40DF7441C002DB57D /* CoreGraphics.framework */, - C3CD282717DE957C008EED1E /* Accelerate.framework */, - ); - name = Frameworks; - sourceTree = ""; - }; - BC9B82520FB89B420035D8DA /* Source */ = { - isa = PBXGroup; - children = ( - C3CADE2911B1885200D36017 /* Numeric Data */, - BC9B82A20FB89E610035D8DA /* Types and Functions */, - 077F28500FE18011000BCA52 /* Layers */, - C3C68316166138B500340E39 /* Animation */, - 0718DE4411D1ED7D00AF4851 /* Annotations */, - C3B623A9107EC5460009EF0B /* Layout */, - 070CB8100FC9DDED00F3152B /* Text */, - 070CB80F0FC9DDD500F3152B /* Drawing */, - 07A2E717102DF9A500809BC5 /* Formatters */, - BC9B82B00FB89E610035D8DA /* Categories */, - BC9B82B50FB89E610035D8DA /* Graphs */, - BC9B82C00FB89E610035D8DA /* Plot Areas */, - BC9B82C50FB89E610035D8DA /* Spaces */, - BC9B82CE0FB89E610035D8DA /* Plots */, - 070CB8380FC9DEB900F3152B /* Axes */, - C3920ACC1395B7410045F3BB /* Legends */, - 072E3F980FE2FF3E00ACF62F /* Themes */, - ); - name = Source; - sourceTree = ""; - }; - BC9B82870FB89E610035D8DA /* Fills */ = { - isa = PBXGroup; - children = ( - BC9B82880FB89E610035D8DA /* CPTFill.h */, - BC9B82890FB89E610035D8DA /* CPTFill.m */, - BC9B828A0FB89E610035D8DA /* _CPTFillColor.h */, - BC9B828B0FB89E610035D8DA /* _CPTFillColor.m */, - BC9B828C0FB89E610035D8DA /* _CPTFillGradient.h */, - BC9B828D0FB89E610035D8DA /* _CPTFillGradient.m */, - BC9B828E0FB89E610035D8DA /* _CPTFillImage.h */, - BC9B828F0FB89E610035D8DA /* _CPTFillImage.m */, - ); - name = Fills; - sourceTree = ""; - }; - BC9B82A20FB89E610035D8DA /* Types and Functions */ = { - isa = PBXGroup; - children = ( - BC9B82A30FB89E610035D8DA /* CPTDefinitions.h */, - BC9B82A40FB89E610035D8DA /* CPTDefinitions.m */, - BC9B82A50FB89E610035D8DA /* CPTExceptions.h */, - BC9B82A60FB89E610035D8DA /* CPTExceptions.m */, - BC9B82A70FB89E610035D8DA /* CPTUtilities.h */, - BC9B82A80FB89E610035D8DA /* CPTUtilities.m */, - BC9B82AB0FB89E610035D8DA /* CPTPlotRange.h */, - BC9B82AC0FB89E610035D8DA /* CPTPlotRange.m */, - C3A695DF146A196100AF5653 /* CPTMutablePlotRange.h */, - C3A695E0146A196100AF5653 /* CPTMutablePlotRange.m */, - C31A40BD17ABD6C60020C5C6 /* CPTFunctionDataSource.h */, - C31A40BE17ABD6C60020C5C6 /* CPTFunctionDataSource.m */, - ); - name = "Types and Functions"; - sourceTree = SOURCE_ROOT; - }; - BC9B82B00FB89E610035D8DA /* Categories */ = { - isa = PBXGroup; - children = ( - C3978E0E13CE65C600A420D9 /* NSCoderExtensions.h */, - C3978E0F13CE65C600A420D9 /* NSCoderExtensions.m */, - BC9B82B10FB89E610035D8DA /* NSDecimalNumberExtensions.h */, - BC9B82B20FB89E610035D8DA /* NSDecimalNumberExtensions.m */, - BC9B82B30FB89E610035D8DA /* NSNumberExtensions.h */, - BC9B82B40FB89E610035D8DA /* NSNumberExtensions.m */, - ); - name = Categories; - sourceTree = SOURCE_ROOT; - }; - BC9B82B50FB89E610035D8DA /* Graphs */ = { - isa = PBXGroup; - children = ( - BC9B82B60FB89E610035D8DA /* CPTGraph.h */, - BC9B82B70FB89E610035D8DA /* CPTGraph.m */, - BC9B82B80FB89E610035D8DA /* CPTXYGraph.h */, - BC9B82B90FB89E610035D8DA /* CPTXYGraph.m */, - ); - name = Graphs; - sourceTree = ""; - }; - BC9B82C00FB89E610035D8DA /* Plot Areas */ = { - isa = PBXGroup; - children = ( - BC9B82C10FB89E610035D8DA /* CPTPlotAreaFrame.h */, - BC9B82C20FB89E610035D8DA /* CPTPlotAreaFrame.m */, - C35A65A311025EDF00FE24BB /* CPTPlotArea.h */, - C35A65A411025EDF00FE24BB /* CPTPlotArea.m */, - C318F4BF11EA18A400595FF9 /* CPTLimitBand.h */, - C318F4C011EA18A400595FF9 /* CPTLimitBand.m */, - ); - name = "Plot Areas"; - sourceTree = SOURCE_ROOT; - }; - BC9B82C50FB89E610035D8DA /* Spaces */ = { - isa = PBXGroup; - children = ( - BC9B82C60FB89E610035D8DA /* CPTPlotSpace.h */, - BC9B82C70FB89E610035D8DA /* CPTPlotSpace.m */, - 074D7BC30FD6B65E006011BC /* CPTXYPlotSpace.h */, - 074D7BC40FD6B65F006011BC /* CPTXYPlotSpace.m */, - ); - name = Spaces; - sourceTree = SOURCE_ROOT; - }; - BC9B82CE0FB89E610035D8DA /* Plots */ = { - isa = PBXGroup; - children = ( - C30C85A91047428100181766 /* CPTPlotGroup.h */, - C30C85AA1047428100181766 /* CPTPlotGroup.m */, - BC9B82D20FB89E610035D8DA /* CPTPlot.h */, - BC9B82D30FB89E610035D8DA /* CPTPlot.m */, - BC9B82DA0FB89E610035D8DA /* CPTBarPlot.h */, - BC9B82DB0FB89E610035D8DA /* CPTBarPlot.m */, - BC74A2C010FC087800E7E90D /* CPTPieChart.h */, - BC74A2C110FC087800E7E90D /* CPTPieChart.m */, - D0C047BE12D6568500DA8047 /* CPTRangePlot.h */, - D0C047BD12D6568500DA8047 /* CPTRangePlot.m */, - BC9B82D40FB89E610035D8DA /* CPTScatterPlot.h */, - BC9B82D50FB89E610035D8DA /* CPTScatterPlot.m */, - 0772B4F110E26A12009CD04C /* CPTTradingRangePlot.h */, - 0772B4F210E26A12009CD04C /* CPTTradingRangePlot.m */, - BC9B82CF0FB89E610035D8DA /* Plot Symbols */, - ); - name = Plots; - sourceTree = SOURCE_ROOT; - }; - BC9B82CF0FB89E610035D8DA /* Plot Symbols */ = { - isa = PBXGroup; - children = ( - BC9B82D00FB89E610035D8DA /* CPTPlotSymbol.h */, - BC9B82D10FB89E610035D8DA /* CPTPlotSymbol.m */, - ); - name = "Plot Symbols"; - sourceTree = SOURCE_ROOT; - }; - C32DDEE3191C674600E0FE84 /* iPhone Specific */ = { - isa = PBXGroup; - children = ( - C3791D03191D4C2F001EC514 /* CPTImagePlatformSpecific.m */, - ); - name = "iPhone Specific"; - sourceTree = ""; - }; - C3566B8610EED12700FB3866 /* Documentation */ = { - isa = PBXGroup; - children = ( - C3566B8C10EED17400FB3866 /* doxygen touch.config */, - C3566B8E10EED1B000FB3866 /* mainpage.h */, - C3566B8D10EED17400FB3866 /* doxygen-cocoa-touch-tags.xml */, - C30E97A014B290650012204A /* DoxygenLayout.xml */, - ); - name = Documentation; - sourceTree = ""; - }; - C35A65A811025F2000FE24BB /* Labels */ = { - isa = PBXGroup; - children = ( - C35A65B511025FA900FE24BB /* CPTAxisLabel.h */, - C35A65B611025FA900FE24BB /* CPTAxisLabel.m */, - C35A65B711025FA900FE24BB /* CPTAxisTitle.h */, - C35A65B811025FA900FE24BB /* CPTAxisTitle.m */, - C35A65BD11025FB300FE24BB /* CPTAxisLabelGroup.h */, - C35A65BE11025FB300FE24BB /* CPTAxisLabelGroup.m */, - ); - name = Labels; - sourceTree = ""; - }; - C35A65A911025F2B00FE24BB /* XY Axes */ = { - isa = PBXGroup; - children = ( - C35A65C111025FCC00FE24BB /* CPTXYAxis.h */, - C35A65C211025FCC00FE24BB /* CPTXYAxis.m */, - C35A65C311025FCC00FE24BB /* CPTXYAxisSet.h */, - C35A65C411025FCC00FE24BB /* CPTXYAxisSet.m */, - ); - name = "XY Axes"; - sourceTree = ""; - }; - C35A6602110271EB00FE24BB /* iPhone Specific */ = { - isa = PBXGroup; - children = ( - C35A66051102723E00FE24BB /* CPTTextStylePlatformSpecific.h */, - C35A66061102723E00FE24BB /* CPTTextStylePlatformSpecific.m */, - ); - name = "iPhone Specific"; - sourceTree = ""; - }; - C3920ACC1395B7410045F3BB /* Legends */ = { - isa = PBXGroup; - children = ( - C3920ACD1395B7680045F3BB /* CPTLegend.h */, - C3920ACE1395B7680045F3BB /* CPTLegend.m */, - C30550E71399BE2000E0151F /* CPTLegendEntry.h */, - C30550E81399BE2000E0151F /* CPTLegendEntry.m */, - ); - name = Legends; - sourceTree = ""; - }; - C3B25EE01AC23A930063CCD8 /* CocoaPods */ = { - isa = PBXGroup; - children = ( - C3B25EE11AC23A930063CCD8 /* CorePlot.h */, - ); - path = CocoaPods; - sourceTree = ""; - }; - C3B623A9107EC5460009EF0B /* Layout */ = { - isa = PBXGroup; - children = ( - 074FADF7112024C500394B90 /* CPTConstraints.h */, - 074FADF8112024C500394B90 /* CPTConstraints.m */, - C3CCA04413E8D94800CE6DB1 /* _CPTConstraintsFixed.h */, - C3CCA04513E8D94800CE6DB1 /* _CPTConstraintsFixed.m */, - C3CCA04613E8D94800CE6DB1 /* _CPTConstraintsRelative.h */, - C3CCA04713E8D94800CE6DB1 /* _CPTConstraintsRelative.m */, - ); - name = Layout; - sourceTree = ""; - }; - C3C68316166138B500340E39 /* Animation */ = { - isa = PBXGroup; - children = ( - C3C68318166138E200340E39 /* CPTAnimation.h */, - C3C68319166138E200340E39 /* CPTAnimation.m */, - C3C6831A166138E200340E39 /* CPTAnimationOperation.h */, - C3C6831B166138E200340E39 /* CPTAnimationOperation.m */, - C3C6831C166138E200340E39 /* CPTAnimationPeriod.h */, - C3C6831D166138E200340E39 /* CPTAnimationPeriod.m */, - C3C683281661391A00340E39 /* _CPTAnimationCGFloatPeriod.h */, - C3C683291661391A00340E39 /* _CPTAnimationCGFloatPeriod.m */, - C3C6832A1661391A00340E39 /* _CPTAnimationCGPointPeriod.h */, - C3C6832B1661391A00340E39 /* _CPTAnimationCGPointPeriod.m */, - C3C6832C1661391A00340E39 /* _CPTAnimationCGRectPeriod.h */, - C3C6832D1661391A00340E39 /* _CPTAnimationCGRectPeriod.m */, - C3C6832E1661391A00340E39 /* _CPTAnimationCGSizePeriod.h */, - C3C6832F1661391A00340E39 /* _CPTAnimationCGSizePeriod.m */, - C3C683301661391A00340E39 /* _CPTAnimationNSDecimalPeriod.h */, - C3C683311661391A00340E39 /* _CPTAnimationNSDecimalPeriod.m */, - C3C683321661391A00340E39 /* _CPTAnimationPlotRangePeriod.h */, - C3C683331661391A00340E39 /* _CPTAnimationPlotRangePeriod.m */, - C3C6831E166138E200340E39 /* _CPTAnimationTimingFunctions.h */, - C3C6831F166138E200340E39 /* _CPTAnimationTimingFunctions.m */, - ); - name = Animation; - sourceTree = ""; - }; - C3CADE2911B1885200D36017 /* Numeric Data */ = { - isa = PBXGroup; - children = ( - C3CADE2F11B1886B00D36017 /* license.txt */, - C3CADE3911B188B600D36017 /* CPTNumericDataType.h */, - C3CADE3A11B188B600D36017 /* CPTNumericDataType.m */, - C3CADE3011B188A800D36017 /* CPTNumericData.h */, - C3CADE3111B188A800D36017 /* CPTNumericData.m */, - C3CADE3D11B188C500D36017 /* CPTMutableNumericData.h */, - C3CADE3E11B188C500D36017 /* CPTMutableNumericData.m */, - C3CADE3211B188A800D36017 /* CPTNumericData+TypeConversion.h */, - C3392A351225F63B008DA6BD /* CPTNumericData+TypeConversion.m */, - C3CAFB391229E48200F5C989 /* CPTMutableNumericData+TypeConversion.h */, - C3CAFB3A1229E48200F5C989 /* CPTMutableNumericData+TypeConversion.m */, - C3CADE3411B188A800D36017 /* CPTNumericData+TypeConversions_Generation.py */, - ); - name = "Numeric Data"; - sourceTree = ""; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - BC9B83430FB8A0A40035D8DA /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - BC9B83C30FB8AC4B0035D8DA /* CorePlot-CocoaTouch.h in Headers */, - 070CB8430FC9DED400F3152B /* CPTAxis.h in Headers */, - 070CB8470FC9DED400F3152B /* CPTAxisSet.h in Headers */, - 070CB8340FC9DEA800F3152B /* CPTColor.h in Headers */, - 070CB8360FC9DEA800F3152B /* CPTColorSpace.h in Headers */, - 0789EFC00FB9F97F00C0A613 /* CPTPlatformSpecificDefines.h in Headers */, - 0789EFBE0FB9F97F00C0A613 /* CPTPlatformSpecificCategories.h in Headers */, - 0789EFC20FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.h in Headers */, - BC79F1D50FD1DC1A00510976 /* CPTGraphHostingView.h in Headers */, - 074D7BC50FD6B65F006011BC /* CPTXYPlotSpace.h in Headers */, - 077F28550FE18048000BCA52 /* CPTBorderedLayer.h in Headers */, - 077F28570FE18048000BCA52 /* CPTPathExtensions.h in Headers */, - 07A62FB50FE2234900CD765C /* CPTTextStyle.h in Headers */, - 072E3F9F0FE2FF7300ACF62F /* CPTTheme.h in Headers */, - 07A2E71E102DFAD300809BC5 /* CPTTimeFormatter.h in Headers */, - 07A5E24C104E47E900B7AB80 /* CPTTextLayer.h in Headers */, - C3B623C0107EC9370009EF0B /* CPTBarPlot.h in Headers */, - BC74A2C210FC087800E7E90D /* CPTPieChart.h in Headers */, - C3B623C1107EC9400009EF0B /* CPTDefinitions.h in Headers */, - C3B623C2107EC9430009EF0B /* CPTExceptions.h in Headers */, - C3B623C3107EC94D0009EF0B /* CPTFill.h in Headers */, - C3B623C4107EC94E0009EF0B /* CPTGradient.h in Headers */, - C3B623C5107EC9500009EF0B /* CPTGraph.h in Headers */, - C3B623C6107EC9510009EF0B /* CPTImage.h in Headers */, - C3B623C7107EC9540009EF0B /* CPTLayer.h in Headers */, - C3B623C8107EC9570009EF0B /* CPTLineStyle.h in Headers */, - C3B623C9107EC95C0009EF0B /* CPTPlot.h in Headers */, - C3B623CA107EC95E0009EF0B /* CPTPlotAreaFrame.h in Headers */, - C3B623CB107EC9610009EF0B /* CPTPlotRange.h in Headers */, - C3B623CC107EC9620009EF0B /* CPTPlotSpace.h in Headers */, - C3B623CD107EC9630009EF0B /* CPTPlotSymbol.h in Headers */, - C3B623CF107EC9680009EF0B /* CPTScatterPlot.h in Headers */, - C3B623D1107EC96E0009EF0B /* CPTUtilities.h in Headers */, - C3B623D2107EC9760009EF0B /* CPTXYGraph.h in Headers */, - 07AEF30310BBF99A0012BEFF /* CPTResponder.h in Headers */, - 0772B4F310E26A12009CD04C /* CPTTradingRangePlot.h in Headers */, - 074FADF9112024C500394B90 /* CPTConstraints.h in Headers */, - C35A65A511025EDF00FE24BB /* CPTPlotArea.h in Headers */, - C35A65B911025FA900FE24BB /* CPTAxisLabel.h in Headers */, - C35A65BB11025FA900FE24BB /* CPTAxisTitle.h in Headers */, - C35A65C711025FCC00FE24BB /* CPTXYAxis.h in Headers */, - C35A65C911025FCC00FE24BB /* CPTXYAxisSet.h in Headers */, - 0718DE4D11D1EDBA00AF4851 /* CPTAnnotation.h in Headers */, - 0718DE4F11D1EDBA00AF4851 /* CPTAnnotationHostLayer.h in Headers */, - 0718DE5111D1EDBA00AF4851 /* CPTLayerAnnotation.h in Headers */, - 0718DE5311D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.h in Headers */, - C318F4C111EA18A400595FF9 /* CPTLimitBand.h in Headers */, - C3D68B091221650C00EB4863 /* CPTMutableNumericData.h in Headers */, - C3D68B0B1221650E00EB4863 /* CPTNumericData+TypeConversion.h in Headers */, - C3D68B0D1221651200EB4863 /* CPTNumericData.h in Headers */, - C3D68B0F1221651500EB4863 /* CPTNumericDataType.h in Headers */, - C3CAFB3B1229E48200F5C989 /* CPTMutableNumericData+TypeConversion.h in Headers */, - 07B69AB912B6281100F4C16C /* CPTMutableTextStyle.h in Headers */, - 07B69B7112B62E9600F4C16C /* CPTMutableLineStyle.h in Headers */, - D0C047C012D6568500DA8047 /* CPTRangePlot.h in Headers */, - C3920ACF1395B7680045F3BB /* CPTLegend.h in Headers */, - C30550E91399BE2000E0151F /* CPTLegendEntry.h in Headers */, - C3D3AD3413DF8E9D0004EA73 /* CPTLineCap.h in Headers */, - C32EE1BD13EC4AF900038266 /* CPTShadow.h in Headers */, - C32EE1C813EC4C7200038266 /* CPTMutableShadow.h in Headers */, - C3A695E1146A196100AF5653 /* CPTMutablePlotRange.h in Headers */, - C349DCB0151AAFAB00BFD6A7 /* CPTCalendarFormatter.h in Headers */, - C35A66071102723E00FE24BB /* CPTTextStylePlatformSpecific.h in Headers */, - C3286C0715D8769800A436A8 /* _CPTMaskLayer.h in Headers */, - C3408C4615FC1CA8004F1D70 /* _CPTBorderLayer.h in Headers */, - BCC7EA451006BF5700B39451 /* _CPTPlainBlackTheme.h in Headers */, - BCC7EA471006BF5700B39451 /* _CPTPlainWhiteTheme.h in Headers */, - BCC7EA491006BF5700B39451 /* _CPTStocksTheme.h in Headers */, - C40CFB94107EC1B40057E828 /* _CPTXYTheme.h in Headers */, - C3B623D4107EC9800009EF0B /* _CPTFillColor.h in Headers */, - C3B623D5107EC9820009EF0B /* _CPTFillGradient.h in Headers */, - C3B623D6107EC9830009EF0B /* _CPTFillImage.h in Headers */, - C3CCA04813E8D94800CE6DB1 /* _CPTConstraintsFixed.h in Headers */, - C3CCA04A13E8D94800CE6DB1 /* _CPTConstraintsRelative.h in Headers */, - C3436C5113F4AC6000739AC2 /* _CPTSlateTheme.h in Headers */, - C304565313F4AC9A004D04BC /* _CPTDarkGradientTheme.h in Headers */, - C35A65BF11025FB300FE24BB /* CPTAxisLabelGroup.h in Headers */, - C38DD49711A04B99002A68E7 /* CPTGridLineGroup.h in Headers */, - C35A65B311025F8A00FE24BB /* CPTGridLines.h in Headers */, - C30C85AB1047428100181766 /* CPTPlotGroup.h in Headers */, - C3978E1013CE65C600A420D9 /* NSCoderExtensions.h in Headers */, - BC4FAF29100D7DF300811DD3 /* NSDecimalNumberExtensions.h in Headers */, - C3B623D3107EC97A0009EF0B /* NSNumberExtensions.h in Headers */, - C3C68320166138E200340E39 /* CPTAnimation.h in Headers */, - C3C68322166138E200340E39 /* CPTAnimationOperation.h in Headers */, - C3C68324166138E200340E39 /* CPTAnimationPeriod.h in Headers */, - C3C68326166138E200340E39 /* _CPTAnimationTimingFunctions.h in Headers */, - C3C683341661391A00340E39 /* _CPTAnimationCGFloatPeriod.h in Headers */, - C3C683361661391A00340E39 /* _CPTAnimationCGPointPeriod.h in Headers */, - C3C683381661391A00340E39 /* _CPTAnimationCGRectPeriod.h in Headers */, - C3C6833A1661391A00340E39 /* _CPTAnimationCGSizePeriod.h in Headers */, - C3C6833C1661391A00340E39 /* _CPTAnimationNSDecimalPeriod.h in Headers */, - C3C6833E1661391A00340E39 /* _CPTAnimationPlotRangePeriod.h in Headers */, - C3D9825116BD406600DE7977 /* CorePlot_Prefix.pch in Headers */, - C31A40BF17ABD6C60020C5C6 /* CPTFunctionDataSource.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - BC9B83460FB8A0A40035D8DA /* CorePlot-CocoaTouch */ = { - isa = PBXNativeTarget; - buildConfigurationList = BC9B834A0FB8A0AA0035D8DA /* Build configuration list for PBXNativeTarget "CorePlot-CocoaTouch" */; - buildPhases = ( - BC9B83430FB8A0A40035D8DA /* Headers */, - BC9B83440FB8A0A40035D8DA /* Sources */, - BC9B83450FB8A0A40035D8DA /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = "CorePlot-CocoaTouch"; - productName = "CorePlot-CocoaTouch"; - productReference = BC9B83470FB8A0A40035D8DA /* libCorePlot-CocoaTouch.a */; - productType = "com.apple.product-type.library.static"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 29B97313FDCFA39411CA2CEA /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0700; - }; - buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CorePlot-CocoaTouch" */; - compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; - hasScannedForEncodings = 1; - knownRegions = ( - English, - Japanese, - French, - German, - ); - mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - BC9B83460FB8A0A40035D8DA /* CorePlot-CocoaTouch */, - C3566B8010EED04900FB3866 /* Documentation */, - 0799D97A137318CF0026072C /* Universal Library */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXShellScriptBuildPhase section */ - 0799D97F137318D80026072C /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - runOnlyForDeploymentPostprocessing = 0; - shellPath = /bin/sh; - shellScript = "\nUFW_TARGET=${PROJECT}\nUFW_BUILD_DIR=\"${BUILD_DIR}\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_DIR=\"${UFW_BUILD_DIR}/Release-iphoneos\"\nUFW_SIMULATOR_DIR=\"${UFW_BUILD_DIR}/Release-iphonesimulator\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-universal\"\nUFW_HEADER_DIR=\"${UFW_UNIVERSAL_DIR}/CorePlotHeaders\"\nUFW_EXE_PATH=\"lib${PROJECT}.a\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot-CocoaTouch.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot-CocoaTouch.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\nlipo -create -output \"${UFW_UNIVERSAL_DIR}/${UFW_EXE_PATH}\" \"${UFW_IPHONE_DIR}/${UFW_EXE_PATH}\" \"${UFW_SIMULATOR_DIR}/${UFW_EXE_PATH}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n\n# copy header files\nmkdir -p \"${UFW_HEADER_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp \"${SOURCE_ROOT}/CorePlot-CocoaTouch.h\" \"${UFW_HEADER_DIR}\"\ncp \"${SOURCE_ROOT}/iPhoneOnly/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\ncp \"${SOURCE_ROOT}/Source/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\n\nrm \"${UFW_HEADER_DIR}/\"*Tests.*"; - }; - C3566B7F10EED04900FB3866 /* ShellScript */ = { - isa = PBXShellScriptBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - inputPaths = ( - ); - outputPaths = ( - ); - 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\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} \"${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"; - }; -/* End PBXShellScriptBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - BC9B83440FB8A0A40035D8DA /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - BC9B834E0FB8A1400035D8DA /* CPTPlot.m in Sources */, - BC9B834F0FB8A1400035D8DA /* CPTScatterPlot.m in Sources */, - BC9B83500FB8A1400035D8DA /* CPTBarPlot.m in Sources */, - BC9B83510FB8A1400035D8DA /* CPTPlotSymbol.m in Sources */, - BC9B83520FB8A1400035D8DA /* CPTPlotSpace.m in Sources */, - BC9B83550FB8A1400035D8DA /* CPTPlotAreaFrame.m in Sources */, - BC9B83560FB8A1400035D8DA /* CPTGraph.m in Sources */, - BC9B83570FB8A1400035D8DA /* CPTXYGraph.m in Sources */, - BC9B835A0FB8A1400035D8DA /* NSDecimalNumberExtensions.m in Sources */, - BC9B835B0FB8A1400035D8DA /* NSNumberExtensions.m in Sources */, - BC9B835D0FB8A1400035D8DA /* CPTDefinitions.m in Sources */, - BC9B835E0FB8A1400035D8DA /* CPTExceptions.m in Sources */, - BC9B835F0FB8A1400035D8DA /* CPTUtilities.m in Sources */, - BC9B83600FB8A1400035D8DA /* CPTPlotRange.m in Sources */, - BC9B83610FB8A1400035D8DA /* CPTFill.m in Sources */, - BC9B83620FB8A1400035D8DA /* _CPTFillColor.m in Sources */, - BC9B83630FB8A1400035D8DA /* _CPTFillGradient.m in Sources */, - BC9B83640FB8A1400035D8DA /* _CPTFillImage.m in Sources */, - C3791D05191D4C2F001EC514 /* CPTImagePlatformSpecific.m in Sources */, - 0789EFBF0FB9F97F00C0A613 /* CPTPlatformSpecificCategories.m in Sources */, - 0789EFC10FB9F97F00C0A613 /* CPTPlatformSpecificDefines.m in Sources */, - 0789EFC30FB9F97F00C0A613 /* CPTPlatformSpecificFunctions.m in Sources */, - 070CB82A0FC9DE4B00F3152B /* CPTGradient.m in Sources */, - 070CB82B0FC9DE5500F3152B /* CPTImage.m in Sources */, - 070CB82C0FC9DE5600F3152B /* CPTLayer.m in Sources */, - 070CB82D0FC9DE5700F3152B /* CPTLineStyle.m in Sources */, - 070CB8350FC9DEA800F3152B /* CPTColor.m in Sources */, - 070CB8370FC9DEA800F3152B /* CPTColorSpace.m in Sources */, - 070CB8440FC9DED400F3152B /* CPTAxis.m in Sources */, - 070CB8480FC9DED400F3152B /* CPTAxisSet.m in Sources */, - 070CB85E0FC9DF4700F3152B /* CPTTextLayer.m in Sources */, - BC79F1D60FD1DC1A00510976 /* CPTGraphHostingView.m in Sources */, - 074D7BC60FD6B65F006011BC /* CPTXYPlotSpace.m in Sources */, - 077F28560FE18048000BCA52 /* CPTBorderedLayer.m in Sources */, - 077F28580FE18048000BCA52 /* CPTPathExtensions.m in Sources */, - 07A62FB60FE2234900CD765C /* CPTTextStyle.m in Sources */, - 072E3FA00FE2FF7300ACF62F /* CPTTheme.m in Sources */, - BCC7EA461006BF5700B39451 /* _CPTPlainBlackTheme.m in Sources */, - BCC7EA481006BF5700B39451 /* _CPTPlainWhiteTheme.m in Sources */, - BCC7EA4A1006BF5700B39451 /* _CPTStocksTheme.m in Sources */, - BC89A79A1024AB19009D5261 /* CorePlotProbes.d in Sources */, - 07A2E71F102DFAD300809BC5 /* CPTTimeFormatter.m in Sources */, - C30C85AC1047428100181766 /* CPTPlotGroup.m in Sources */, - C40CFB95107EC1B40057E828 /* _CPTXYTheme.m in Sources */, - 0772B4F410E26A12009CD04C /* CPTTradingRangePlot.m in Sources */, - BC74A2C310FC087800E7E90D /* CPTPieChart.m in Sources */, - 074FADFA112024C500394B90 /* CPTConstraints.m in Sources */, - 07FCF2D4115B54DE00E46606 /* _CPTSlateTheme.m in Sources */, - C35A65A611025EDF00FE24BB /* CPTPlotArea.m in Sources */, - C35A65B411025F8A00FE24BB /* CPTGridLines.m in Sources */, - C35A65BA11025FA900FE24BB /* CPTAxisLabel.m in Sources */, - C35A65BC11025FA900FE24BB /* CPTAxisTitle.m in Sources */, - C35A65C011025FB300FE24BB /* CPTAxisLabelGroup.m in Sources */, - C35A65C811025FCC00FE24BB /* CPTXYAxis.m in Sources */, - C35A65CA11025FCC00FE24BB /* CPTXYAxisSet.m in Sources */, - C35A66081102723E00FE24BB /* CPTTextStylePlatformSpecific.m in Sources */, - C38DD49811A04B99002A68E7 /* CPTGridLineGroup.m in Sources */, - 0718DE4E11D1EDBA00AF4851 /* CPTAnnotation.m in Sources */, - 0718DE5011D1EDBA00AF4851 /* CPTAnnotationHostLayer.m in Sources */, - 0718DE5211D1EDBA00AF4851 /* CPTLayerAnnotation.m in Sources */, - 0718DE5411D1EDBA00AF4851 /* CPTPlotSpaceAnnotation.m in Sources */, - C318F4C211EA18A400595FF9 /* CPTLimitBand.m in Sources */, - C3D68B0A1221650D00EB4863 /* CPTMutableNumericData.m in Sources */, - C3D68B0E1221651200EB4863 /* CPTNumericData.m in Sources */, - C3D68B101221651600EB4863 /* CPTNumericDataType.m in Sources */, - C3392A361225F63B008DA6BD /* CPTNumericData+TypeConversion.m in Sources */, - C3CAFB3C1229E48200F5C989 /* CPTMutableNumericData+TypeConversion.m in Sources */, - 07B69ABA12B6281100F4C16C /* CPTMutableTextStyle.m in Sources */, - 07B69B7212B62E9600F4C16C /* CPTMutableLineStyle.m in Sources */, - D0C047BF12D6568500DA8047 /* CPTRangePlot.m in Sources */, - C3920AD01395B7680045F3BB /* CPTLegend.m in Sources */, - C30550EA1399BE2000E0151F /* CPTLegendEntry.m in Sources */, - C3978E1113CE65C600A420D9 /* NSCoderExtensions.m in Sources */, - C3D3AD3513DF8E9D0004EA73 /* CPTLineCap.m in Sources */, - C3CCA04913E8D94800CE6DB1 /* _CPTConstraintsFixed.m in Sources */, - C3CCA04B13E8D94800CE6DB1 /* _CPTConstraintsRelative.m in Sources */, - C32EE1BE13EC4AF900038266 /* CPTShadow.m in Sources */, - C32EE1C913EC4C7200038266 /* CPTMutableShadow.m in Sources */, - C3436C4F13F4AC4400739AC2 /* _CPTDarkGradientTheme.m in Sources */, - C3A695E2146A196100AF5653 /* CPTMutablePlotRange.m in Sources */, - C349DCB1151AAFAB00BFD6A7 /* CPTCalendarFormatter.m in Sources */, - C3286C0815D8769800A436A8 /* _CPTMaskLayer.m in Sources */, - C3408C4715FC1CA8004F1D70 /* _CPTBorderLayer.m in Sources */, - C3C68321166138E200340E39 /* CPTAnimation.m in Sources */, - C3C68323166138E200340E39 /* CPTAnimationOperation.m in Sources */, - C3C68325166138E200340E39 /* CPTAnimationPeriod.m in Sources */, - C3C68327166138E200340E39 /* _CPTAnimationTimingFunctions.m in Sources */, - C3C683351661391A00340E39 /* _CPTAnimationCGFloatPeriod.m in Sources */, - C3C683371661391A00340E39 /* _CPTAnimationCGPointPeriod.m in Sources */, - C3C683391661391A00340E39 /* _CPTAnimationCGRectPeriod.m in Sources */, - C3C6833B1661391A00340E39 /* _CPTAnimationCGSizePeriod.m in Sources */, - C3C6833D1661391A00340E39 /* _CPTAnimationNSDecimalPeriod.m in Sources */, - C3C6833F1661391A00340E39 /* _CPTAnimationPlotRangePeriod.m in Sources */, - C31A40C017ABD6C60020C5C6 /* CPTFunctionDataSource.m in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 0799D97B137318CF0026072C /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = UniversalLibrary; - }; - name = Debug; - }; - 0799D97C137318CF0026072C /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - PRODUCT_NAME = UniversalLibrary; - }; - name = Release; - }; - BC9B83480FB8A0A50035D8DA /* Debug */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C302230B1BB8B49700514011 /* CorePlotDebug.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - GCC_DYNAMIC_NO_PIC = NO; - GCC_ENABLE_SYMBOL_SEPARATION = YES; - INSTALL_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; - PRODUCT_NAME = "CorePlot-CocoaTouch"; - PUBLIC_HEADERS_FOLDER_PATH = "include/$(PROJECT_NAME)"; - }; - name = Debug; - }; - BC9B83490FB8A0A50035D8DA /* Release */ = { - isa = XCBuildConfiguration; - baseConfigurationReference = C302230C1BB8B49700514011 /* CorePlotRelease.xcconfig */; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - GCC_ENABLE_SYMBOL_SEPARATION = YES; - INSTALL_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; - PRODUCT_NAME = "CorePlot-CocoaTouch"; - PUBLIC_HEADERS_FOLDER_PATH = "include/$(PROJECT_NAME)"; - }; - name = Release; - }; - C01FCF4F08A954540054247B /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - GCC_INLINES_ARE_PRIVATE_EXTERN = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - MACH_O_TYPE = staticlib; - SDKROOT = iphoneos; - SYMROOT = "$(PROJECT_DIR)/../build"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Debug; - }; - C01FCF5008A954540054247B /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - DEPLOYMENT_POSTPROCESSING = YES; - GCC_INLINES_ARE_PRIVATE_EXTERN = YES; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - MACH_O_TYPE = staticlib; - SDKROOT = iphoneos; - SYMROOT = "$(PROJECT_DIR)/../build"; - TARGETED_DEVICE_FAMILY = "1,2"; - }; - name = Release; - }; - C3566B8110EED04A00FB3866 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = NO; - DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; - GCC_DYNAMIC_NO_PIC = NO; - GCC_OPTIMIZATION_LEVEL = 0; - PRODUCT_NAME = Documentation; - }; - name = Debug; - }; - C3566B8210EED04A00FB3866 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - COPY_PHASE_STRIP = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; - PRODUCT_NAME = Documentation; - ZERO_LINK = NO; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 0799D97D137318CF0026072C /* Build configuration list for PBXAggregateTarget "Universal Library" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 0799D97B137318CF0026072C /* Debug */, - 0799D97C137318CF0026072C /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - BC9B834A0FB8A0AA0035D8DA /* Build configuration list for PBXNativeTarget "CorePlot-CocoaTouch" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - BC9B83480FB8A0A50035D8DA /* Debug */, - BC9B83490FB8A0A50035D8DA /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C01FCF4E08A954540054247B /* Build configuration list for PBXProject "CorePlot-CocoaTouch" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C01FCF4F08A954540054247B /* Debug */, - C01FCF5008A954540054247B /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - C3566B8410EED06800FB3866 /* Build configuration list for PBXAggregateTarget "Documentation" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - C3566B8110EED04A00FB3866 /* Debug */, - C3566B8210EED04A00FB3866 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; -} diff --git a/framework/CorePlot-CocoaTouch.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/framework/CorePlot-CocoaTouch.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 8937881b3..000000000 --- a/framework/CorePlot-CocoaTouch.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ - - - - - diff --git a/framework/CorePlot.h b/framework/CorePlot.h index 1c6a5e0fc..fbf2740c2 100644 --- a/framework/CorePlot.h +++ b/framework/CorePlot.h @@ -1,4 +1,6 @@ -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#import "TargetConditionals.h" + +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #import #import diff --git a/framework/CorePlot.xcodeproj/project.pbxproj b/framework/CorePlot.xcodeproj/project.pbxproj index 6659281a1..f6971f390 100644 --- a/framework/CorePlot.xcodeproj/project.pbxproj +++ b/framework/CorePlot.xcodeproj/project.pbxproj @@ -18,6 +18,17 @@ name = "Documentation-Mac"; productName = Documentation; }; + C37EA5C41BC83E900091C8F7 /* Universal tvOS Framework */ = { + isa = PBXAggregateTarget; + buildConfigurationList = C37EA5C61BC83E900091C8F7 /* Build configuration list for PBXAggregateTarget "Universal tvOS Framework" */; + buildPhases = ( + C37EA5C51BC83E900091C8F7 /* ShellScript */, + ); + dependencies = ( + ); + name = "Universal tvOS Framework"; + productName = Documentation; + }; C38A09911A4618B600D45436 /* Documentation-iOS */ = { isa = PBXAggregateTarget; buildConfigurationList = C38A09931A4618B600D45436 /* Build configuration list for PBXAggregateTarget "Documentation-iOS" */; @@ -177,7 +188,6 @@ BC74A33110FC402600E7E90D /* CPTPieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = BC74A32F10FC402600E7E90D /* CPTPieChart.m */; }; BC79F1360FD1CD6600510976 /* CPTGraphHostingView.h in Headers */ = {isa = PBXBuildFile; fileRef = BC79F1340FD1CD6600510976 /* CPTGraphHostingView.h */; settings = {ATTRIBUTES = (Public, ); }; }; BC79F1370FD1CD6600510976 /* CPTGraphHostingView.m in Sources */ = {isa = PBXBuildFile; fileRef = BC79F1350FD1CD6600510976 /* CPTGraphHostingView.m */; }; - BC89A64110239D1D009D5261 /* CorePlotProbes.d in Sources */ = {isa = PBXBuildFile; fileRef = BC89A64010239D1D009D5261 /* CorePlotProbes.d */; }; BCFC7C3710921FDB00DAECAA /* CPTAxisTitle.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFC7C3510921FDB00DAECAA /* CPTAxisTitle.h */; settings = {ATTRIBUTES = (Public, ); }; }; BCFC7C3810921FDB00DAECAA /* CPTAxisTitle.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFC7C3610921FDB00DAECAA /* CPTAxisTitle.m */; }; C30550ED1399BE5400E0151F /* CPTLegendEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = C30550EB1399BE5400E0151F /* CPTLegendEntry.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -186,10 +196,8 @@ C318F4AE11EA188700595FF9 /* CPTLimitBand.m in Sources */ = {isa = PBXBuildFile; fileRef = C318F4AC11EA188700595FF9 /* CPTLimitBand.m */; }; C3226A521A69F6DA00F77249 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A511A69F6DA00F77249 /* QuartzCore.framework */; }; C3226A541A69F6DF00F77249 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A531A69F6DF00F77249 /* UIKit.framework */; }; - C3226A561A69F6F000F77249 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A551A69F6F000F77249 /* Accelerate.framework */; }; C3226A581A69F6FA00F77249 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; C3226A5C1A69F72900F77249 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A531A69F6DF00F77249 /* UIKit.framework */; }; - C3226A5D1A69F72F00F77249 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A551A69F6F000F77249 /* Accelerate.framework */; }; C3226A5E1A69F73800F77249 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A511A69F6DA00F77249 /* QuartzCore.framework */; }; C3226A5F1A69F75400F77249 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; C3286C0015D8740100A436A8 /* _CPTMaskLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = C3286BFE15D8740100A436A8 /* _CPTMaskLayer.h */; settings = {ATTRIBUTES = (); }; }; @@ -225,15 +233,233 @@ C34F0D59121CB3F00020FDD3 /* CPTDataSourceTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */; }; C36E89BA11EE7F97003DE309 /* CPTPlotRangeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C36E89B911EE7F97003DE309 /* CPTPlotRangeTests.m */; }; C370D5971A753F1C00AF4312 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; + C377B3BB1C122AA600891DF8 /* CPTCalendarFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C377B3BA1C122AA600891DF8 /* CPTCalendarFormatterTests.m */; }; + C377B3BC1C122AA600891DF8 /* CPTCalendarFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C377B3BA1C122AA600891DF8 /* CPTCalendarFormatterTests.m */; }; + C377B3BD1C122AA600891DF8 /* CPTCalendarFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C377B3BA1C122AA600891DF8 /* CPTCalendarFormatterTests.m */; }; + C377B3BE1C122AA600891DF8 /* CPTCalendarFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C377B3BA1C122AA600891DF8 /* CPTCalendarFormatterTests.m */; }; C3791D09191D4C4C001EC514 /* CPTImagePlatformSpecific.m in Sources */ = {isa = PBXBuildFile; fileRef = C3791D07191D4C4C001EC514 /* CPTImagePlatformSpecific.m */; }; + C37EA5CB1BC83F2A0091C8F7 /* CPTGraphHostingView.m in Sources */ = {isa = PBXBuildFile; fileRef = C38A0B281A46265300D45436 /* CPTGraphHostingView.m */; }; + C37EA5CC1BC83F2A0091C8F7 /* CPTLayerAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 07E10BBA11D10183000B8DAB /* CPTLayerAnnotation.m */; }; + C37EA5CD1BC83F2A0091C8F7 /* CPTLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD7E7EB0F4B4F9600F9BCBB /* CPTLayer.m */; }; + C37EA5CE1BC83F2A0091C8F7 /* CPTTimeFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = 07A2E6FB102DF47900809BC5 /* CPTTimeFormatter.m */; }; + C37EA5CF1BC83F2A0091C8F7 /* CPTColor.m in Sources */ = {isa = PBXBuildFile; fileRef = 079FC0B30FB975500037E990 /* CPTColor.m */; }; + C37EA5D01BC83F2A0091C8F7 /* NSCoderExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = C3978E0513CE653B00A420D9 /* NSCoderExtensions.m */; }; + C37EA5D11BC83F2A0091C8F7 /* CPTMutableNumericData.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EF11104D819100B554F9 /* CPTMutableNumericData.m */; }; + C37EA5D21BC83F2A0091C8F7 /* CPTNumericData+TypeConversion.m in Sources */ = {isa = PBXBuildFile; fileRef = C3392A371225F667008DA6BD /* CPTNumericData+TypeConversion.m */; }; + C37EA5D31BC83F2A0091C8F7 /* CPTTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 0772C9260FE2F71600EC4C16 /* CPTTheme.m */; }; + C37EA5D41BC83F2A0091C8F7 /* CPTDefinitions.m in Sources */ = {isa = PBXBuildFile; fileRef = 07BF0DF20F2B7BFB002FCEA7 /* CPTDefinitions.m */; }; + C37EA5D51BC83F2A0091C8F7 /* _CPTFillImage.m in Sources */ = {isa = PBXBuildFile; fileRef = C342601D0FAE096C00072842 /* _CPTFillImage.m */; }; + C37EA5D61BC83F2A0091C8F7 /* CPTPlotSpaceAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 07E10BB011D1016B000B8DAB /* CPTPlotSpaceAnnotation.m */; }; + C37EA5D71BC83F2A0091C8F7 /* CPTXYAxis.m in Sources */ = {isa = PBXBuildFile; fileRef = 0783DD540FBF097E006C3696 /* CPTXYAxis.m */; }; + C37EA5D81BC83F2A0091C8F7 /* CPTBarPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 0799E0940F2BB5F300790525 /* CPTBarPlot.m */; }; + C37EA5D91BC83F2A0091C8F7 /* CPTAxisTitle.m in Sources */ = {isa = PBXBuildFile; fileRef = BCFC7C3610921FDB00DAECAA /* CPTAxisTitle.m */; }; + C37EA5DA1BC83F2A0091C8F7 /* CPTPlatformSpecificDefines.m in Sources */ = {isa = PBXBuildFile; fileRef = C38A0B1B1A46264500D45436 /* CPTPlatformSpecificDefines.m */; }; + C37EA5DB1BC83F2A0091C8F7 /* _CPTStocksTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = BC55023110059F22005DF982 /* _CPTStocksTheme.m */; }; + C37EA5DC1BC83F2A0091C8F7 /* CPTImagePlatformSpecific.m in Sources */ = {isa = PBXBuildFile; fileRef = C38A0A591A4620B800D45436 /* CPTImagePlatformSpecific.m */; }; + C37EA5DD1BC83F2A0091C8F7 /* _CPTAnimationCGFloatPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C9CB16165DB52C00739006 /* _CPTAnimationCGFloatPeriod.m */; }; + C37EA5DE1BC83F2A0091C8F7 /* CPTExceptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 07321BC00F37370D00F423D8 /* CPTExceptions.m */; }; + C37EA5DF1BC83F2A0091C8F7 /* _CPTDarkGradientTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 0772C92E0FE2F89000EC4C16 /* _CPTDarkGradientTheme.m */; }; + C37EA5E01BC83F2A0091C8F7 /* _CPTPlainBlackTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = BC55022D10059F22005DF982 /* _CPTPlainBlackTheme.m */; }; + C37EA5E11BC83F2A0091C8F7 /* CPTNumericData.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EEFB104D80C400B554F9 /* CPTNumericData.m */; }; + C37EA5E31BC83F2A0091C8F7 /* CPTXYAxisSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 07975C420F3B816600DE45DC /* CPTXYAxisSet.m */; }; + C37EA5E41BC83F2A0091C8F7 /* CPTLimitBand.m in Sources */ = {isa = PBXBuildFile; fileRef = C318F4AC11EA188700595FF9 /* CPTLimitBand.m */; }; + C37EA5E51BC83F2A0091C8F7 /* CPTGridLines.m in Sources */ = {isa = PBXBuildFile; fileRef = C32B391710AA4C78000470D4 /* CPTGridLines.m */; }; + C37EA5E61BC83F2A0091C8F7 /* CPTPathExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 070622310FDF1B250066A6C4 /* CPTPathExtensions.m */; }; + C37EA5E71BC83F2A0091C8F7 /* CPTXYPlotSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = 90AF4FB90F36D39700753D26 /* CPTXYPlotSpace.m */; }; + C37EA5E81BC83F2A0091C8F7 /* CPTPlotRange.m in Sources */ = {isa = PBXBuildFile; fileRef = 32484B400F530E8B002151AD /* CPTPlotRange.m */; }; + C37EA5E91BC83F2A0091C8F7 /* CPTImage.m in Sources */ = {isa = PBXBuildFile; fileRef = C3AFC9D00FB62969005DFFDC /* CPTImage.m */; }; + C37EA5EA1BC83F2A0091C8F7 /* CPTPlotSymbol.m in Sources */ = {isa = PBXBuildFile; fileRef = C34AFE6A11021D010041675A /* CPTPlotSymbol.m */; }; + C37EA5EB1BC83F2A0091C8F7 /* CPTAxisSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 07BF0D830F2B7340002FCEA7 /* CPTAxisSet.m */; }; + C37EA5EC1BC83F2A0091C8F7 /* CPTPlotGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F31DE71045EB470058520A /* CPTPlotGroup.m */; }; + C37EA5ED1BC83F2A0091C8F7 /* CPTAnimation.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2847016584EB9006BA43C /* CPTAnimation.m */; }; + C37EA5EE1BC83F2A0091C8F7 /* _CPTAnimationNSDecimalPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = A92C00B71DCB2085A92BE0A9 /* _CPTAnimationNSDecimalPeriod.m */; }; + C37EA5EF1BC83F2A0091C8F7 /* _CPTAnimationPlotRangePeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = A92C091B8592D9F32AC384CB /* _CPTAnimationPlotRangePeriod.m */; }; + C37EA5F01BC83F2A0091C8F7 /* CPTPlotAreaFrame.m in Sources */ = {isa = PBXBuildFile; fileRef = 07BF0D770F2B723A002FCEA7 /* CPTPlotAreaFrame.m */; }; + C37EA5F11BC83F2A0091C8F7 /* CPTAxisLabel.m in Sources */ = {isa = PBXBuildFile; fileRef = 073FB02F0FC991A3007A728E /* CPTAxisLabel.m */; }; + C37EA5F21BC83F2A0091C8F7 /* CPTShadow.m in Sources */ = {isa = PBXBuildFile; fileRef = C32EE1B513EC4AA800038266 /* CPTShadow.m */; }; + C37EA5F31BC83F2A0091C8F7 /* _CPTAnimationCGPointPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = A92C0AE447398AF62D584F9C /* _CPTAnimationCGPointPeriod.m */; }; + C37EA5F41BC83F2A0091C8F7 /* CPTPlatformSpecificFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = C38A0B1D1A46264500D45436 /* CPTPlatformSpecificFunctions.m */; }; + C37EA5F51BC83F2A0091C8F7 /* CPTMutableShadow.m in Sources */ = {isa = PBXBuildFile; fileRef = C32EE1C013EC4BE700038266 /* CPTMutableShadow.m */; }; + C37EA5F61BC83F2A0091C8F7 /* _CPTAnimationCGRectPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = A92C0C3DB583ED8FC2EFD9DB /* _CPTAnimationCGRectPeriod.m */; }; + C37EA5F71BC83F2A0091C8F7 /* CPTPlotSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = 07BF0D7B0F2B72B0002FCEA7 /* CPTPlotSpace.m */; }; + C37EA5F81BC83F2A0091C8F7 /* CPTLineCap.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D3AD2C13DF8DCE0004EA73 /* CPTLineCap.m */; }; + C37EA5F91BC83F2A0091C8F7 /* CPTScatterPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 07BF0D960F2B73CA002FCEA7 /* CPTScatterPlot.m */; }; + C37EA5FA1BC83F2A0091C8F7 /* _CPTSlateTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 07FCF2C5115B54AE00E46606 /* _CPTSlateTheme.m */; }; + C37EA5FB1BC83F2A0091C8F7 /* CPTAnimationPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C9CB12165DB50300739006 /* CPTAnimationPeriod.m */; }; + C37EA5FC1BC83F2A0091C8F7 /* CPTTextStylePlatformSpecific.m in Sources */ = {isa = PBXBuildFile; fileRef = C38A0A541A461F9700D45436 /* CPTTextStylePlatformSpecific.m */; }; + C37EA5FD1BC83F2A0091C8F7 /* _CPTBorderLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = C3408C3D15FC1C3E004F1D70 /* _CPTBorderLayer.m */; }; + C37EA5FE1BC83F2A0091C8F7 /* CPTLegendEntry.m in Sources */ = {isa = PBXBuildFile; fileRef = C30550EC1399BE5400E0151F /* CPTLegendEntry.m */; }; + C37EA5FF1BC83F2A0091C8F7 /* CPTTradingRangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 0772B43810E24D5C009CD04C /* CPTTradingRangePlot.m */; }; + C37EA6001BC83F2A0091C8F7 /* CPTTextLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD7E7E60F4B4F8200F9BCBB /* CPTTextLayer.m */; }; + C37EA6011BC83F2A0091C8F7 /* _CPTConstraintsRelative.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CCA03C13E8D85800CE6DB1 /* _CPTConstraintsRelative.m */; }; + C37EA6021BC83F2A0091C8F7 /* CPTAnnotationHostLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 072161EA11D1F6BD009CC871 /* CPTAnnotationHostLayer.m */; }; + C37EA6031BC83F2A0091C8F7 /* CPTAnimationOperation.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C9CB0D165DB4D500739006 /* CPTAnimationOperation.m */; }; + C37EA6041BC83F2A0091C8F7 /* _CPTFillGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = C34260190FAE096C00072842 /* _CPTFillGradient.m */; }; + C37EA6051BC83F2A0091C8F7 /* _CPTMaskLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = C3286BFF15D8740100A436A8 /* _CPTMaskLayer.m */; }; + C37EA6061BC83F2A0091C8F7 /* CPTCalendarFormatter.m in Sources */ = {isa = PBXBuildFile; fileRef = C349DCB3151AAFBF00BFD6A7 /* CPTCalendarFormatter.m */; }; + C37EA6071BC83F2A0091C8F7 /* CPTAnnotation.m in Sources */ = {isa = PBXBuildFile; fileRef = 07E10BB511D10177000B8DAB /* CPTAnnotation.m */; }; + C37EA6081BC83F2A0091C8F7 /* _CPTFillColor.m in Sources */ = {isa = PBXBuildFile; fileRef = C342601C0FAE096C00072842 /* _CPTFillColor.m */; }; + C37EA6091BC83F2A0091C8F7 /* _CPTAnimationTimingFunctions.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C2847416585085006BA43C /* _CPTAnimationTimingFunctions.m */; }; + C37EA60A1BC83F2A0091C8F7 /* CPTMutableLineStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 07B69B1612B62ABB00F4C16C /* CPTMutableLineStyle.m */; }; + C37EA60B1BC83F2A0091C8F7 /* NSDecimalNumberExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD7E7EF0F4B4FA700F9BCBB /* NSDecimalNumberExtensions.m */; }; + C37EA60C1BC83F2A0091C8F7 /* CPTLegend.m in Sources */ = {isa = PBXBuildFile; fileRef = C3920AC31395B6500045F3BB /* CPTLegend.m */; }; + C37EA60D1BC83F2A0091C8F7 /* CPTAxisLabelGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C032C810B8DEDC003A11B6 /* CPTAxisLabelGroup.m */; }; + C37EA60E1BC83F2A0091C8F7 /* CPTFill.m in Sources */ = {isa = PBXBuildFile; fileRef = C342601A0FAE096C00072842 /* CPTFill.m */; }; + C37EA60F1BC83F2A0091C8F7 /* CPTMutableNumericData+TypeConversion.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CAFB251229E41F00F5C989 /* CPTMutableNumericData+TypeConversion.m */; }; + C37EA6101BC83F2A0091C8F7 /* CPTRangePlot.m in Sources */ = {isa = PBXBuildFile; fileRef = D0C0477B12D6560900DA8047 /* CPTRangePlot.m */; }; + C37EA6111BC83F2A0091C8F7 /* CPTGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = 07BF0D710F2B718F002FCEA7 /* CPTGraph.m */; }; + C37EA6121BC83F2A0091C8F7 /* CPTMutablePlotRange.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A695E4146A19BC00AF5653 /* CPTMutablePlotRange.m */; }; + C37EA6131BC83F2A0091C8F7 /* _CPTPlainWhiteTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = BC55022F10059F22005DF982 /* _CPTPlainWhiteTheme.m */; }; + C37EA6141BC83F2A0091C8F7 /* CPTGridLineGroup.m in Sources */ = {isa = PBXBuildFile; fileRef = C38DD49211A04B7A002A68E7 /* CPTGridLineGroup.m */; }; + C37EA6151BC83F2A0091C8F7 /* CPTNumericDataType.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EEFD104D80C400B554F9 /* CPTNumericDataType.m */; }; + C37EA6161BC83F2A0091C8F7 /* CPTPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 07BF0D7F0F2B72F6002FCEA7 /* CPTPlot.m */; }; + C37EA6171BC83F2A0091C8F7 /* CPTPlatformSpecificCategories.m in Sources */ = {isa = PBXBuildFile; fileRef = C38A0B191A46264500D45436 /* CPTPlatformSpecificCategories.m */; }; + C37EA6181BC83F2A0091C8F7 /* CPTConstraints.m in Sources */ = {isa = PBXBuildFile; fileRef = 070064E8111F2BAA003DE087 /* CPTConstraints.m */; }; + C37EA6191BC83F2A0091C8F7 /* CPTTextStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 07B69A5C12B6215000F4C16C /* CPTTextStyle.m */; }; + C37EA61A1BC83F2A0091C8F7 /* CPTFunctionDataSource.m in Sources */ = {isa = PBXBuildFile; fileRef = C3F97F1D17A9E07B00A52FF2 /* CPTFunctionDataSource.m */; }; + C37EA61B1BC83F2A0091C8F7 /* NSNumberExtensions.m in Sources */ = {isa = PBXBuildFile; fileRef = 078F42DA0FACC075006E670B /* NSNumberExtensions.m */; }; + C37EA61C1BC83F2A0091C8F7 /* CPTBorderedLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 0706223B0FDF215C0066A6C4 /* CPTBorderedLayer.m */; }; + C37EA61D1BC83F2A0091C8F7 /* CPTLineStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 906156BD0F375598001B75FC /* CPTLineStyle.m */; }; + C37EA61E1BC83F2A0091C8F7 /* _CPTAnimationCGSizePeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = A92C087BF0913A6BA2363E40 /* _CPTAnimationCGSizePeriod.m */; }; + C37EA61F1BC83F2A0091C8F7 /* CPTPieChart.m in Sources */ = {isa = PBXBuildFile; fileRef = BC74A32F10FC402600E7E90D /* CPTPieChart.m */; }; + C37EA6201BC83F2A0091C8F7 /* CPTColorSpace.m in Sources */ = {isa = PBXBuildFile; fileRef = 079FC0BC0FB9762B0037E990 /* CPTColorSpace.m */; }; + C37EA6211BC83F2A0091C8F7 /* CPTGradient.m in Sources */ = {isa = PBXBuildFile; fileRef = 07CA112E0FAC8F85000861CE /* CPTGradient.m */; }; + C37EA6221BC83F2A0091C8F7 /* CPTUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 07321BC50F37382D00F423D8 /* CPTUtilities.m */; }; + C37EA6231BC83F2A0091C8F7 /* _CPTXYTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA34CA107AD7710051DA02 /* _CPTXYTheme.m */; }; + C37EA6241BC83F2A0091C8F7 /* CPTXYGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = 07983EF50F2F9A3D008C8618 /* CPTXYGraph.m */; }; + C37EA6251BC83F2A0091C8F7 /* CPTPlotArea.m in Sources */ = {isa = PBXBuildFile; fileRef = C34BF5BB10A67633007F0894 /* CPTPlotArea.m */; }; + C37EA6261BC83F2A0091C8F7 /* _CPTConstraintsFixed.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CCA03A13E8D85800CE6DB1 /* _CPTConstraintsFixed.m */; }; + C37EA6271BC83F2A0091C8F7 /* CPTAxis.m in Sources */ = {isa = PBXBuildFile; fileRef = 07975C480F3B818800DE45DC /* CPTAxis.m */; }; + C37EA6281BC83F2A0091C8F7 /* CPTMutableTextStyle.m in Sources */ = {isa = PBXBuildFile; fileRef = 07C4679A0FE1A24C00299939 /* CPTMutableTextStyle.m */; }; + C37EA62B1BC83F2A0091C8F7 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; + C37EA62C1BC83F2A0091C8F7 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A511A69F6DA00F77249 /* QuartzCore.framework */; }; + C37EA62D1BC83F2A0091C8F7 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A531A69F6DF00F77249 /* UIKit.framework */; }; + C37EA62F1BC83F2A0091C8F7 /* CPTLimitBand.h in Headers */ = {isa = PBXBuildFile; fileRef = C318F4AB11EA188700595FF9 /* CPTLimitBand.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6301BC83F2A0091C8F7 /* CPTDefinitions.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BF0DF10F2B7BFB002FCEA7 /* CPTDefinitions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6311BC83F2A0091C8F7 /* CPTPlotSymbol.h in Headers */ = {isa = PBXBuildFile; fileRef = C34AFE6911021D010041675A /* CPTPlotSymbol.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6321BC83F2A0091C8F7 /* CPTTradingRangePlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0772B43710E24D5C009CD04C /* CPTTradingRangePlot.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6331BC83F2A0091C8F7 /* CPTGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BF0D700F2B718F002FCEA7 /* CPTGraph.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6341BC83F2A0091C8F7 /* CPTGridLines.h in Headers */ = {isa = PBXBuildFile; fileRef = C32B391610AA4C78000470D4 /* CPTGridLines.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6351BC83F2A0091C8F7 /* CPTTextStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B69A5B12B6215000F4C16C /* CPTTextStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6361BC83F2A0091C8F7 /* CPTMutablePlotRange.h in Headers */ = {isa = PBXBuildFile; fileRef = C3A695E3146A19BC00AF5653 /* CPTMutablePlotRange.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6371BC83F2A0091C8F7 /* CPTPieChart.h in Headers */ = {isa = PBXBuildFile; fileRef = BC74A32E10FC402600E7E90D /* CPTPieChart.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6381BC83F2A0091C8F7 /* CPTMutableNumericData+TypeConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CAFB241229E41F00F5C989 /* CPTMutableNumericData+TypeConversion.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6391BC83F2A0091C8F7 /* CPTAxisLabelGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C032C710B8DEDC003A11B6 /* CPTAxisLabelGroup.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA63A1BC83F2A0091C8F7 /* CPTPlotSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BF0D7A0F2B72B0002FCEA7 /* CPTPlotSpace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA63B1BC83F2A0091C8F7 /* CPTGraphHostingView.h in Headers */ = {isa = PBXBuildFile; fileRef = C38A0B271A46265300D45436 /* CPTGraphHostingView.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA63C1BC83F2A0091C8F7 /* CPTColorSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 079FC0BB0FB9762B0037E990 /* CPTColorSpace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA63D1BC83F2A0091C8F7 /* CPTXYPlotSpace.h in Headers */ = {isa = PBXBuildFile; fileRef = 0799E0970F2BB6E800790525 /* CPTXYPlotSpace.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA63E1BC83F2A0091C8F7 /* CPTLineStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 906156BC0F375598001B75FC /* CPTLineStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA63F1BC83F2A0091C8F7 /* CPTPathExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 070622300FDF1B250066A6C4 /* CPTPathExtensions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6401BC83F2A0091C8F7 /* _CPTBorderLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = C3408C3C15FC1C3E004F1D70 /* _CPTBorderLayer.h */; }; + C37EA6411BC83F2A0091C8F7 /* CPTNumericData.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C97EEFA104D80C400B554F9 /* CPTNumericData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6421BC83F2A0091C8F7 /* CPTLineCap.h in Headers */ = {isa = PBXBuildFile; fileRef = C3D3AD2B13DF8DCE0004EA73 /* CPTLineCap.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6431BC83F2A0091C8F7 /* _CPTFillGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = C342601E0FAE096C00072842 /* _CPTFillGradient.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6441BC83F2A0091C8F7 /* CPTNumericDataType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C97EEFC104D80C400B554F9 /* CPTNumericDataType.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6451BC83F2A0091C8F7 /* CPTAnimationPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C9CB11165DB50300739006 /* CPTAnimationPeriod.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6461BC83F2A0091C8F7 /* _CPTPlainWhiteTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BC55022E10059F22005DF982 /* _CPTPlainWhiteTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6471BC83F2A0091C8F7 /* CPTBorderedLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 0706223A0FDF215C0066A6C4 /* CPTBorderedLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6481BC83F2A0091C8F7 /* CPTAxisSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BF0D820F2B7340002FCEA7 /* CPTAxisSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6491BC83F2A0091C8F7 /* CPTScatterPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BF0D950F2B73CA002FCEA7 /* CPTScatterPlot.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA64A1BC83F2A0091C8F7 /* CPTMutableShadow.h in Headers */ = {isa = PBXBuildFile; fileRef = C32EE1BF13EC4BE700038266 /* CPTMutableShadow.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA64B1BC83F2A0091C8F7 /* _CPTPlainBlackTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BC55022C10059F22005DF982 /* _CPTPlainBlackTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA64C1BC83F2A0091C8F7 /* _CPTAnimationNSDecimalPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = A92C0685ACE3281299F10F73 /* _CPTAnimationNSDecimalPeriod.h */; }; + C37EA64D1BC83F2A0091C8F7 /* CPTCalendarFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = C349DCB2151AAFBF00BFD6A7 /* CPTCalendarFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA64E1BC83F2A0091C8F7 /* CPTTextLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CD7E7E50F4B4F8200F9BCBB /* CPTTextLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA64F1BC83F2A0091C8F7 /* CPTResponder.h in Headers */ = {isa = PBXBuildFile; fileRef = 07AEF1FD10BBE1F10012BEFF /* CPTResponder.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6501BC83F2A0091C8F7 /* CPTLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CD7E7EA0F4B4F9600F9BCBB /* CPTLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6511BC83F2A0091C8F7 /* CPTPlotAreaFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BF0D760F2B723A002FCEA7 /* CPTPlotAreaFrame.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6521BC83F2A0091C8F7 /* CPTXYAxis.h in Headers */ = {isa = PBXBuildFile; fileRef = 0783DD530FBF097E006C3696 /* CPTXYAxis.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6531BC83F2A0091C8F7 /* _CPTStocksTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = BC55023010059F22005DF982 /* _CPTStocksTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6541BC83F2A0091C8F7 /* CPTImage.h in Headers */ = {isa = PBXBuildFile; fileRef = C3AFC9CF0FB62969005DFFDC /* CPTImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6551BC83F2A0091C8F7 /* CPTTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = 0772C9250FE2F71600EC4C16 /* CPTTheme.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6561BC83F2A0091C8F7 /* CPTPlatformSpecificCategories.h in Headers */ = {isa = PBXBuildFile; fileRef = C38A0B181A46264500D45436 /* CPTPlatformSpecificCategories.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6571BC83F2A0091C8F7 /* NSNumberExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 078F42D90FACC075006E670B /* NSNumberExtensions.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6581BC83F2A0091C8F7 /* _CPTConstraintsRelative.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CCA03B13E8D85800CE6DB1 /* _CPTConstraintsRelative.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6591BC83F2A0091C8F7 /* CPTAnimationOperation.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C9CB0C165DB4D500739006 /* CPTAnimationOperation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA65A1BC83F2A0091C8F7 /* _CPTDarkGradientTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = 0772C92D0FE2F89000EC4C16 /* _CPTDarkGradientTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA65B1BC83F2A0091C8F7 /* CPTRangePlot.h in Headers */ = {isa = PBXBuildFile; fileRef = D0C0477C12D6560900DA8047 /* CPTRangePlot.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA65C1BC83F2A0091C8F7 /* _CPTAnimationCGSizePeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = A92C0563E082D1C1E249FA6F /* _CPTAnimationCGSizePeriod.h */; }; + C37EA65D1BC83F2A0091C8F7 /* CPTPlotGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = C3F31DE81045EB470058520A /* CPTPlotGroup.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA65E1BC83F2A0091C8F7 /* CPTLegend.h in Headers */ = {isa = PBXBuildFile; fileRef = C3920AC21395B6500045F3BB /* CPTLegend.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA65F1BC83F2A0091C8F7 /* _CPTFillImage.h in Headers */ = {isa = PBXBuildFile; fileRef = C34260180FAE096C00072842 /* _CPTFillImage.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6601BC83F2A0091C8F7 /* _CPTAnimationCGRectPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = A92C0E876AE37EB30019586B /* _CPTAnimationCGRectPeriod.h */; }; + C37EA6611BC83F2A0091C8F7 /* CPTPlotSpaceAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 07E10BAF11D1016B000B8DAB /* CPTPlotSpaceAnnotation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6621BC83F2A0091C8F7 /* CPTConstraints.h in Headers */ = {isa = PBXBuildFile; fileRef = 070064E7111F2BAA003DE087 /* CPTConstraints.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6631BC83F2A0091C8F7 /* NSCoderExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = C3978E0413CE653B00A420D9 /* NSCoderExtensions.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6641BC83F2A0091C8F7 /* CPTNumericData+TypeConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C97EEF7104D80C400B554F9 /* CPTNumericData+TypeConversion.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6651BC83F2A0091C8F7 /* _CPTFillColor.h in Headers */ = {isa = PBXBuildFile; fileRef = C342601B0FAE096C00072842 /* _CPTFillColor.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6661BC83F2A0091C8F7 /* _CPTXYTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = C3DA34CB107AD7710051DA02 /* _CPTXYTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6671BC83F2A0091C8F7 /* CPTLayerAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 07E10BB911D10183000B8DAB /* CPTLayerAnnotation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6681BC83F2A0091C8F7 /* _CPTAnimationCGFloatPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C9CB15165DB52C00739006 /* _CPTAnimationCGFloatPeriod.h */; }; + C37EA6691BC83F2A0091C8F7 /* CPTAxisTitle.h in Headers */ = {isa = PBXBuildFile; fileRef = BCFC7C3510921FDB00DAECAA /* CPTAxisTitle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA66A1BC83F2A0091C8F7 /* _CPTSlateTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = 07FCF2C4115B54AE00E46606 /* _CPTSlateTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA66B1BC83F2A0091C8F7 /* CPTMutableNumericData.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C97EF10104D819100B554F9 /* CPTMutableNumericData.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA66C1BC83F2A0091C8F7 /* CPTGridLineGroup.h in Headers */ = {isa = PBXBuildFile; fileRef = C38DD49111A04B7A002A68E7 /* CPTGridLineGroup.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA66D1BC83F2A0091C8F7 /* CorePlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 070CF7AE0F3CA7AB0001FFF4 /* CorePlot.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA66E1BC83F2A0091C8F7 /* CPTMutableLineStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 07B69B1512B62ABB00F4C16C /* CPTMutableLineStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA66F1BC83F2A0091C8F7 /* CPTAnimation.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2846F16584EB9006BA43C /* CPTAnimation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6701BC83F2A0091C8F7 /* CPTExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 07321BBF0F37370D00F423D8 /* CPTExceptions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6711BC83F2A0091C8F7 /* CPTPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 07BF0D7E0F2B72F6002FCEA7 /* CPTPlot.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6721BC83F2A0091C8F7 /* CPTShadow.h in Headers */ = {isa = PBXBuildFile; fileRef = C32EE1B413EC4AA800038266 /* CPTShadow.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6731BC83F2A0091C8F7 /* CPTAnnotation.h in Headers */ = {isa = PBXBuildFile; fileRef = 07E10BB411D10177000B8DAB /* CPTAnnotation.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6741BC83F2A0091C8F7 /* CPTColor.h in Headers */ = {isa = PBXBuildFile; fileRef = 079FC0B20FB975500037E990 /* CPTColor.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6751BC83F2A0091C8F7 /* CPTTextStylePlatformSpecific.h in Headers */ = {isa = PBXBuildFile; fileRef = C38A0A531A461F9700D45436 /* CPTTextStylePlatformSpecific.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6761BC83F2A0091C8F7 /* CPTFill.h in Headers */ = {isa = PBXBuildFile; fileRef = C342601F0FAE096C00072842 /* CPTFill.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6771BC83F2A0091C8F7 /* CPTPlotRange.h in Headers */ = {isa = PBXBuildFile; fileRef = 32484B3F0F530E8B002151AD /* CPTPlotRange.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6781BC83F2A0091C8F7 /* CPTXYAxisSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 07975C410F3B816600DE45DC /* CPTXYAxisSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6791BC83F2A0091C8F7 /* CPTTimeFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 07A2E6FA102DF47900809BC5 /* CPTTimeFormatter.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA67A1BC83F2A0091C8F7 /* CPTLegendEntry.h in Headers */ = {isa = PBXBuildFile; fileRef = C30550EB1399BE5400E0151F /* CPTLegendEntry.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA67B1BC83F2A0091C8F7 /* CPTPlotArea.h in Headers */ = {isa = PBXBuildFile; fileRef = C34BF5BA10A67633007F0894 /* CPTPlotArea.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA67C1BC83F2A0091C8F7 /* _CPTMaskLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = C3286BFE15D8740100A436A8 /* _CPTMaskLayer.h */; }; + C37EA67D1BC83F2A0091C8F7 /* _CPTAnimationPlotRangePeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = A92C0E16290C226BC4BE3936 /* _CPTAnimationPlotRangePeriod.h */; }; + C37EA67E1BC83F2A0091C8F7 /* CPTFunctionDataSource.h in Headers */ = {isa = PBXBuildFile; fileRef = C3F97F1C17A9E07B00A52FF2 /* CPTFunctionDataSource.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA67F1BC83F2A0091C8F7 /* CPTGradient.h in Headers */ = {isa = PBXBuildFile; fileRef = 07CA112D0FAC8F85000861CE /* CPTGradient.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6801BC83F2A0091C8F7 /* _CPTAnimationCGPointPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = A92C0E154E8598EDE2EDEF2F /* _CPTAnimationCGPointPeriod.h */; }; + C37EA6811BC83F2A0091C8F7 /* NSDecimalNumberExtensions.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CD7E7EE0F4B4FA700F9BCBB /* NSDecimalNumberExtensions.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6821BC83F2A0091C8F7 /* CPTAxis.h in Headers */ = {isa = PBXBuildFile; fileRef = 07975C470F3B818800DE45DC /* CPTAxis.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6831BC83F2A0091C8F7 /* CPTPlatformSpecificFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = C38A0B1C1A46264500D45436 /* CPTPlatformSpecificFunctions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6841BC83F2A0091C8F7 /* CPTAnnotationHostLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 072161E911D1F6BD009CC871 /* CPTAnnotationHostLayer.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6851BC83F2A0091C8F7 /* CPTAxisLabel.h in Headers */ = {isa = PBXBuildFile; fileRef = 073FB02E0FC991A3007A728E /* CPTAxisLabel.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6861BC83F2A0091C8F7 /* CPTDebugQuickLook.h in Headers */ = {isa = PBXBuildFile; fileRef = C3BB93181B729BD200004527 /* CPTDebugQuickLook.h */; }; + C37EA6871BC83F2A0091C8F7 /* _CPTAnimationTimingFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = C3C2847316585085006BA43C /* _CPTAnimationTimingFunctions.h */; }; + C37EA6881BC83F2A0091C8F7 /* CPTMutableTextStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C467990FE1A24C00299939 /* CPTMutableTextStyle.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA6891BC83F2A0091C8F7 /* CPTXYGraph.h in Headers */ = {isa = PBXBuildFile; fileRef = 07983EF40F2F9A3D008C8618 /* CPTXYGraph.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA68A1BC83F2A0091C8F7 /* CPTPlatformSpecificDefines.h in Headers */ = {isa = PBXBuildFile; fileRef = C38A0B1A1A46264500D45436 /* CPTPlatformSpecificDefines.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA68B1BC83F2A0091C8F7 /* CPTBarPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 0799E0930F2BB5F300790525 /* CPTBarPlot.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA68C1BC83F2A0091C8F7 /* CPTUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 07321BC40F37382D00F423D8 /* CPTUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C37EA68D1BC83F2A0091C8F7 /* _CPTConstraintsFixed.h in Headers */ = {isa = PBXBuildFile; fileRef = C3CCA03913E8D85800CE6DB1 /* _CPTConstraintsFixed.h */; settings = {ATTRIBUTES = (Private, ); }; }; + C37EA6981BC83F2D0091C8F7 /* CPTMutableNumericDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CADDC611B167AD00D36017 /* CPTMutableNumericDataTests.m */; }; + C37EA6991BC83F2D0091C8F7 /* CPTColorSpaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979AE13D2337E00145DFF /* CPTColorSpaceTests.m */; }; + C37EA69A1BC83F2D0091C8F7 /* CPTFillTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979BA13D2347300145DFF /* CPTFillTests.m */; }; + C37EA69B1BC83F2D0091C8F7 /* CPTUtilitiesTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD7E9630F4B625900F9BCBB /* CPTUtilitiesTests.m */; }; + C37EA69C1BC83F2D0091C8F7 /* CPTGradientTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979B113D233C000145DFF /* CPTGradientTests.m */; }; + C37EA69D1BC83F2D0091C8F7 /* CPTDarkGradientThemeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E1FE6051100F27EF00895A91 /* CPTDarkGradientThemeTests.m */; }; + C37EA69E1BC83F2D0091C8F7 /* CPTAxisLabelTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CD23FFB0FFBE78400ADD2E2 /* CPTAxisLabelTests.m */; }; + C37EA69F1BC83F2D0091C8F7 /* CPTThemeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = E1620CBD100F03A100A84E77 /* CPTThemeTests.m */; }; + C37EA6A01BC83F2D0091C8F7 /* CPTColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979AB13D2332500145DFF /* CPTColorTests.m */; }; + C37EA6A11BC83F2D0091C8F7 /* CPTPlotSpaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979A313D2136600145DFF /* CPTPlotSpaceTests.m */; }; + C37EA6A21BC83F2D0091C8F7 /* CPTImageTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979B413D2340000145DFF /* CPTImageTests.m */; }; + C37EA6A31BC83F2D0091C8F7 /* CPTDataSourceTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */; }; + C37EA6A41BC83F2D0091C8F7 /* CPTNumericDataTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EF06104D80D400B554F9 /* CPTNumericDataTests.m */; }; + C37EA6A51BC83F2D0091C8F7 /* CPTDerivedXYGraph.m in Sources */ = {isa = PBXBuildFile; fileRef = E1FE611A100F3FB700895A91 /* CPTDerivedXYGraph.m */; }; + C37EA6A61BC83F2D0091C8F7 /* CPTXYPlotSpaceTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C422A630FB1FCD5000CAA43 /* CPTXYPlotSpaceTests.m */; }; + C37EA6A71BC83F2D0091C8F7 /* CPTTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0730F64D109494D100E95162 /* CPTTestCase.m */; }; + C37EA6A81BC83F2D0091C8F7 /* CPTPlotRangeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C36E89B911EE7F97003DE309 /* CPTPlotRangeTests.m */; }; + C37EA6A91BC83F2D0091C8F7 /* CPTNumericDataTypeConversionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EF08104D80D400B554F9 /* CPTNumericDataTypeConversionTests.m */; }; + C37EA6AA1BC83F2D0091C8F7 /* CPTMutableNumericDataTypeConversionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3CB561B122A9E9F00FBFB61 /* CPTMutableNumericDataTypeConversionTests.m */; }; + C37EA6AB1BC83F2D0091C8F7 /* CPTLineStyleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979B713D2344000145DFF /* CPTLineStyleTests.m */; }; + C37EA6AC1BC83F2D0091C8F7 /* CPTTextStyleTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C36468A90FE5533F0064B186 /* CPTTextStyleTests.m */; }; + C37EA6AD1BC83F2D0091C8F7 /* CPTTimeFormatterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979A813D2328000145DFF /* CPTTimeFormatterTests.m */; }; + C37EA6AE1BC83F2D0091C8F7 /* CPTLayerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3C1C07F1790D3B400E8B1B7 /* CPTLayerTests.m */; }; + C37EA6AF1BC83F2D0091C8F7 /* CPTScatterPlotTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 07FEBD61110B7E8B00E44D37 /* CPTScatterPlotTests.m */; }; + C37EA6B11BC83F2D0091C8F7 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; C38A09831A46185300D45436 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C38A09781A46185200D45436 /* CorePlot.framework */; }; C38A09C51A4619A900D45436 /* libCorePlot-CocoaTouch.a in Frameworks */ = {isa = PBXBuildFile; fileRef = C38A09BA1A4619A900D45436 /* libCorePlot-CocoaTouch.a */; }; C38A09D11A461C1100D45436 /* CPTTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0730F64D109494D100E95162 /* CPTTestCase.m */; }; C38A09D21A461C1300D45436 /* CPTTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 0730F64D109494D100E95162 /* CPTTestCase.m */; }; C38A09D31A461C1800D45436 /* CPTDataSourceTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */; }; C38A09D41A461C1900D45436 /* CPTDataSourceTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */; }; - C38A09D51A461C1E00D45436 /* CorePlotProbes.d in Sources */ = {isa = PBXBuildFile; fileRef = BC89A64010239D1D009D5261 /* CorePlotProbes.d */; }; - C38A09D61A461C2B00D45436 /* CorePlotProbes.d in Sources */ = {isa = PBXBuildFile; fileRef = BC89A64010239D1D009D5261 /* CorePlotProbes.d */; }; C38A09D81A461C5800D45436 /* CPTNumericDataType.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C97EEFC104D80C400B554F9 /* CPTNumericDataType.h */; settings = {ATTRIBUTES = (Public, ); }; }; C38A09D91A461C6B00D45436 /* CPTNumericDataType.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EEFD104D80C400B554F9 /* CPTNumericDataType.m */; }; C38A09DA1A461C6C00D45436 /* CPTNumericDataType.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EEFD104D80C400B554F9 /* CPTNumericDataType.m */; }; @@ -562,6 +788,14 @@ C3A695E5146A19BC00AF5653 /* CPTMutablePlotRange.h in Headers */ = {isa = PBXBuildFile; fileRef = C3A695E3146A19BC00AF5653 /* CPTMutablePlotRange.h */; settings = {ATTRIBUTES = (Public, ); }; }; C3A695E6146A19BC00AF5653 /* CPTMutablePlotRange.m in Sources */ = {isa = PBXBuildFile; fileRef = C3A695E4146A19BC00AF5653 /* CPTMutablePlotRange.m */; }; C3AFC9D10FB62969005DFFDC /* CPTImage.h in Headers */ = {isa = PBXBuildFile; fileRef = C3AFC9CF0FB62969005DFFDC /* CPTImage.h */; settings = {ATTRIBUTES = (Public, ); }; }; + C3B4D4971BC9983300450C37 /* CorePlot.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C37EA6921BC83F2A0091C8F7 /* CorePlot.framework */; }; + C3BB3C8E1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3BB3C8C1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h */; }; + C3BB3C8F1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3BB3C8C1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h */; }; + C3BB3C901C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h in Headers */ = {isa = PBXBuildFile; fileRef = C3BB3C8C1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h */; }; + C3BB3C911C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3BB3C8D1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m */; }; + C3BB3C921C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3BB3C8D1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m */; }; + C3BB3C931C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3BB3C8D1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m */; }; + C3BB3C941C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m in Sources */ = {isa = PBXBuildFile; fileRef = C3BB3C8D1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m */; }; C3BB93191B729BD200004527 /* CPTDebugQuickLook.h in Headers */ = {isa = PBXBuildFile; fileRef = C3BB93181B729BD200004527 /* CPTDebugQuickLook.h */; }; C3BB931A1B729BD200004527 /* CPTDebugQuickLook.h in Headers */ = {isa = PBXBuildFile; fileRef = C3BB93181B729BD200004527 /* CPTDebugQuickLook.h */; }; C3BFFD1112274CB500DE22AC /* CPTNumericDataTypeConversionTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C97EF08104D80D400B554F9 /* CPTNumericDataTypeConversionTests.m */; }; @@ -608,12 +842,10 @@ C3D979BB13D2347400145DFF /* CPTFillTests.m in Sources */ = {isa = PBXBuildFile; fileRef = C3D979BA13D2347300145DFF /* CPTFillTests.m */; }; C3DA34CC107AD7710051DA02 /* _CPTXYTheme.m in Sources */ = {isa = PBXBuildFile; fileRef = C3DA34CA107AD7710051DA02 /* _CPTXYTheme.m */; }; C3DA34CD107AD7710051DA02 /* _CPTXYTheme.h in Headers */ = {isa = PBXBuildFile; fileRef = C3DA34CB107AD7710051DA02 /* _CPTXYTheme.h */; settings = {ATTRIBUTES = (Private, ); }; }; - C3EE4E681A6C13260098F4E6 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A551A69F6F000F77249 /* Accelerate.framework */; }; C3EE4E691A6C133D0098F4E6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A511A69F6DA00F77249 /* QuartzCore.framework */; }; C3EE4E6A1A6C134B0098F4E6 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A571A69F6FA00F77249 /* CoreGraphics.framework */; }; C3EE4E6B1A6C13560098F4E6 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3226A531A69F6DF00F77249 /* UIKit.framework */; }; C3EE4E6E1A6C15890098F4E6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07BF0D630F2B70B8002FCEA7 /* QuartzCore.framework */; }; - C3EE4E6F1A6C15920098F4E6 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3BB7D1416322F7E00BC9515 /* Accelerate.framework */; }; C3EE4E981A6C1E890098F4E6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3EE4E971A6C1E890098F4E6 /* Cocoa.framework */; }; C3EE4E9A1A6C1F770098F4E6 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 07BF0D630F2B70B8002FCEA7 /* QuartzCore.framework */; }; C3EE4E9B1A6C1F8A0098F4E6 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C3EE4E971A6C1E890098F4E6 /* Cocoa.framework */; }; @@ -647,6 +879,13 @@ remoteGlobalIDString = C38A09B91A4619A900D45436; remoteInfo = "CorePlot-CocoaTouch"; }; + C3B4D4951BC997F600450C37 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 0867D690FE84028FC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = C37EA5C91BC83F2A0091C8F7; + remoteInfo = "CorePlot tvOS"; + }; /* End PBXContainerItemProxy section */ /* Begin PBXCopyFilesBuildPhase section */ @@ -680,7 +919,7 @@ 07321BBF0F37370D00F423D8 /* CPTExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTExceptions.h; sourceTree = ""; }; 07321BC00F37370D00F423D8 /* CPTExceptions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTExceptions.m; sourceTree = ""; }; 07321BC40F37382D00F423D8 /* CPTUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTUtilities.h; sourceTree = ""; }; - 07321BC50F37382D00F423D8 /* CPTUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTUtilities.m; sourceTree = ""; }; + 07321BC50F37382D00F423D8 /* CPTUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTUtilities.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 073FB02E0FC991A3007A728E /* CPTAxisLabel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTAxisLabel.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 073FB02F0FC991A3007A728E /* CPTAxisLabel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTAxisLabel.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 0772B43710E24D5C009CD04C /* CPTTradingRangePlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTradingRangePlot.h; sourceTree = ""; }; @@ -718,9 +957,9 @@ 07B69A5B12B6215000F4C16C /* CPTTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTTextStyle.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 07B69A5C12B6215000F4C16C /* CPTTextStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTTextStyle.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 07B69B1512B62ABB00F4C16C /* CPTMutableLineStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTMutableLineStyle.h; sourceTree = ""; }; - 07B69B1612B62ABB00F4C16C /* CPTMutableLineStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTMutableLineStyle.m; sourceTree = ""; }; + 07B69B1612B62ABB00F4C16C /* CPTMutableLineStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTMutableLineStyle.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 07BF0D630F2B70B8002FCEA7 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - 07BF0D700F2B718F002FCEA7 /* CPTGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGraph.h; sourceTree = ""; }; + 07BF0D700F2B718F002FCEA7 /* CPTGraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTGraph.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 07BF0D710F2B718F002FCEA7 /* CPTGraph.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTGraph.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 07BF0D760F2B723A002FCEA7 /* CPTPlotAreaFrame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotAreaFrame.h; sourceTree = ""; }; 07BF0D770F2B723A002FCEA7 /* CPTPlotAreaFrame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPlotAreaFrame.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; @@ -732,7 +971,7 @@ 07BF0D830F2B7340002FCEA7 /* CPTAxisSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTAxisSet.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 07BF0D950F2B73CA002FCEA7 /* CPTScatterPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTScatterPlot.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 07BF0D960F2B73CA002FCEA7 /* CPTScatterPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTScatterPlot.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - 07BF0DF10F2B7BFB002FCEA7 /* CPTDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTDefinitions.h; sourceTree = ""; }; + 07BF0DF10F2B7BFB002FCEA7 /* CPTDefinitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTDefinitions.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 07BF0DF20F2B7BFB002FCEA7 /* CPTDefinitions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTDefinitions.m; sourceTree = ""; }; 07C467990FE1A24C00299939 /* CPTMutableTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTMutableTextStyle.h; sourceTree = ""; }; 07C4679A0FE1A24C00299939 /* CPTMutableTextStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTMutableTextStyle.m; sourceTree = ""; }; @@ -750,14 +989,13 @@ 07FCF2C5115B54AE00E46606 /* _CPTSlateTheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTSlateTheme.m; sourceTree = ""; }; 07FEBD60110B7E8B00E44D37 /* CPTScatterPlotTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTScatterPlotTests.h; sourceTree = ""; }; 07FEBD61110B7E8B00E44D37 /* CPTScatterPlotTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTScatterPlotTests.m; sourceTree = ""; }; - 089C1667FE841158C02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = ""; }; 32484B3F0F530E8B002151AD /* CPTPlotRange.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTPlotRange.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 32484B400F530E8B002151AD /* CPTPlotRange.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPlotRange.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 32DBCF5E0370ADEE00C91783 /* CorePlot_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CorePlot_Prefix.pch; sourceTree = ""; }; 4C422A620FB1FCD5000CAA43 /* CPTXYPlotSpaceTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTXYPlotSpaceTests.h; sourceTree = ""; }; 4C422A630FB1FCD5000CAA43 /* CPTXYPlotSpaceTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTXYPlotSpaceTests.m; sourceTree = ""; }; 4C97EEF7104D80C400B554F9 /* CPTNumericData+TypeConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CPTNumericData+TypeConversion.h"; sourceTree = ""; }; - 4C97EEF9104D80C400B554F9 /* CPTNumericData+TypeConversions_Generation.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = "CPTNumericData+TypeConversions_Generation.py"; sourceTree = ""; }; + 4C97EEF9104D80C400B554F9 /* CPTNumericData+TypeConversions_Generation.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; lineEnding = 0; path = "CPTNumericData+TypeConversions_Generation.py"; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.python; }; 4C97EEFA104D80C400B554F9 /* CPTNumericData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTNumericData.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4C97EEFB104D80C400B554F9 /* CPTNumericData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTNumericData.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4C97EEFC104D80C400B554F9 /* CPTNumericDataType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTNumericDataType.h; sourceTree = ""; }; @@ -767,33 +1005,32 @@ 4C97EF07104D80D400B554F9 /* CPTNumericDataTypeConversionTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTNumericDataTypeConversionTests.h; sourceTree = ""; }; 4C97EF08104D80D400B554F9 /* CPTNumericDataTypeConversionTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTNumericDataTypeConversionTests.m; sourceTree = ""; }; 4C97EF10104D819100B554F9 /* CPTMutableNumericData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTMutableNumericData.h; sourceTree = ""; }; - 4C97EF11104D819100B554F9 /* CPTMutableNumericData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTMutableNumericData.m; sourceTree = ""; }; + 4C97EF11104D819100B554F9 /* CPTMutableNumericData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTMutableNumericData.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4C97EF4C104D843E00B554F9 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = license.txt; sourceTree = ""; }; - 4C9A745D0FB24C7200918464 /* CPTDataSourceTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTDataSourceTestCase.h; sourceTree = ""; }; - 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTDataSourceTestCase.m; sourceTree = ""; }; + 4C9A745D0FB24C7200918464 /* CPTDataSourceTestCase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTDataSourceTestCase.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; + 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTDataSourceTestCase.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4CD23FFA0FFBE78400ADD2E2 /* CPTAxisLabelTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxisLabelTests.h; sourceTree = ""; }; 4CD23FFB0FFBE78400ADD2E2 /* CPTAxisLabelTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTAxisLabelTests.m; sourceTree = ""; }; 4CD7E7E50F4B4F8200F9BCBB /* CPTTextLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTTextLayer.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4CD7E7E60F4B4F8200F9BCBB /* CPTTextLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTTextLayer.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 4CD7E7EA0F4B4F9600F9BCBB /* CPTLayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTLayer.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; - 4CD7E7EB0F4B4F9600F9BCBB /* CPTLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTLayer.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + 4CD7E7EB0F4B4F9600F9BCBB /* CPTLayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTLayer.m; sourceTree = ""; }; 4CD7E7EE0F4B4FA700F9BCBB /* NSDecimalNumberExtensions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSDecimalNumberExtensions.h; sourceTree = ""; }; 4CD7E7EF0F4B4FA700F9BCBB /* NSDecimalNumberExtensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NSDecimalNumberExtensions.m; sourceTree = ""; }; 4CD7E9620F4B625900F9BCBB /* CPTUtilitiesTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTUtilitiesTests.h; sourceTree = ""; }; 4CD7E9630F4B625900F9BCBB /* CPTUtilitiesTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTUtilitiesTests.m; sourceTree = ""; }; - 8DC2EF5A0486A6940098B216 /* CorePlot-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "CorePlot-Info.plist"; sourceTree = ""; }; 8DC2EF5B0486A6940098B216 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - 9021E5690FC69B2900443472 /* doxygen.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = doxygen.config; path = ../documentation/doxygen/doxygen.config; sourceTree = SOURCE_ROOT; }; + 9021E5690FC69B2900443472 /* doxygen.config */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; lineEnding = 0; name = doxygen.config; path = ../documentation/doxygen/doxygen.config; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = ""; }; 906156BC0F375598001B75FC /* CPTLineStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTLineStyle.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 906156BD0F375598001B75FC /* CPTLineStyle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTLineStyle.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; 90AF4FB90F36D39700753D26 /* CPTXYPlotSpace.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTXYPlotSpace.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - A92C00B71DCB2085A92BE0A9 /* _CPTAnimationNSDecimalPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTAnimationNSDecimalPeriod.m; sourceTree = ""; }; + A92C00B71DCB2085A92BE0A9 /* _CPTAnimationNSDecimalPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = _CPTAnimationNSDecimalPeriod.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; A92C0563E082D1C1E249FA6F /* _CPTAnimationCGSizePeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _CPTAnimationCGSizePeriod.h; sourceTree = ""; }; A92C0685ACE3281299F10F73 /* _CPTAnimationNSDecimalPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _CPTAnimationNSDecimalPeriod.h; sourceTree = ""; }; - A92C087BF0913A6BA2363E40 /* _CPTAnimationCGSizePeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTAnimationCGSizePeriod.m; sourceTree = ""; }; + A92C087BF0913A6BA2363E40 /* _CPTAnimationCGSizePeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = _CPTAnimationCGSizePeriod.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; A92C091B8592D9F32AC384CB /* _CPTAnimationPlotRangePeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTAnimationPlotRangePeriod.m; sourceTree = ""; }; - A92C0AE447398AF62D584F9C /* _CPTAnimationCGPointPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTAnimationCGPointPeriod.m; sourceTree = ""; }; - A92C0C3DB583ED8FC2EFD9DB /* _CPTAnimationCGRectPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTAnimationCGRectPeriod.m; sourceTree = ""; }; + A92C0AE447398AF62D584F9C /* _CPTAnimationCGPointPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = _CPTAnimationCGPointPeriod.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + A92C0C3DB583ED8FC2EFD9DB /* _CPTAnimationCGRectPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = _CPTAnimationCGRectPeriod.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; A92C0E154E8598EDE2EDEF2F /* _CPTAnimationCGPointPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _CPTAnimationCGPointPeriod.h; sourceTree = ""; }; A92C0E16290C226BC4BE3936 /* _CPTAnimationPlotRangePeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _CPTAnimationPlotRangePeriod.h; sourceTree = ""; }; A92C0E876AE37EB30019586B /* _CPTAnimationCGRectPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _CPTAnimationCGRectPeriod.h; sourceTree = ""; }; @@ -807,7 +1044,6 @@ BC74A32F10FC402600E7E90D /* CPTPieChart.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPieChart.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; BC79F1340FD1CD6600510976 /* CPTGraphHostingView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTGraphHostingView.h; sourceTree = ""; }; BC79F1350FD1CD6600510976 /* CPTGraphHostingView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTGraphHostingView.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - BC89A64010239D1D009D5261 /* CorePlotProbes.d */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.dtrace; name = CorePlotProbes.d; path = TestResources/CorePlotProbes.d; sourceTree = SOURCE_ROOT; }; BCFC7C3510921FDB00DAECAA /* CPTAxisTitle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxisTitle.h; sourceTree = ""; }; BCFC7C3610921FDB00DAECAA /* CPTAxisTitle.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTAxisTitle.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C30550EB1399BE5400E0151F /* CPTLegendEntry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTLegendEntry.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -816,14 +1052,9 @@ C318F4AB11EA188700595FF9 /* CPTLimitBand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTLimitBand.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; C318F4AC11EA188700595FF9 /* CPTLimitBand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTLimitBand.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C31908A41998168C00B61898 /* CorePlot.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlot.xcconfig; path = xcconfig/CorePlot.xcconfig; sourceTree = ""; }; - C3226A451A69ED0900F77249 /* doxygen touch.config */ = {isa = PBXFileReference; lastKnownFileType = text; name = "doxygen touch.config"; path = "../documentation/doxygen/doxygen touch.config"; sourceTree = ""; }; + C3226A451A69ED0900F77249 /* doxygen touch.config */ = {isa = PBXFileReference; lastKnownFileType = text; lineEnding = 0; name = "doxygen touch.config"; path = "../documentation/doxygen/doxygen touch.config"; sourceTree = ""; xcLanguageSpecificationIdentifier = ""; }; C3226A461A69ED1F00F77249 /* doxygen-cocoa-touch-tags.xml */ = {isa = PBXFileReference; lastKnownFileType = text.xml; name = "doxygen-cocoa-touch-tags.xml"; path = "../documentation/doxygen/doxygen-cocoa-touch-tags.xml"; sourceTree = ""; }; C3226A471A69EE9200F77249 /* CorePlot-CocoaTouch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "CorePlot-CocoaTouch.h"; sourceTree = ""; }; - C3226A4C1A69F07600F77249 /* CorePlotTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CorePlotTests-Info.plist"; sourceTree = SOURCE_ROOT; }; - C3226A4D1A69F09A00F77249 /* CorePlot-iOSTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CorePlot-iOSTests-Info.plist"; sourceTree = SOURCE_ROOT; }; - C3226A4E1A69F0AA00F77249 /* CorePlot-CocoaTouchTests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CorePlot-CocoaTouchTests-Info.plist"; sourceTree = SOURCE_ROOT; }; - C3226A4F1A69F18C00F77249 /* CorePlot-CocoaTouch-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CorePlot-CocoaTouch-Info.plist"; sourceTree = ""; }; - C3226A501A69F1A700F77249 /* CorePlot_iOS-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "CorePlot_iOS-Info.plist"; sourceTree = ""; }; C3226A511A69F6DA00F77249 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; }; C3226A531A69F6DF00F77249 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/UIKit.framework; sourceTree = DEVELOPER_DIR; }; C3226A551A69F6F000F77249 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.1.sdk/System/Library/Frameworks/Accelerate.framework; sourceTree = DEVELOPER_DIR; }; @@ -847,6 +1078,10 @@ C342601D0FAE096C00072842 /* _CPTFillImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = _CPTFillImage.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C342601E0FAE096C00072842 /* _CPTFillGradient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = _CPTFillGradient.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; C342601F0FAE096C00072842 /* CPTFill.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTFill.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; + C3490DF120E028CF0089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-Info.plist"; sourceTree = ""; }; + C3490DF320E028D30089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-CocoaTouch-Info.plist"; sourceTree = ""; }; + C3490DF520E028D80089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-iOS-Info.plist"; sourceTree = ""; }; + C3490DF720E028DC0089F309 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-tvOS-Info.plist"; sourceTree = ""; }; C349DCB2151AAFBF00BFD6A7 /* CPTCalendarFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTCalendarFormatter.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; C349DCB3151AAFBF00BFD6A7 /* CPTCalendarFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTCalendarFormatter.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C34AFE6911021D010041675A /* CPTPlotSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTPlotSymbol.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; @@ -854,11 +1089,20 @@ C34BF5BA10A67633007F0894 /* CPTPlotArea.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotArea.h; sourceTree = ""; }; C34BF5BB10A67633007F0894 /* CPTPlotArea.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTPlotArea.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C34F570D19D8CE5500446248 /* CorePlotWarnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = CorePlotWarnings.xcconfig; path = xcconfig/CorePlotWarnings.xcconfig; sourceTree = ""; }; + C3564CBD22A2D0E1000A54C9 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = ""; }; C36468A80FE5533F0064B186 /* CPTTextStyleTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTTextStyleTests.h; sourceTree = ""; }; C36468A90FE5533F0064B186 /* CPTTextStyleTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTTextStyleTests.m; sourceTree = ""; }; C36E89B811EE7F97003DE309 /* CPTPlotRangeTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTPlotRangeTests.h; sourceTree = ""; }; C36E89B911EE7F97003DE309 /* CPTPlotRangeTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTPlotRangeTests.m; sourceTree = ""; }; + C377B3B91C122AA600891DF8 /* CPTCalendarFormatterTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTCalendarFormatterTests.h; sourceTree = ""; }; + C377B3BA1C122AA600891DF8 /* CPTCalendarFormatterTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTCalendarFormatterTests.m; sourceTree = ""; }; C3791D07191D4C4C001EC514 /* CPTImagePlatformSpecific.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; name = CPTImagePlatformSpecific.m; path = MacOnly/CPTImagePlatformSpecific.m; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; + C37A406320E02B9D00C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-tvOSTests-Info.plist"; sourceTree = ""; }; + C37A406520E02BA100C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-CocoaTouchTests-Info.plist"; sourceTree = ""; }; + C37A406720E02BA500C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlot-iOSTests-Info.plist"; sourceTree = ""; }; + C37A406920E02BE900C4FF48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Base; path = "Base.lproj/CorePlotTests-Info.plist"; sourceTree = ""; }; + C37EA6921BC83F2A0091C8F7 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + C37EA6B71BC83F2D0091C8F7 /* UnitTests tvOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UnitTests tvOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C38A09781A46185200D45436 /* CorePlot.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CorePlot.framework; sourceTree = BUILT_PRODUCTS_DIR; }; C38A09821A46185300D45436 /* UnitTests iOS.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "UnitTests iOS.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; C38A09BA1A4619A900D45436 /* libCorePlot-CocoaTouch.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libCorePlot-CocoaTouch.a"; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -886,17 +1130,19 @@ C3AFC9D00FB62969005DFFDC /* CPTImage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTImage.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C3B235631009931400970270 /* doxygen-cocoa-tags.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; name = "doxygen-cocoa-tags.xml"; path = "../documentation/doxygen/doxygen-cocoa-tags.xml"; sourceTree = ""; }; C3B25EDF1AC23A7D0063CCD8 /* CorePlot.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CorePlot.h; sourceTree = ""; }; + C3BB3C8C1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _CPTAnimationNSNumberPeriod.h; sourceTree = ""; }; + C3BB3C8D1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTAnimationNSNumberPeriod.m; sourceTree = ""; }; C3BB7D1416322F7E00BC9515 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; }; C3BB93181B729BD200004527 /* CPTDebugQuickLook.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTDebugQuickLook.h; sourceTree = ""; }; C3C032C710B8DEDC003A11B6 /* CPTAxisLabelGroup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAxisLabelGroup.h; sourceTree = ""; }; C3C032C810B8DEDC003A11B6 /* CPTAxisLabelGroup.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTAxisLabelGroup.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; - C3C1C07E1790D3B400E8B1B7 /* CPTLayerTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTLayerTests.h; sourceTree = ""; }; - C3C1C07F1790D3B400E8B1B7 /* CPTLayerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CPTLayerTests.m; sourceTree = ""; }; + C3C1C07E1790D3B400E8B1B7 /* CPTLayerTests.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTLayerTests.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; + C3C1C07F1790D3B400E8B1B7 /* CPTLayerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTLayerTests.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C3C2846F16584EB9006BA43C /* CPTAnimation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTAnimation.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; C3C2847016584EB9006BA43C /* CPTAnimation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTAnimation.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C3C2847316585085006BA43C /* _CPTAnimationTimingFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _CPTAnimationTimingFunctions.h; sourceTree = ""; }; C3C2847416585085006BA43C /* _CPTAnimationTimingFunctions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = _CPTAnimationTimingFunctions.m; sourceTree = ""; }; - C3C9CB0C165DB4D500739006 /* CPTAnimationOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CPTAnimationOperation.h; sourceTree = ""; }; + C3C9CB0C165DB4D500739006 /* CPTAnimationOperation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTAnimationOperation.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; C3C9CB0D165DB4D500739006 /* CPTAnimationOperation.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTAnimationOperation.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; C3C9CB11165DB50300739006 /* CPTAnimationPeriod.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = CPTAnimationPeriod.h; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; C3C9CB12165DB50300739006 /* CPTAnimationPeriod.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = CPTAnimationPeriod.m; sourceTree = ""; xcLanguageSpecificationIdentifier = xcode.lang.objc; }; @@ -967,17 +1213,34 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3EE4E6F1A6C15920098F4E6 /* Accelerate.framework in Frameworks */, C3EE4E981A6C1E890098F4E6 /* Cocoa.framework in Frameworks */, C3EE4E6E1A6C15890098F4E6 /* QuartzCore.framework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; + C37EA6291BC83F2A0091C8F7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C37EA62B1BC83F2A0091C8F7 /* CoreGraphics.framework in Frameworks */, + C37EA62C1BC83F2A0091C8F7 /* QuartzCore.framework in Frameworks */, + C37EA62D1BC83F2A0091C8F7 /* UIKit.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C37EA6B01BC83F2D0091C8F7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + C37EA6B11BC83F2D0091C8F7 /* CoreGraphics.framework in Frameworks */, + C3B4D4971BC9983300450C37 /* CorePlot.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; C38A09741A46185200D45436 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3226A5D1A69F72F00F77249 /* Accelerate.framework in Frameworks */, C3226A5F1A69F75400F77249 /* CoreGraphics.framework in Frameworks */, C3226A5E1A69F73800F77249 /* QuartzCore.framework in Frameworks */, C3226A5C1A69F72900F77249 /* UIKit.framework in Frameworks */, @@ -997,7 +1260,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3226A561A69F6F000F77249 /* Accelerate.framework in Frameworks */, C3226A581A69F6FA00F77249 /* CoreGraphics.framework in Frameworks */, C3226A521A69F6DA00F77249 /* QuartzCore.framework in Frameworks */, C3226A541A69F6DF00F77249 /* UIKit.framework in Frameworks */, @@ -1008,7 +1270,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - C3EE4E681A6C13260098F4E6 /* Accelerate.framework in Frameworks */, C3EE4E6A1A6C134B0098F4E6 /* CoreGraphics.framework in Frameworks */, C3EE4E691A6C133D0098F4E6 /* QuartzCore.framework in Frameworks */, C3EE4E6B1A6C13560098F4E6 /* UIKit.framework in Frameworks */, @@ -1028,6 +1289,8 @@ C38A09821A46185300D45436 /* UnitTests iOS.xctest */, C38A09BA1A4619A900D45436 /* libCorePlot-CocoaTouch.a */, C38A09C41A4619A900D45436 /* CorePlot-CocoaTouchTests.xctest */, + C37EA6921BC83F2A0091C8F7 /* CorePlot.framework */, + C37EA6B71BC83F2D0091C8F7 /* UnitTests tvOS.xctest */, ); name = Products; sourceTree = ""; @@ -1355,9 +1618,10 @@ isa = PBXGroup; children = ( 071F3CB810FBAB5900D0A7B6 /* License.txt */, - 8DC2EF5A0486A6940098B216 /* CorePlot-Info.plist */, - C3226A4F1A69F18C00F77249 /* CorePlot-CocoaTouch-Info.plist */, - C3226A501A69F1A700F77249 /* CorePlot_iOS-Info.plist */, + C3490DF220E028CF0089F309 /* CorePlot-Info.plist */, + C3490DF420E028D30089F309 /* CorePlot-CocoaTouch-Info.plist */, + C3490DF620E028D80089F309 /* CorePlot-iOS-Info.plist */, + C3490DF820E028DC0089F309 /* CorePlot-tvOS-Info.plist */, 089C1666FE841158C02AAC07 /* InfoPlist.strings */, ); name = Resources; @@ -1441,7 +1705,6 @@ 0730F64D109494D100E95162 /* CPTTestCase.m */, 4C9A745D0FB24C7200918464 /* CPTDataSourceTestCase.h */, 4C9A745E0FB24C7200918464 /* CPTDataSourceTestCase.m */, - BC89A64010239D1D009D5261 /* CorePlotProbes.d */, ); name = Testing; path = Source; @@ -1503,9 +1766,10 @@ C3226A4B1A69F02900F77249 /* Resources */ = { isa = PBXGroup; children = ( - C3226A4C1A69F07600F77249 /* CorePlotTests-Info.plist */, - C3226A4D1A69F09A00F77249 /* CorePlot-iOSTests-Info.plist */, - C3226A4E1A69F0AA00F77249 /* CorePlot-CocoaTouchTests-Info.plist */, + C37A406A20E02BE900C4FF48 /* CorePlotTests-Info.plist */, + C37A406820E02BA500C4FF48 /* CorePlot-iOSTests-Info.plist */, + C37A406620E02BA100C4FF48 /* CorePlot-CocoaTouchTests-Info.plist */, + C37A406420E02B9D00C4FF48 /* CorePlot-tvOSTests-Info.plist */, ); name = Resources; sourceTree = ""; @@ -1671,6 +1935,8 @@ A92C0C3DB583ED8FC2EFD9DB /* _CPTAnimationCGRectPeriod.m */, A92C0685ACE3281299F10F73 /* _CPTAnimationNSDecimalPeriod.h */, A92C00B71DCB2085A92BE0A9 /* _CPTAnimationNSDecimalPeriod.m */, + C3BB3C8C1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h */, + C3BB3C8D1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m */, A92C0E16290C226BC4BE3936 /* _CPTAnimationPlotRangePeriod.h */, A92C091B8592D9F32AC384CB /* _CPTAnimationPlotRangePeriod.m */, C3C2847316585085006BA43C /* _CPTAnimationTimingFunctions.h */, @@ -1682,6 +1948,8 @@ C3D979A513D2159400145DFF /* Tests */ = { isa = PBXGroup; children = ( + C377B3B91C122AA600891DF8 /* CPTCalendarFormatterTests.h */, + C377B3BA1C122AA600891DF8 /* CPTCalendarFormatterTests.m */, C3D979A713D2328000145DFF /* CPTTimeFormatterTests.h */, C3D979A813D2328000145DFF /* CPTTimeFormatterTests.m */, ); @@ -1775,6 +2043,7 @@ BC55023210059F22005DF982 /* _CPTPlainBlackTheme.h in Headers */, BC55023410059F22005DF982 /* _CPTPlainWhiteTheme.h in Headers */, BC55023610059F22005DF982 /* _CPTStocksTheme.h in Headers */, + C3BB3C8E1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h in Headers */, 07A2E6FC102DF47900809BC5 /* CPTTimeFormatter.h in Headers */, 4C97EEFE104D80C400B554F9 /* CPTNumericData+TypeConversion.h in Headers */, 4C97EF01104D80C400B554F9 /* CPTNumericData.h in Headers */, @@ -1826,6 +2095,109 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C37EA62E1BC83F2A0091C8F7 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + C37EA62F1BC83F2A0091C8F7 /* CPTLimitBand.h in Headers */, + C37EA6301BC83F2A0091C8F7 /* CPTDefinitions.h in Headers */, + C37EA6311BC83F2A0091C8F7 /* CPTPlotSymbol.h in Headers */, + C37EA6321BC83F2A0091C8F7 /* CPTTradingRangePlot.h in Headers */, + C37EA6331BC83F2A0091C8F7 /* CPTGraph.h in Headers */, + C37EA6341BC83F2A0091C8F7 /* CPTGridLines.h in Headers */, + C3BB3C901C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h in Headers */, + C37EA6351BC83F2A0091C8F7 /* CPTTextStyle.h in Headers */, + C37EA6361BC83F2A0091C8F7 /* CPTMutablePlotRange.h in Headers */, + C37EA6371BC83F2A0091C8F7 /* CPTPieChart.h in Headers */, + C37EA6381BC83F2A0091C8F7 /* CPTMutableNumericData+TypeConversion.h in Headers */, + C37EA6391BC83F2A0091C8F7 /* CPTAxisLabelGroup.h in Headers */, + C37EA63A1BC83F2A0091C8F7 /* CPTPlotSpace.h in Headers */, + C37EA63B1BC83F2A0091C8F7 /* CPTGraphHostingView.h in Headers */, + C37EA63C1BC83F2A0091C8F7 /* CPTColorSpace.h in Headers */, + C37EA63D1BC83F2A0091C8F7 /* CPTXYPlotSpace.h in Headers */, + C37EA63E1BC83F2A0091C8F7 /* CPTLineStyle.h in Headers */, + C37EA63F1BC83F2A0091C8F7 /* CPTPathExtensions.h in Headers */, + C37EA6401BC83F2A0091C8F7 /* _CPTBorderLayer.h in Headers */, + C37EA6411BC83F2A0091C8F7 /* CPTNumericData.h in Headers */, + C37EA6421BC83F2A0091C8F7 /* CPTLineCap.h in Headers */, + C37EA6431BC83F2A0091C8F7 /* _CPTFillGradient.h in Headers */, + C37EA6441BC83F2A0091C8F7 /* CPTNumericDataType.h in Headers */, + C37EA6451BC83F2A0091C8F7 /* CPTAnimationPeriod.h in Headers */, + C37EA6461BC83F2A0091C8F7 /* _CPTPlainWhiteTheme.h in Headers */, + C37EA6471BC83F2A0091C8F7 /* CPTBorderedLayer.h in Headers */, + C37EA6481BC83F2A0091C8F7 /* CPTAxisSet.h in Headers */, + C37EA6491BC83F2A0091C8F7 /* CPTScatterPlot.h in Headers */, + C37EA64A1BC83F2A0091C8F7 /* CPTMutableShadow.h in Headers */, + C37EA64B1BC83F2A0091C8F7 /* _CPTPlainBlackTheme.h in Headers */, + C37EA64C1BC83F2A0091C8F7 /* _CPTAnimationNSDecimalPeriod.h in Headers */, + C37EA64D1BC83F2A0091C8F7 /* CPTCalendarFormatter.h in Headers */, + C37EA64E1BC83F2A0091C8F7 /* CPTTextLayer.h in Headers */, + C37EA64F1BC83F2A0091C8F7 /* CPTResponder.h in Headers */, + C37EA6501BC83F2A0091C8F7 /* CPTLayer.h in Headers */, + C37EA6511BC83F2A0091C8F7 /* CPTPlotAreaFrame.h in Headers */, + C37EA6521BC83F2A0091C8F7 /* CPTXYAxis.h in Headers */, + C37EA6531BC83F2A0091C8F7 /* _CPTStocksTheme.h in Headers */, + C37EA6541BC83F2A0091C8F7 /* CPTImage.h in Headers */, + C37EA6551BC83F2A0091C8F7 /* CPTTheme.h in Headers */, + C37EA6561BC83F2A0091C8F7 /* CPTPlatformSpecificCategories.h in Headers */, + C37EA6571BC83F2A0091C8F7 /* NSNumberExtensions.h in Headers */, + C37EA6581BC83F2A0091C8F7 /* _CPTConstraintsRelative.h in Headers */, + C37EA6591BC83F2A0091C8F7 /* CPTAnimationOperation.h in Headers */, + C37EA65A1BC83F2A0091C8F7 /* _CPTDarkGradientTheme.h in Headers */, + C37EA65B1BC83F2A0091C8F7 /* CPTRangePlot.h in Headers */, + C37EA65C1BC83F2A0091C8F7 /* _CPTAnimationCGSizePeriod.h in Headers */, + C37EA65D1BC83F2A0091C8F7 /* CPTPlotGroup.h in Headers */, + C37EA65E1BC83F2A0091C8F7 /* CPTLegend.h in Headers */, + C37EA65F1BC83F2A0091C8F7 /* _CPTFillImage.h in Headers */, + C37EA6601BC83F2A0091C8F7 /* _CPTAnimationCGRectPeriod.h in Headers */, + C37EA6611BC83F2A0091C8F7 /* CPTPlotSpaceAnnotation.h in Headers */, + C37EA6621BC83F2A0091C8F7 /* CPTConstraints.h in Headers */, + C37EA6631BC83F2A0091C8F7 /* NSCoderExtensions.h in Headers */, + C37EA6641BC83F2A0091C8F7 /* CPTNumericData+TypeConversion.h in Headers */, + C37EA6651BC83F2A0091C8F7 /* _CPTFillColor.h in Headers */, + C37EA6661BC83F2A0091C8F7 /* _CPTXYTheme.h in Headers */, + C37EA6671BC83F2A0091C8F7 /* CPTLayerAnnotation.h in Headers */, + C37EA6681BC83F2A0091C8F7 /* _CPTAnimationCGFloatPeriod.h in Headers */, + C37EA6691BC83F2A0091C8F7 /* CPTAxisTitle.h in Headers */, + C37EA66A1BC83F2A0091C8F7 /* _CPTSlateTheme.h in Headers */, + C37EA66B1BC83F2A0091C8F7 /* CPTMutableNumericData.h in Headers */, + C37EA66C1BC83F2A0091C8F7 /* CPTGridLineGroup.h in Headers */, + C37EA66D1BC83F2A0091C8F7 /* CorePlot.h in Headers */, + C37EA66E1BC83F2A0091C8F7 /* CPTMutableLineStyle.h in Headers */, + C37EA66F1BC83F2A0091C8F7 /* CPTAnimation.h in Headers */, + C37EA6701BC83F2A0091C8F7 /* CPTExceptions.h in Headers */, + C37EA6711BC83F2A0091C8F7 /* CPTPlot.h in Headers */, + C37EA6721BC83F2A0091C8F7 /* CPTShadow.h in Headers */, + C37EA6731BC83F2A0091C8F7 /* CPTAnnotation.h in Headers */, + C37EA6741BC83F2A0091C8F7 /* CPTColor.h in Headers */, + C37EA6751BC83F2A0091C8F7 /* CPTTextStylePlatformSpecific.h in Headers */, + C37EA6761BC83F2A0091C8F7 /* CPTFill.h in Headers */, + C37EA6771BC83F2A0091C8F7 /* CPTPlotRange.h in Headers */, + C37EA6781BC83F2A0091C8F7 /* CPTXYAxisSet.h in Headers */, + C37EA6791BC83F2A0091C8F7 /* CPTTimeFormatter.h in Headers */, + C37EA67A1BC83F2A0091C8F7 /* CPTLegendEntry.h in Headers */, + C37EA67B1BC83F2A0091C8F7 /* CPTPlotArea.h in Headers */, + C37EA67C1BC83F2A0091C8F7 /* _CPTMaskLayer.h in Headers */, + C37EA67D1BC83F2A0091C8F7 /* _CPTAnimationPlotRangePeriod.h in Headers */, + C37EA67E1BC83F2A0091C8F7 /* CPTFunctionDataSource.h in Headers */, + C37EA67F1BC83F2A0091C8F7 /* CPTGradient.h in Headers */, + C37EA6801BC83F2A0091C8F7 /* _CPTAnimationCGPointPeriod.h in Headers */, + C37EA6811BC83F2A0091C8F7 /* NSDecimalNumberExtensions.h in Headers */, + C37EA6821BC83F2A0091C8F7 /* CPTAxis.h in Headers */, + C37EA6831BC83F2A0091C8F7 /* CPTPlatformSpecificFunctions.h in Headers */, + C37EA6841BC83F2A0091C8F7 /* CPTAnnotationHostLayer.h in Headers */, + C37EA6851BC83F2A0091C8F7 /* CPTAxisLabel.h in Headers */, + C37EA6861BC83F2A0091C8F7 /* CPTDebugQuickLook.h in Headers */, + C37EA6871BC83F2A0091C8F7 /* _CPTAnimationTimingFunctions.h in Headers */, + C37EA6881BC83F2A0091C8F7 /* CPTMutableTextStyle.h in Headers */, + C37EA6891BC83F2A0091C8F7 /* CPTXYGraph.h in Headers */, + C37EA68A1BC83F2A0091C8F7 /* CPTPlatformSpecificDefines.h in Headers */, + C37EA68B1BC83F2A0091C8F7 /* CPTBarPlot.h in Headers */, + C37EA68C1BC83F2A0091C8F7 /* CPTUtilities.h in Headers */, + C37EA68D1BC83F2A0091C8F7 /* _CPTConstraintsFixed.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; C38A09751A46185200D45436 /* Headers */ = { isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; @@ -1836,6 +2208,7 @@ C38A0AC61A46255C00D45436 /* CPTTradingRangePlot.h in Headers */, C38A0AA71A46240300D45436 /* CPTGraph.h in Headers */, C38A0ADA1A4625B100D45436 /* CPTGridLines.h in Headers */, + C3BB3C8F1C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.h in Headers */, C38A0A4A1A461F1500D45436 /* CPTTextStyle.h in Headers */, C38A09FB1A461D0F00D45436 /* CPTMutablePlotRange.h in Headers */, C38A0AC31A46255C00D45436 /* CPTPieChart.h in Headers */, @@ -1968,6 +2341,42 @@ productReference = 8DC2EF5B0486A6940098B216 /* CorePlot.framework */; productType = "com.apple.product-type.framework"; }; + C37EA5C91BC83F2A0091C8F7 /* CorePlot tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = C37EA68F1BC83F2A0091C8F7 /* Build configuration list for PBXNativeTarget "CorePlot tvOS" */; + buildPhases = ( + C37EA5CA1BC83F2A0091C8F7 /* Sources */, + C37EA6291BC83F2A0091C8F7 /* Frameworks */, + C37EA62E1BC83F2A0091C8F7 /* Headers */, + C37EA68E1BC83F2A0091C8F7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "CorePlot tvOS"; + productName = "CorePlot-iOS"; + productReference = C37EA6921BC83F2A0091C8F7 /* CorePlot.framework */; + productType = "com.apple.product-type.framework"; + }; + C37EA6941BC83F2D0091C8F7 /* UnitTests tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = C37EA6B41BC83F2D0091C8F7 /* Build configuration list for PBXNativeTarget "UnitTests tvOS" */; + buildPhases = ( + C37EA6971BC83F2D0091C8F7 /* Sources */, + C37EA6B01BC83F2D0091C8F7 /* Frameworks */, + C37EA6B31BC83F2D0091C8F7 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + C3B4D4961BC997F600450C37 /* PBXTargetDependency */, + ); + name = "UnitTests tvOS"; + productName = "CorePlot-iOSTests"; + productReference = C37EA6B71BC83F2D0091C8F7 /* UnitTests tvOS.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; C38A09771A46185200D45436 /* CorePlot iOS */ = { isa = PBXNativeTarget; buildConfigurationList = C38A098F1A46185300D45436 /* Build configuration list for PBXNativeTarget "CorePlot iOS" */; @@ -2046,7 +2455,7 @@ isa = PBXProject; attributes = { BuildIndependentTargetsInParallel = YES; - LastUpgradeCheck = 0610; + LastUpgradeCheck = 1100; TargetAttributes = { 8DC2EF4F0486A6940098B216 = { DevelopmentTeam = 28ZA45DE7D; @@ -2067,13 +2476,14 @@ }; buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "CorePlot" */; compatibilityVersion = "Xcode 6.3"; - developmentRegion = English; + developmentRegion = en; hasScannedForEncodings = 1; knownRegions = ( - English, - Japanese, - French, - German, + Base, + en, + de, + ja, + fr, ); mainGroup = 0867D691FE84028FC02AAC07 /* CorePlot */; productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; @@ -2086,10 +2496,13 @@ C38A09811A46185300D45436 /* UnitTests iOS */, C38A09B91A4619A900D45436 /* CorePlot-CocoaTouch */, C38A09C31A4619A900D45436 /* CorePlot-CocoaTouchTests */, + C37EA5C91BC83F2A0091C8F7 /* CorePlot tvOS */, + C37EA6941BC83F2D0091C8F7 /* UnitTests tvOS */, 9021E49E0FC5C9DC00443472 /* Documentation-Mac */, C38A09911A4618B600D45436 /* Documentation-iOS */, C38A09961A46193F00D45436 /* Universal Library */, C3A5467F1BC1A817005C1BBC /* Universal iOS Framework */, + C37EA5C41BC83E900091C8F7 /* Universal tvOS Framework */, ); }; /* End PBXProject section */ @@ -2111,6 +2524,20 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C37EA68E1BC83F2A0091C8F7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C37EA6B31BC83F2D0091C8F7 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; C38A09761A46185200D45436 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; @@ -2146,7 +2573,20 @@ ); 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 -Rf \"${SOURCE_ROOT}/CorePlotDocs.docset\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\nexit 0"; + }; + C37EA5C51BC83E900091C8F7 /* ShellScript */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\nUFW_TARGET=\"CorePlot tvOS\"\nUFW_BUILD_DIR=\"${PROJECT_DIR}/../build\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest tvOS SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"appletvos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nFRAMEWORK_NAME=\"${PROJECT_NAME}\"\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_PATH=\"${UFW_BUILD_DIR}/Release-appletvos/${FRAMEWORK_NAME}.framework\"\nUFW_SIMULATOR_PATH=\"${UFW_BUILD_DIR}/Release-appletvsimulator/${FRAMEWORK_NAME}.framework\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-appletvuniversal\"\nUFW_FRAMEWORK=\"${UFW_UNIVERSAL_DIR}/${FRAMEWORK_NAME}.framework\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk appletvos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk appletvsimulator${UFW_SDK_VERSION} build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp -r \"${UFW_IPHONE_PATH}/.\" \"${UFW_FRAMEWORK}\"\n\nlipo -create -output \"${UFW_FRAMEWORK}/${FRAMEWORK_NAME}\" \"${UFW_SIMULATOR_PATH}/${FRAMEWORK_NAME}\" \"${UFW_IPHONE_PATH}/${FRAMEWORK_NAME}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n"; }; C38A09921A4618B600D45436 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2159,7 +2599,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 -Rf \"${SOURCE_ROOT}/CorePlotTouchDocs.docset\"\nrm -f \"${DOCS_FOLDER}/Info.plist\"\nrm -f \"${DOCS_FOLDER}/Makefile\"\nrm -f \"${DOCS_FOLDER}/Nodes.xml\"\nrm -f \"${DOCS_FOLDER}/Tokens.xml\"\n\nexit 0"; }; C38A09971A46193F00D45436 /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2172,7 +2612,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\nUFW_TARGET=\"CorePlot-CocoaTouch\"\nUFW_BUILD_DIR=\"${BUILD_DIR}\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_DIR=\"${UFW_BUILD_DIR}/Release-iphoneos\"\nUFW_SIMULATOR_DIR=\"${UFW_BUILD_DIR}/Release-iphonesimulator\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-universal\"\nUFW_HEADER_DIR=\"${UFW_UNIVERSAL_DIR}/CorePlotHeaders\"\nUFW_EXE_PATH=\"libCorePlot-CocoaTouch.a\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\nlipo -create -output \"${UFW_UNIVERSAL_DIR}/${UFW_EXE_PATH}\" \"${UFW_IPHONE_DIR}/${UFW_EXE_PATH}\" \"${UFW_SIMULATOR_DIR}/${UFW_EXE_PATH}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n\n# copy header files\nmkdir -p \"${UFW_HEADER_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp \"${SOURCE_ROOT}/CorePlot-CocoaTouch.h\" \"${UFW_HEADER_DIR}\"\ncp \"${SOURCE_ROOT}/iPhoneOnly/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\ncp \"${SOURCE_ROOT}/Source/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\n\nrm \"${UFW_HEADER_DIR}/\"*Tests.*"; + shellScript = "\nUFW_TARGET=\"CorePlot-CocoaTouch\"\nUFW_BUILD_DIR=\"${PROJECT_DIR}/../build\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_DIR=\"${UFW_BUILD_DIR}/Release-iphoneos\"\nUFW_SIMULATOR_DIR=\"${UFW_BUILD_DIR}/Release-iphonesimulator\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-universal\"\nUFW_HEADER_DIR=\"${UFW_UNIVERSAL_DIR}/CorePlotHeaders\"\nUFW_EXE_PATH=\"libCorePlot-CocoaTouch.a\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\nlipo -create -output \"${UFW_UNIVERSAL_DIR}/${UFW_EXE_PATH}\" \"${UFW_IPHONE_DIR}/${UFW_EXE_PATH}\" \"${UFW_SIMULATOR_DIR}/${UFW_EXE_PATH}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n\n# copy header files\nmkdir -p \"${UFW_HEADER_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp \"${SOURCE_ROOT}/CorePlot-CocoaTouch.h\" \"${UFW_HEADER_DIR}\"\ncp \"${SOURCE_ROOT}/iPhoneOnly/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\ncp \"${SOURCE_ROOT}/Source/\"[!_]*.h \"${UFW_HEADER_DIR}/\"\n\nrm \"${UFW_HEADER_DIR}/\"*Tests.*\n"; }; C3A546801BC1A817005C1BBC /* ShellScript */ = { isa = PBXShellScriptBuildPhase; @@ -2185,7 +2625,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "\nUFW_TARGET=\"CorePlot iOS\"\nUFW_BUILD_DIR=\"${BUILD_DIR}\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nFRAMEWORK_NAME=\"${PROJECT_NAME}\"\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_PATH=\"${UFW_BUILD_DIR}/Release-iphoneos/${FRAMEWORK_NAME}.framework\"\nUFW_SIMULATOR_PATH=\"${UFW_BUILD_DIR}/Release-iphonesimulator/${FRAMEWORK_NAME}.framework\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-iphoneuniversal\"\nUFW_FRAMEWORK=\"${UFW_UNIVERSAL_DIR}/${FRAMEWORK_NAME}.framework\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp -r \"${UFW_IPHONE_PATH}/.\" \"${UFW_FRAMEWORK}\"\n\nlipo -create -output \"${UFW_FRAMEWORK}/${FRAMEWORK_NAME}\" \"${UFW_SIMULATOR_PATH}/${FRAMEWORK_NAME}\" \"${UFW_IPHONE_PATH}/${FRAMEWORK_NAME}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n"; + shellScript = "\nUFW_TARGET=\"CorePlot iOS\"\nUFW_BUILD_DIR=\"${PROJECT_DIR}/../build\"\n\nif [ -z ${SDK_NAME} ]; then\n# Use the latest iphoneos SDK available\nUFW_GREP_RESULT=$(xcodebuild -showsdks | grep -o \"iphoneos.*$\")\nwhile read -r line; do\nUFW_SDK_VERSION=\"${line}\"\ndone <<< \"${UFW_GREP_RESULT}\"\nelse\n# Use the SDK specified by XCode\nUFW_SDK_VERSION=\"${SDK_NAME}\"\nfi\n\nFRAMEWORK_NAME=\"${PROJECT_NAME}\"\nUFW_SDK_VERSION=$(echo \"${UFW_SDK_VERSION}\" | grep -o \"[0-9].*$\")\nUFW_IPHONE_PATH=\"${UFW_BUILD_DIR}/Release-iphoneos/${FRAMEWORK_NAME}.framework\"\nUFW_SIMULATOR_PATH=\"${UFW_BUILD_DIR}/Release-iphonesimulator/${FRAMEWORK_NAME}.framework\"\nUFW_UNIVERSAL_DIR=\"${UFW_BUILD_DIR}/Release-iphoneuniversal\"\nUFW_FRAMEWORK=\"${UFW_UNIVERSAL_DIR}/${FRAMEWORK_NAME}.framework\"\n\n# Build Framework\n\nrm -rf \"${UFW_UNIVERSAL_DIR}\"\n\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphoneos${UFW_SDK_VERSION} clean build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\nxcodebuild -target \"${UFW_TARGET}\" -project CorePlot.xcodeproj -configuration Release -sdk iphonesimulator${UFW_SDK_VERSION} build\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: xcodebuild failed\"; exit 1; fi\n\nmkdir -p \"${UFW_UNIVERSAL_DIR}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: mkdir failed\"; exit 1; fi\n\ncp -r \"${UFW_IPHONE_PATH}/.\" \"${UFW_FRAMEWORK}\"\n\nlipo -create -output \"${UFW_FRAMEWORK}/${FRAMEWORK_NAME}\" \"${UFW_SIMULATOR_PATH}/${FRAMEWORK_NAME}\" \"${UFW_IPHONE_PATH}/${FRAMEWORK_NAME}\"\nif [ \"$?\" != \"0\" ]; then echo >&2 \"Error: lipo failed\"; exit 1; fi\n"; }; /* End PBXShellScriptBuildPhase section */ @@ -2215,6 +2655,7 @@ C3D979AF13D2337E00145DFF /* CPTColorSpaceTests.m in Sources */, C3D979B213D233C100145DFF /* CPTGradientTests.m in Sources */, C3D979B513D2340000145DFF /* CPTImageTests.m in Sources */, + C377B3BB1C122AA600891DF8 /* CPTCalendarFormatterTests.m in Sources */, C3D979B813D2344100145DFF /* CPTLineStyleTests.m in Sources */, C3D979BB13D2347400145DFF /* CPTFillTests.m in Sources */, C3C1C0801790D3B400E8B1B7 /* CPTLayerTests.m in Sources */, @@ -2269,7 +2710,6 @@ BC55023310059F22005DF982 /* _CPTPlainBlackTheme.m in Sources */, BC55023510059F22005DF982 /* _CPTPlainWhiteTheme.m in Sources */, BC55023710059F22005DF982 /* _CPTStocksTheme.m in Sources */, - BC89A64110239D1D009D5261 /* CorePlotProbes.d in Sources */, 07A2E6FD102DF47900809BC5 /* CPTTimeFormatter.m in Sources */, 4C97EF02104D80C400B554F9 /* CPTNumericData.m in Sources */, 4C97EF04104D80C400B554F9 /* CPTNumericDataType.m in Sources */, @@ -2300,6 +2740,7 @@ C3920AC51395B6500045F3BB /* CPTLegend.m in Sources */, C30550EE1399BE5400E0151F /* CPTLegendEntry.m in Sources */, C3978E0713CE653C00A420D9 /* NSCoderExtensions.m in Sources */, + C3BB3C911C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m in Sources */, C3D3AD2E13DF8DCE0004EA73 /* CPTLineCap.m in Sources */, C3CCA03E13E8D85900CE6DB1 /* _CPTConstraintsFixed.m in Sources */, C3CCA04013E8D85900CE6DB1 /* _CPTConstraintsRelative.m in Sources */, @@ -2323,6 +2764,139 @@ ); runOnlyForDeploymentPostprocessing = 0; }; + C37EA5CA1BC83F2A0091C8F7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C37EA5CB1BC83F2A0091C8F7 /* CPTGraphHostingView.m in Sources */, + C37EA5CC1BC83F2A0091C8F7 /* CPTLayerAnnotation.m in Sources */, + C37EA5CD1BC83F2A0091C8F7 /* CPTLayer.m in Sources */, + C37EA5CE1BC83F2A0091C8F7 /* CPTTimeFormatter.m in Sources */, + C37EA5CF1BC83F2A0091C8F7 /* CPTColor.m in Sources */, + C37EA5D01BC83F2A0091C8F7 /* NSCoderExtensions.m in Sources */, + C37EA5D11BC83F2A0091C8F7 /* CPTMutableNumericData.m in Sources */, + C37EA5D21BC83F2A0091C8F7 /* CPTNumericData+TypeConversion.m in Sources */, + C37EA5D31BC83F2A0091C8F7 /* CPTTheme.m in Sources */, + C37EA5D41BC83F2A0091C8F7 /* CPTDefinitions.m in Sources */, + C37EA5D51BC83F2A0091C8F7 /* _CPTFillImage.m in Sources */, + C37EA5D61BC83F2A0091C8F7 /* CPTPlotSpaceAnnotation.m in Sources */, + C37EA5D71BC83F2A0091C8F7 /* CPTXYAxis.m in Sources */, + C37EA5D81BC83F2A0091C8F7 /* CPTBarPlot.m in Sources */, + C37EA5D91BC83F2A0091C8F7 /* CPTAxisTitle.m in Sources */, + C37EA5DA1BC83F2A0091C8F7 /* CPTPlatformSpecificDefines.m in Sources */, + C37EA5DB1BC83F2A0091C8F7 /* _CPTStocksTheme.m in Sources */, + C37EA5DC1BC83F2A0091C8F7 /* CPTImagePlatformSpecific.m in Sources */, + C37EA5DD1BC83F2A0091C8F7 /* _CPTAnimationCGFloatPeriod.m in Sources */, + C37EA5DE1BC83F2A0091C8F7 /* CPTExceptions.m in Sources */, + C37EA5DF1BC83F2A0091C8F7 /* _CPTDarkGradientTheme.m in Sources */, + C37EA5E01BC83F2A0091C8F7 /* _CPTPlainBlackTheme.m in Sources */, + C37EA5E11BC83F2A0091C8F7 /* CPTNumericData.m in Sources */, + C37EA5E31BC83F2A0091C8F7 /* CPTXYAxisSet.m in Sources */, + C37EA5E41BC83F2A0091C8F7 /* CPTLimitBand.m in Sources */, + C37EA5E51BC83F2A0091C8F7 /* CPTGridLines.m in Sources */, + C3BB3C941C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m in Sources */, + C37EA5E61BC83F2A0091C8F7 /* CPTPathExtensions.m in Sources */, + C37EA5E71BC83F2A0091C8F7 /* CPTXYPlotSpace.m in Sources */, + C37EA5E81BC83F2A0091C8F7 /* CPTPlotRange.m in Sources */, + C37EA5E91BC83F2A0091C8F7 /* CPTImage.m in Sources */, + C37EA5EA1BC83F2A0091C8F7 /* CPTPlotSymbol.m in Sources */, + C37EA5EB1BC83F2A0091C8F7 /* CPTAxisSet.m in Sources */, + C37EA5EC1BC83F2A0091C8F7 /* CPTPlotGroup.m in Sources */, + C37EA5ED1BC83F2A0091C8F7 /* CPTAnimation.m in Sources */, + C37EA5EE1BC83F2A0091C8F7 /* _CPTAnimationNSDecimalPeriod.m in Sources */, + C37EA5EF1BC83F2A0091C8F7 /* _CPTAnimationPlotRangePeriod.m in Sources */, + C37EA5F01BC83F2A0091C8F7 /* CPTPlotAreaFrame.m in Sources */, + C37EA5F11BC83F2A0091C8F7 /* CPTAxisLabel.m in Sources */, + C37EA5F21BC83F2A0091C8F7 /* CPTShadow.m in Sources */, + C37EA5F31BC83F2A0091C8F7 /* _CPTAnimationCGPointPeriod.m in Sources */, + C37EA5F41BC83F2A0091C8F7 /* CPTPlatformSpecificFunctions.m in Sources */, + C37EA5F51BC83F2A0091C8F7 /* CPTMutableShadow.m in Sources */, + C37EA5F61BC83F2A0091C8F7 /* _CPTAnimationCGRectPeriod.m in Sources */, + C37EA5F71BC83F2A0091C8F7 /* CPTPlotSpace.m in Sources */, + C37EA5F81BC83F2A0091C8F7 /* CPTLineCap.m in Sources */, + C37EA5F91BC83F2A0091C8F7 /* CPTScatterPlot.m in Sources */, + C37EA5FA1BC83F2A0091C8F7 /* _CPTSlateTheme.m in Sources */, + C37EA5FB1BC83F2A0091C8F7 /* CPTAnimationPeriod.m in Sources */, + C37EA5FC1BC83F2A0091C8F7 /* CPTTextStylePlatformSpecific.m in Sources */, + C37EA5FD1BC83F2A0091C8F7 /* _CPTBorderLayer.m in Sources */, + C37EA5FE1BC83F2A0091C8F7 /* CPTLegendEntry.m in Sources */, + C37EA5FF1BC83F2A0091C8F7 /* CPTTradingRangePlot.m in Sources */, + C37EA6001BC83F2A0091C8F7 /* CPTTextLayer.m in Sources */, + C37EA6011BC83F2A0091C8F7 /* _CPTConstraintsRelative.m in Sources */, + C37EA6021BC83F2A0091C8F7 /* CPTAnnotationHostLayer.m in Sources */, + C37EA6031BC83F2A0091C8F7 /* CPTAnimationOperation.m in Sources */, + C37EA6041BC83F2A0091C8F7 /* _CPTFillGradient.m in Sources */, + C37EA6051BC83F2A0091C8F7 /* _CPTMaskLayer.m in Sources */, + C37EA6061BC83F2A0091C8F7 /* CPTCalendarFormatter.m in Sources */, + C37EA6071BC83F2A0091C8F7 /* CPTAnnotation.m in Sources */, + C37EA6081BC83F2A0091C8F7 /* _CPTFillColor.m in Sources */, + C37EA6091BC83F2A0091C8F7 /* _CPTAnimationTimingFunctions.m in Sources */, + C37EA60A1BC83F2A0091C8F7 /* CPTMutableLineStyle.m in Sources */, + C37EA60B1BC83F2A0091C8F7 /* NSDecimalNumberExtensions.m in Sources */, + C37EA60C1BC83F2A0091C8F7 /* CPTLegend.m in Sources */, + C37EA60D1BC83F2A0091C8F7 /* CPTAxisLabelGroup.m in Sources */, + C37EA60E1BC83F2A0091C8F7 /* CPTFill.m in Sources */, + C37EA60F1BC83F2A0091C8F7 /* CPTMutableNumericData+TypeConversion.m in Sources */, + C37EA6101BC83F2A0091C8F7 /* CPTRangePlot.m in Sources */, + C37EA6111BC83F2A0091C8F7 /* CPTGraph.m in Sources */, + C37EA6121BC83F2A0091C8F7 /* CPTMutablePlotRange.m in Sources */, + C37EA6131BC83F2A0091C8F7 /* _CPTPlainWhiteTheme.m in Sources */, + C37EA6141BC83F2A0091C8F7 /* CPTGridLineGroup.m in Sources */, + C37EA6151BC83F2A0091C8F7 /* CPTNumericDataType.m in Sources */, + C37EA6161BC83F2A0091C8F7 /* CPTPlot.m in Sources */, + C37EA6171BC83F2A0091C8F7 /* CPTPlatformSpecificCategories.m in Sources */, + C37EA6181BC83F2A0091C8F7 /* CPTConstraints.m in Sources */, + C37EA6191BC83F2A0091C8F7 /* CPTTextStyle.m in Sources */, + C37EA61A1BC83F2A0091C8F7 /* CPTFunctionDataSource.m in Sources */, + C37EA61B1BC83F2A0091C8F7 /* NSNumberExtensions.m in Sources */, + C37EA61C1BC83F2A0091C8F7 /* CPTBorderedLayer.m in Sources */, + C37EA61D1BC83F2A0091C8F7 /* CPTLineStyle.m in Sources */, + C37EA61E1BC83F2A0091C8F7 /* _CPTAnimationCGSizePeriod.m in Sources */, + C37EA61F1BC83F2A0091C8F7 /* CPTPieChart.m in Sources */, + C37EA6201BC83F2A0091C8F7 /* CPTColorSpace.m in Sources */, + C37EA6211BC83F2A0091C8F7 /* CPTGradient.m in Sources */, + C37EA6221BC83F2A0091C8F7 /* CPTUtilities.m in Sources */, + C37EA6231BC83F2A0091C8F7 /* _CPTXYTheme.m in Sources */, + C37EA6241BC83F2A0091C8F7 /* CPTXYGraph.m in Sources */, + C37EA6251BC83F2A0091C8F7 /* CPTPlotArea.m in Sources */, + C37EA6261BC83F2A0091C8F7 /* _CPTConstraintsFixed.m in Sources */, + C37EA6271BC83F2A0091C8F7 /* CPTAxis.m in Sources */, + C37EA6281BC83F2A0091C8F7 /* CPTMutableTextStyle.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C37EA6971BC83F2D0091C8F7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C37EA6981BC83F2D0091C8F7 /* CPTMutableNumericDataTests.m in Sources */, + C37EA6991BC83F2D0091C8F7 /* CPTColorSpaceTests.m in Sources */, + C37EA69A1BC83F2D0091C8F7 /* CPTFillTests.m in Sources */, + C37EA69B1BC83F2D0091C8F7 /* CPTUtilitiesTests.m in Sources */, + C37EA69C1BC83F2D0091C8F7 /* CPTGradientTests.m in Sources */, + C37EA69D1BC83F2D0091C8F7 /* CPTDarkGradientThemeTests.m in Sources */, + C37EA69E1BC83F2D0091C8F7 /* CPTAxisLabelTests.m in Sources */, + C37EA69F1BC83F2D0091C8F7 /* CPTThemeTests.m in Sources */, + C37EA6A01BC83F2D0091C8F7 /* CPTColorTests.m in Sources */, + C37EA6A11BC83F2D0091C8F7 /* CPTPlotSpaceTests.m in Sources */, + C37EA6A21BC83F2D0091C8F7 /* CPTImageTests.m in Sources */, + C37EA6A31BC83F2D0091C8F7 /* CPTDataSourceTestCase.m in Sources */, + C37EA6A41BC83F2D0091C8F7 /* CPTNumericDataTests.m in Sources */, + C37EA6A51BC83F2D0091C8F7 /* CPTDerivedXYGraph.m in Sources */, + C37EA6A61BC83F2D0091C8F7 /* CPTXYPlotSpaceTests.m in Sources */, + C37EA6A71BC83F2D0091C8F7 /* CPTTestCase.m in Sources */, + C37EA6A81BC83F2D0091C8F7 /* CPTPlotRangeTests.m in Sources */, + C37EA6A91BC83F2D0091C8F7 /* CPTNumericDataTypeConversionTests.m in Sources */, + C37EA6AA1BC83F2D0091C8F7 /* CPTMutableNumericDataTypeConversionTests.m in Sources */, + C37EA6AB1BC83F2D0091C8F7 /* CPTLineStyleTests.m in Sources */, + C37EA6AC1BC83F2D0091C8F7 /* CPTTextStyleTests.m in Sources */, + C377B3BE1C122AA600891DF8 /* CPTCalendarFormatterTests.m in Sources */, + C37EA6AD1BC83F2D0091C8F7 /* CPTTimeFormatterTests.m in Sources */, + C37EA6AE1BC83F2D0091C8F7 /* CPTLayerTests.m in Sources */, + C37EA6AF1BC83F2D0091C8F7 /* CPTScatterPlotTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; C38A09731A46185200D45436 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; @@ -2350,10 +2924,10 @@ C38A0B061A46261700D45436 /* _CPTDarkGradientTheme.m in Sources */, C38A0B071A46261700D45436 /* _CPTPlainBlackTheme.m in Sources */, C38A09DB1A461C7D00D45436 /* CPTNumericData.m in Sources */, - C38A09D51A461C1E00D45436 /* CorePlotProbes.d in Sources */, C38A0AE71A4625D400D45436 /* CPTXYAxisSet.m in Sources */, C38A0AB21A46241700D45436 /* CPTLimitBand.m in Sources */, C38A0AE11A4625D400D45436 /* CPTGridLines.m in Sources */, + C3BB3C921C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m in Sources */, C38A0A6D1A4620E200D45436 /* CPTPathExtensions.m in Sources */, C38A0AB91A46250500D45436 /* CPTXYPlotSpace.m in Sources */, C38A09F91A461D0B00D45436 /* CPTPlotRange.m in Sources */, @@ -2449,6 +3023,7 @@ C38A09E61A461CB200D45436 /* CPTMutableNumericDataTypeConversionTests.m in Sources */, C38A0A8B1A46210A00D45436 /* CPTLineStyleTests.m in Sources */, C38A0A501A461F3D00D45436 /* CPTTextStyleTests.m in Sources */, + C377B3BC1C122AA600891DF8 /* CPTCalendarFormatterTests.m in Sources */, C38A0A9B1A46219600D45436 /* CPTTimeFormatterTests.m in Sources */, C38A0A121A461D6A00D45436 /* CPTLayerTests.m in Sources */, C38A0AD81A46257600D45436 /* CPTScatterPlotTests.m in Sources */, @@ -2486,6 +3061,7 @@ C38A0ABA1A46250600D45436 /* CPTPlotSpace.m in Sources */, C38A0A281A461E9B00D45436 /* _CPTAnimationCGRectPeriod.m in Sources */, C38A0AEC1A4625D500D45436 /* CPTAxisLabel.m in Sources */, + C3BB3C931C1661BE00B8742D /* _CPTAnimationNSNumberPeriod.m in Sources */, C38A0A991A46219200D45436 /* CPTCalendarFormatter.m in Sources */, C38A0A3A1A461ED700D45436 /* CPTLayerAnnotation.m in Sources */, C38A0B231A46264500D45436 /* CPTPlatformSpecificDefines.m in Sources */, @@ -2514,7 +3090,6 @@ C38A09FD1A461D1400D45436 /* CPTMutablePlotRange.m in Sources */, C38A09F71A461D0100D45436 /* CPTUtilities.m in Sources */, C38A0A721A4620E200D45436 /* CPTGradient.m in Sources */, - C38A09D61A461C2B00D45436 /* CorePlotProbes.d in Sources */, C38A0A9A1A46219200D45436 /* CPTTimeFormatter.m in Sources */, C38A0A161A461E5800D45436 /* CPTAnimation.m in Sources */, C38A0AAC1A46240A00D45436 /* CPTXYGraph.m in Sources */, @@ -2581,6 +3156,7 @@ C38A09E51A461CAE00D45436 /* CPTMutableNumericDataTests.m in Sources */, C38A0B161A46262000D45436 /* CPTDarkGradientThemeTests.m in Sources */, C38A0A131A461D6B00D45436 /* CPTLayerTests.m in Sources */, + C377B3BD1C122AA600891DF8 /* CPTCalendarFormatterTests.m in Sources */, C38A0A9C1A46219700D45436 /* CPTTimeFormatterTests.m in Sources */, C38A0A511A461F3D00D45436 /* CPTTextStyleTests.m in Sources */, C38A0A8C1A46210A00D45436 /* CPTColorTests.m in Sources */, @@ -2605,17 +3181,94 @@ target = C38A09B91A4619A900D45436 /* CorePlot-CocoaTouch */; targetProxy = C38A09C61A4619A900D45436 /* PBXContainerItemProxy */; }; + C3B4D4961BC997F600450C37 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C37EA5C91BC83F2A0091C8F7 /* CorePlot tvOS */; + targetProxy = C3B4D4951BC997F600450C37 /* PBXContainerItemProxy */; + }; /* End PBXTargetDependency section */ /* Begin PBXVariantGroup section */ 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { isa = PBXVariantGroup; children = ( - 089C1667FE841158C02AAC07 /* English */, + C3564CBD22A2D0E1000A54C9 /* en */, ); name = InfoPlist.strings; sourceTree = ""; }; + C3490DF220E028CF0089F309 /* CorePlot-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DF120E028CF0089F309 /* Base */, + ); + name = "CorePlot-Info.plist"; + path = Info; + sourceTree = ""; + }; + C3490DF420E028D30089F309 /* CorePlot-CocoaTouch-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DF320E028D30089F309 /* Base */, + ); + name = "CorePlot-CocoaTouch-Info.plist"; + path = Info/Base.lproj; + sourceTree = ""; + }; + C3490DF620E028D80089F309 /* CorePlot-iOS-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DF520E028D80089F309 /* Base */, + ); + name = "CorePlot-iOS-Info.plist"; + path = Info/Base.lproj; + sourceTree = ""; + }; + C3490DF820E028DC0089F309 /* CorePlot-tvOS-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C3490DF720E028DC0089F309 /* Base */, + ); + name = "CorePlot-tvOS-Info.plist"; + path = "/Users/eskroch/Projects/Core Plot/framework/Info/Base.lproj"; + sourceTree = ""; + }; + C37A406420E02B9D00C4FF48 /* CorePlot-tvOSTests-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A406320E02B9D00C4FF48 /* Base */, + ); + name = "CorePlot-tvOSTests-Info.plist"; + path = "/Users/eskroch/Projects/Core Plot/framework/Info"; + sourceTree = ""; + }; + C37A406620E02BA100C4FF48 /* CorePlot-CocoaTouchTests-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A406520E02BA100C4FF48 /* Base */, + ); + name = "CorePlot-CocoaTouchTests-Info.plist"; + path = Info; + sourceTree = SOURCE_ROOT; + }; + C37A406820E02BA500C4FF48 /* CorePlot-iOSTests-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A406720E02BA500C4FF48 /* Base */, + ); + name = "CorePlot-iOSTests-Info.plist"; + path = Info; + sourceTree = SOURCE_ROOT; + }; + C37A406A20E02BE900C4FF48 /* CorePlotTests-Info.plist */ = { + isa = PBXVariantGroup; + children = ( + C37A406920E02BE900C4FF48 /* Base */, + ); + name = "CorePlotTests-Info.plist"; + path = Info; + sourceTree = SOURCE_ROOT; + }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ @@ -2623,13 +3276,11 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - COPY_PHASE_STRIP = NO; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - INFOPLIST_FILE = "CorePlotTests-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlotTests-Info.plist"; INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = UnitTests; SDKROOT = macosx; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/MacOnly"; }; name = Debug; }; @@ -2637,14 +3288,11 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - COPY_PHASE_STRIP = YES; - GCC_ENABLE_OBJC_EXCEPTIONS = YES; - INFOPLIST_FILE = "CorePlotTests-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlotTests-Info.plist"; INSTALL_PATH = "$(USER_LIBRARY_DIR)/Bundles"; - MACOSX_DEPLOYMENT_TARGET = 10.7; PRODUCT_NAME = UnitTests; SDKROOT = macosx; - ZERO_LINK = NO; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/MacOnly"; }; name = Release; }; @@ -2656,9 +3304,9 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; - INFOPLIST_FILE = "$(SRCROOT)/CorePlot-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-Info.plist"; INSTALL_PATH = "@rpath"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/MacOnly"; @@ -2674,9 +3322,9 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; FRAMEWORK_VERSION = A; - INFOPLIST_FILE = "$(SRCROOT)/CorePlot-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-Info.plist"; INSTALL_PATH = "@rpath"; - MACOSX_DEPLOYMENT_TARGET = 10.7; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = macosx; USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/MacOnly"; @@ -2686,15 +3334,23 @@ }; 1DEB91B208733DA50010E9CD /* Debug */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - SYMROOT = "$(PROJECT_DIR)/../build"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CURRENT_PROJECT_VERSION = 2.3; + ENABLE_TESTABILITY = YES; + GCC_NO_COMMON_BLOCKS = YES; + ONLY_ACTIVE_ARCH = YES; }; name = Debug; }; 1DEB91B308733DA50010E9CD /* Release */ = { isa = XCBuildConfiguration; + baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - SYMROOT = "$(PROJECT_DIR)/../build"; + CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; + CURRENT_PROJECT_VERSION = 2.3; + GCC_NO_COMMON_BLOCKS = YES; }; name = Release; }; @@ -2723,29 +3379,122 @@ }; name = Release; }; - C38A098B1A46185300D45436 /* Debug */ = { + C37EA5C71BC83E900091C8F7 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = NO; + DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; + }; + name = Debug; + }; + C37EA5C81BC83E900091C8F7 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + COMBINE_HIDPI_IMAGES = YES; + COPY_PHASE_STRIP = YES; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + SUPPORTED_PLATFORMS = "appletvsimulator appletvos"; + ZERO_LINK = NO; + }; + name = Release; + }; + C37EA6901BC83F2A0091C8F7 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-tvOS-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = CorePlot; + SDKROOT = appletvos; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/iPhoneOnly"; + }; + name = Debug; + }; + C37EA6911BC83F2A0091C8F7 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-tvOS-Info.plist"; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = CorePlot; + SDKROOT = appletvos; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/iPhoneOnly"; + }; + name = Release; + }; + C37EA6B51BC83F2D0091C8F7 /* Debug */ = { isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-tvOSTests-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/iPhoneOnly"; + }; + name = Debug; + }; + C37EA6B61BC83F2D0091C8F7 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-tvOSTests-Info.plist"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + USER_HEADER_SEARCH_PATHS = "$(SRCROOT)/Source $(SRCROOT)/iPhoneOnly"; + }; + name = Release; + }; + C38A098B1A46185300D45436 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; + buildSettings = { + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - INFOPLIST_FILE = "$(SRCROOT)/CorePlot_iOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-iOS-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2757,21 +3506,17 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_ARC = YES; - CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = YES; + CODE_SIGN_IDENTITY = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; DEFINES_MODULE = YES; DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - INFOPLIST_FILE = "$(SRCROOT)/CorePlot_iOS-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-iOS-Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = CorePlot; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2783,33 +3528,11 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = "CorePlot-iOSTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-iOSTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2821,29 +3544,11 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = "CorePlot-iOSTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-iOSTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2884,7 +3589,6 @@ DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "Documentation-iOS copy"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -2899,7 +3603,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; PRODUCT_NAME = "Documentation-iOS copy"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -2911,19 +3614,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - INFOPLIST_FILE = "CorePlot-CocoaTouch-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-CocoaTouch-Info.plist"; INSTALL_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - MACOSX_DEPLOYMENT_TARGET = ""; MTL_ENABLE_DEBUG_INFO = YES; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2936,15 +3629,9 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_ARC = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - INFOPLIST_FILE = "CorePlot-CocoaTouch-Info.plist"; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-CocoaTouch-Info.plist"; INSTALL_PATH = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; - MACOSX_DEPLOYMENT_TARGET = ""; MTL_ENABLE_DEBUG_INFO = NO; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; @@ -2957,33 +3644,11 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08C1BB5A44800931F32 /* CorePlotDebug.xcconfig */; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_SYMBOLS_PRIVATE_EXTERN = NO; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = "CorePlot-CocoaTouchTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = YES; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -2995,29 +3660,11 @@ isa = XCBuildConfiguration; baseConfigurationReference = C3C9D08D1BB5A45B00931F32 /* CorePlotRelease.xcconfig */; buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; CODE_SIGN_IDENTITY = "iPhone Developer"; - COPY_PHASE_STRIP = YES; - ENABLE_NS_ASSERTIONS = NO; - GCC_C_LANGUAGE_STANDARD = gnu99; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - INFOPLIST_FILE = "CorePlot-CocoaTouchTests-Info.plist"; - IPHONEOS_DEPLOYMENT_TARGET = 6.0; + INFOPLIST_FILE = "$(SRCROOT)/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MTL_ENABLE_DEBUG_INFO = NO; + PRODUCT_BUNDLE_IDENTIFIER = "com.CorePlot.$(PRODUCT_NAME:rfc1034identifier)"; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; TARGETED_DEVICE_FAMILY = "1,2"; @@ -3033,7 +3680,6 @@ DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; GCC_OPTIMIZATION_LEVEL = 0; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -3048,7 +3694,6 @@ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; DOXYGEN_PATH = /Applications/Doxygen.app/Contents/Resources/doxygen; GCC_VERSION = com.apple.compilers.llvm.clang.1_0; - IPHONEOS_DEPLOYMENT_TARGET = 8.0; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = "iphonesimulator iphoneos"; @@ -3095,6 +3740,33 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + C37EA5C61BC83E900091C8F7 /* Build configuration list for PBXAggregateTarget "Universal tvOS Framework" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C37EA5C71BC83E900091C8F7 /* Debug */, + C37EA5C81BC83E900091C8F7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C37EA68F1BC83F2A0091C8F7 /* Build configuration list for PBXNativeTarget "CorePlot tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C37EA6901BC83F2A0091C8F7 /* Debug */, + C37EA6911BC83F2A0091C8F7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C37EA6B41BC83F2D0091C8F7 /* Build configuration list for PBXNativeTarget "UnitTests tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C37EA6B51BC83F2D0091C8F7 /* Debug */, + C37EA6B61BC83F2D0091C8F7 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; C38A098F1A46185300D45436 /* Build configuration list for PBXNativeTarget "CorePlot iOS" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 000000000..18d981003 --- /dev/null +++ b/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings b/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings new file mode 100644 index 000000000..0c67376eb --- /dev/null +++ b/framework/CorePlot.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings @@ -0,0 +1,5 @@ + + + + + diff --git a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot Mac.xcscheme b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot Mac.xcscheme index 0303058a1..6567660c2 100644 --- a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot Mac.xcscheme +++ b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot Mac.xcscheme @@ -1,6 +1,6 @@ + shouldUseLaunchSchemeArgsEnv = "YES"> @@ -40,8 +39,6 @@ - - - - + shouldUseLaunchSchemeArgsEnv = "YES"> + + + + @@ -54,17 +62,6 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot-CocoaTouch.xcscheme b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot-CocoaTouch.xcscheme new file mode 100644 index 000000000..fe0aaaaef --- /dev/null +++ b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/CorePlot-CocoaTouch.xcscheme @@ -0,0 +1,109 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Documentation-Mac.xcscheme b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Documentation-Mac.xcscheme new file mode 100644 index 000000000..659889d19 --- /dev/null +++ b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Documentation-Mac.xcscheme @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Documentation-iOS.xcscheme b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Documentation-iOS.xcscheme new file mode 100644 index 000000000..3442d658f --- /dev/null +++ b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Documentation-iOS.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal Library.xcscheme b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal Library.xcscheme new file mode 100644 index 000000000..02086de38 --- /dev/null +++ b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal Library.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal iOS Framework.xcscheme b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal iOS Framework.xcscheme new file mode 100644 index 000000000..12a6c18d2 --- /dev/null +++ b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal iOS Framework.xcscheme @@ -0,0 +1,76 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal tvOS Framework.xcscheme b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal tvOS Framework.xcscheme new file mode 100644 index 000000000..c45a23509 --- /dev/null +++ b/framework/CorePlot.xcodeproj/xcshareddata/xcschemes/Universal tvOS Framework.xcscheme @@ -0,0 +1,58 @@ + + + + + + + + + + + + + + + + + + + + + + + diff --git a/framework/CorePlot_Prefix.pch b/framework/CorePlot_Prefix.pch index 7f17851fe..650702d34 100644 --- a/framework/CorePlot_Prefix.pch +++ b/framework/CorePlot_Prefix.pch @@ -7,7 +7,7 @@ #import - #if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE + #if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV #import #import #else diff --git a/framework/CorePlot-CocoaTouch-Info.plist b/framework/Info/Base.lproj/CorePlot-CocoaTouch-Info.plist similarity index 100% rename from framework/CorePlot-CocoaTouch-Info.plist rename to framework/Info/Base.lproj/CorePlot-CocoaTouch-Info.plist diff --git a/framework/CorePlot-CocoaTouchTests-Info.plist b/framework/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist similarity index 91% rename from framework/CorePlot-CocoaTouchTests-Info.plist rename to framework/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist index 70b39d69c..ba72822e8 100644 --- a/framework/CorePlot-CocoaTouchTests-Info.plist +++ b/framework/Info/Base.lproj/CorePlot-CocoaTouchTests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.CorePlot.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/framework/CorePlot-Info.plist b/framework/Info/Base.lproj/CorePlot-Info.plist similarity index 100% rename from framework/CorePlot-Info.plist rename to framework/Info/Base.lproj/CorePlot-Info.plist diff --git a/framework/CorePlot_iOS-Info.plist b/framework/Info/Base.lproj/CorePlot-iOS-Info.plist similarity index 92% rename from framework/CorePlot_iOS-Info.plist rename to framework/Info/Base.lproj/CorePlot-iOS-Info.plist index 06f3d09a5..d3de8eefb 100644 --- a/framework/CorePlot_iOS-Info.plist +++ b/framework/Info/Base.lproj/CorePlot-iOS-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.CorePlot.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/framework/CorePlot-iOSTests-Info.plist b/framework/Info/Base.lproj/CorePlot-iOSTests-Info.plist similarity index 91% rename from framework/CorePlot-iOSTests-Info.plist rename to framework/Info/Base.lproj/CorePlot-iOSTests-Info.plist index 70b39d69c..ba72822e8 100644 --- a/framework/CorePlot-iOSTests-Info.plist +++ b/framework/Info/Base.lproj/CorePlot-iOSTests-Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier - com.CorePlot.$(PRODUCT_NAME:rfc1034identifier) + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName diff --git a/framework/Info/Base.lproj/CorePlot-tvOS-Info.plist b/framework/Info/Base.lproj/CorePlot-tvOS-Info.plist new file mode 100644 index 000000000..d3de8eefb --- /dev/null +++ b/framework/Info/Base.lproj/CorePlot-tvOS-Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/framework/Info/Base.lproj/CorePlot-tvOSTests-Info.plist b/framework/Info/Base.lproj/CorePlot-tvOSTests-Info.plist new file mode 100644 index 000000000..ba72822e8 --- /dev/null +++ b/framework/Info/Base.lproj/CorePlot-tvOSTests-Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/framework/CorePlotTests-Info.plist b/framework/Info/Base.lproj/CorePlotTests-Info.plist similarity index 100% rename from framework/CorePlotTests-Info.plist rename to framework/Info/Base.lproj/CorePlotTests-Info.plist diff --git a/framework/MacOnly/CPTDecimalNumberValueTransformer.m b/framework/MacOnly/CPTDecimalNumberValueTransformer.m index edf9645ef..04477ecb9 100644 --- a/framework/MacOnly/CPTDecimalNumberValueTransformer.m +++ b/framework/MacOnly/CPTDecimalNumberValueTransformer.m @@ -19,19 +19,19 @@ +(BOOL)allowsReverseTransformation * @brief The class of the value returned for a forward transformation. * @return Transformed values will be instances of NSNumber. **/ -+(Class)transformedValueClass ++(nonnull Class)transformedValueClass { return [NSNumber class]; } /// @cond --(id)transformedValue:(id)value +-(nullable id)transformedValue:(nullable id)value { return [value copy]; } --(id)reverseTransformedValue:(id)value +-(nullable id)reverseTransformedValue:(nullable id)value { return [value decimalNumber]; } diff --git a/framework/MacOnly/CPTGraphHostingView.h b/framework/MacOnly/CPTGraphHostingView.h index 429fdea08..bf185e21a 100644 --- a/framework/MacOnly/CPTGraphHostingView.h +++ b/framework/MacOnly/CPTGraphHostingView.h @@ -2,7 +2,7 @@ @class CPTGraph; -@interface CPTGraphHostingView : NSView +@interface CPTGraphHostingView : NSView /// @name Hosted graph /// @{ diff --git a/framework/MacOnly/CPTGraphHostingView.m b/framework/MacOnly/CPTGraphHostingView.m index d34e101a7..531d6b06b 100644 --- a/framework/MacOnly/CPTGraphHostingView.m +++ b/framework/MacOnly/CPTGraphHostingView.m @@ -29,7 +29,7 @@ -(void)plotAreaBoundsChanged; **/ @implementation CPTGraphHostingView -/** @property CPTGraph *hostedGraph +/** @property nullable CPTGraph *hostedGraph * @brief The CPTGraph hosted inside this view. **/ @synthesize hostedGraph; @@ -41,12 +41,12 @@ @implementation CPTGraphHostingView **/ @synthesize printRect; -/** @property NSCursor *closedHandCursor +/** @property nullable NSCursor *closedHandCursor * @brief The cursor displayed when the user is actively dragging any plot space. **/ @synthesize closedHandCursor; -/** @property NSCursor *openHandCursor +/** @property nullable NSCursor *openHandCursor * @brief The cursor displayed when the mouse pointer is over a plot area mapped to a plot space that allows user interaction, but not actively being dragged. **/ @synthesize openHandCursor; @@ -61,27 +61,37 @@ @implementation CPTGraphHostingView /// @cond --(instancetype)initWithFrame:(NSRect)frame +-(void)commonInit { - if ( (self = [super initWithFrame:frame]) ) { - hostedGraph = nil; - printRect = NSZeroRect; + self.hostedGraph = nil; + self.printRect = NSZeroRect; - closedHandCursor = [NSCursor closedHandCursor]; - openHandCursor = [NSCursor openHandCursor]; - allowPinchScaling = YES; + self.closedHandCursor = [NSCursor closedHandCursor]; + self.openHandCursor = [NSCursor openHandCursor]; + self.allowPinchScaling = YES; - locationInWindow = NSZeroPoint; - scrollOffset = CGPointZero; + self.locationInWindow = NSZeroPoint; + self.scrollOffset = CGPointZero; - if ( !self.superview.wantsLayer ) { - self.layer = [self makeBackingLayer]; - } + [self addObserver:self + forKeyPath:@"effectiveAppearance" + options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | NSKeyValueObservingOptionInitial + context:CPTGraphHostingViewKVOContext]; + + if ( !self.superview.wantsLayer ) { + self.layer = [self makeBackingLayer]; + } +} + +-(nonnull instancetype)initWithFrame:(NSRect)frame +{ + if ((self = [super initWithFrame:frame])) { + [self commonInit]; } return self; } --(CALayer *)makeBackingLayer +-(nonnull CALayer *)makeBackingLayer { return [[CPTLayer alloc] initWithFrame:NSRectToCGRect(self.bounds)]; } @@ -97,6 +107,8 @@ -(void)dealloc [space removeObserver:self forKeyPath:@"isDragging" context:CPTGraphHostingViewKVOContext]; } + [self removeObserver:self forKeyPath:@"effectiveAppearance" context:CPTGraphHostingViewKVOContext]; + [hostedGraph removeFromSuperlayer]; } @@ -107,7 +119,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -122,39 +134,46 @@ -(void)encodeWithCoder:(NSCoder *)coder // scrollOffset } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - CPTLayer *mainLayer = [[CPTLayer alloc] initWithFrame:NSRectToCGRect(self.frame)]; - self.layer = mainLayer; + if ((self = [super initWithCoder:coder])) { + [self commonInit]; - hostedGraph = nil; - self.hostedGraph = [coder decodeObjectForKey:@"CPTLayerHostingView.hostedGraph"]; // setup layers + self.hostedGraph = [coder decodeObjectOfClass:[CPTGraph class] + forKey:@"CPTLayerHostingView.hostedGraph"]; // setup layers self.printRect = [coder decodeRectForKey:@"CPTLayerHostingView.printRect"]; - self.closedHandCursor = [coder decodeObjectForKey:@"CPTLayerHostingView.closedHandCursor"]; - self.openHandCursor = [coder decodeObjectForKey:@"CPTLayerHostingView.openHandCursor"]; + self.closedHandCursor = [coder decodeObjectOfClass:[NSCursor class] + forKey:@"CPTLayerHostingView.closedHandCursor"]; + self.openHandCursor = [coder decodeObjectOfClass:[NSCursor class] + forKey:@"CPTLayerHostingView.openHandCursor"]; if ( [coder containsValueForKey:@"CPTLayerHostingView.allowPinchScaling"] ) { self.allowPinchScaling = [coder decodeBoolForKey:@"CPTLayerHostingView.allowPinchScaling"]; } - else { - self.allowPinchScaling = YES; - } - - self.locationInWindow = NSZeroPoint; - self.scrollOffset = CGPointZero; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /// @cond --(void)drawRect:(NSRect)dirtyRect +-(void)drawRect:(NSRect __unused)dirtyRect { if ( self.hostedGraph ) { if ( ![NSGraphicsContext currentContextDrawingToScreen] ) { @@ -166,19 +185,19 @@ -(void)drawRect:(NSRect)dirtyRect CGRect sourceRect = NSRectToCGRect(self.frame); CGRect destinationRect = NSRectToCGRect(self.printRect); - if ( CGRectEqualToRect(destinationRect, CGRectZero) ) { + if ( CGRectEqualToRect(destinationRect, CGRectZero)) { destinationRect = sourceRect; } // scale the view isotropically so that it fits on the printed page - CGFloat widthScale = ( sourceRect.size.width != CPTFloat(0.0) ) ? destinationRect.size.width / sourceRect.size.width : CPTFloat(1.0); - CGFloat heightScale = ( sourceRect.size.height != CPTFloat(0.0) ) ? destinationRect.size.height / sourceRect.size.height : CPTFloat(1.0); + CGFloat widthScale = (sourceRect.size.width != CPTFloat(0.0)) ? destinationRect.size.width / sourceRect.size.width : CPTFloat(1.0); + CGFloat heightScale = (sourceRect.size.height != CPTFloat(0.0)) ? destinationRect.size.height / sourceRect.size.height : CPTFloat(1.0); CGFloat scale = MIN(widthScale, heightScale); // position the view so that its centered on the printed page CGPoint offset = destinationRect.origin; - offset.x += ( ( destinationRect.size.width - (sourceRect.size.width * scale) ) / CPTFloat(2.0) ); - offset.y += ( ( destinationRect.size.height - (sourceRect.size.height * scale) ) / CPTFloat(2.0) ); + offset.x += ((destinationRect.size.width - (sourceRect.size.width * scale)) / CPTFloat(2.0)); + offset.y += ((destinationRect.size.height - (sourceRect.size.height * scale)) / CPTFloat(2.0)); NSAffineTransform *transform = [NSAffineTransform transform]; [transform translateXBy:offset.x yBy:offset.y]; @@ -187,7 +206,7 @@ -(void)drawRect:(NSRect)dirtyRect // render CPTLayers recursively into the graphics context used for printing // (thanks to Brad for the tip: http://stackoverflow.com/a/2791305/132867 ) - CGContextRef context = [graphicsContext graphicsPort]; + CGContextRef context = graphicsContext.graphicsPort; [self.hostedGraph recursivelyRenderInContext:context]; [graphicsContext restoreGraphicsState]; @@ -202,7 +221,7 @@ -(void)drawRect:(NSRect)dirtyRect /// @cond --(BOOL)knowsPageRange:(NSRangePointer)rangePointer +-(BOOL)knowsPageRange:(nonnull NSRangePointer)rangePointer { rangePointer->location = 1; rangePointer->length = 1; @@ -210,7 +229,7 @@ -(BOOL)knowsPageRange:(NSRangePointer)rangePointer return YES; } --(NSRect)rectForPage:(NSInteger)pageNumber +-(NSRect)rectForPage:(NSInteger __unused)pageNumber { return self.printRect; } @@ -222,12 +241,12 @@ -(NSRect)rectForPage:(NSInteger)pageNumber /// @cond --(BOOL)acceptsFirstMouse:(NSEvent *)theEvent +-(BOOL)acceptsFirstMouse:(nullable NSEvent *__unused)theEvent { return YES; } --(void)mouseDown:(NSEvent *)theEvent +-(void)mouseDown:(nonnull NSEvent *)theEvent { [super mouseDown:theEvent]; @@ -235,7 +254,7 @@ -(void)mouseDown:(NSEvent *)theEvent BOOL handled = NO; if ( theGraph ) { - CGPoint pointOfMouseDown = NSPointToCGPoint([self convertPoint:[theEvent locationInWindow] fromView:nil]); + CGPoint pointOfMouseDown = NSPointToCGPoint([self convertPoint:theEvent.locationInWindow fromView:nil]); CGPoint pointInHostedGraph = [self.layer convertPoint:pointOfMouseDown toLayer:theGraph]; handled = [theGraph pointingDeviceDownEvent:theEvent atPoint:pointInHostedGraph]; } @@ -245,13 +264,13 @@ -(void)mouseDown:(NSEvent *)theEvent } } --(void)mouseDragged:(NSEvent *)theEvent +-(void)mouseDragged:(nonnull NSEvent *)theEvent { CPTGraph *theGraph = self.hostedGraph; BOOL handled = NO; if ( theGraph ) { - CGPoint pointOfMouseDrag = NSPointToCGPoint([self convertPoint:[theEvent locationInWindow] fromView:nil]); + CGPoint pointOfMouseDrag = NSPointToCGPoint([self convertPoint:theEvent.locationInWindow fromView:nil]); CGPoint pointInHostedGraph = [self.layer convertPoint:pointOfMouseDrag toLayer:theGraph]; handled = [theGraph pointingDeviceDraggedEvent:theEvent atPoint:pointInHostedGraph]; } @@ -261,13 +280,13 @@ -(void)mouseDragged:(NSEvent *)theEvent } } --(void)mouseUp:(NSEvent *)theEvent +-(void)mouseUp:(nonnull NSEvent *)theEvent { CPTGraph *theGraph = self.hostedGraph; BOOL handled = NO; if ( theGraph ) { - CGPoint pointOfMouseUp = NSPointToCGPoint([self convertPoint:[theEvent locationInWindow] fromView:nil]); + CGPoint pointOfMouseUp = NSPointToCGPoint([self convertPoint:theEvent.locationInWindow fromView:nil]); CGPoint pointInHostedGraph = [self.layer convertPoint:pointOfMouseUp toLayer:theGraph]; handled = [theGraph pointingDeviceUpEvent:theEvent atPoint:pointInHostedGraph]; } @@ -284,13 +303,13 @@ -(void)mouseUp:(NSEvent *)theEvent /// @cond --(void)magnifyWithEvent:(NSEvent *)event +-(void)magnifyWithEvent:(nonnull NSEvent *)event { CPTGraph *theGraph = self.hostedGraph; BOOL handled = NO; if ( theGraph && self.allowPinchScaling ) { - CGPoint pointOfMagnification = NSPointToCGPoint([self convertPoint:[event locationInWindow] fromView:nil]); + CGPoint pointOfMagnification = NSPointToCGPoint([self convertPoint:event.locationInWindow fromView:nil]); CGPoint pointInHostedGraph = [self.layer convertPoint:pointOfMagnification toLayer:theGraph]; CGPoint pointInPlotArea = [theGraph convertPoint:pointInHostedGraph toLayer:theGraph.plotAreaFrame.plotArea]; @@ -309,7 +328,7 @@ -(void)magnifyWithEvent:(NSEvent *)event } } --(void)scrollWheel:(NSEvent *)theEvent +-(void)scrollWheel:(nonnull NSEvent *)theEvent { CPTGraph *theGraph = self.hostedGraph; BOOL handled = NO; @@ -400,6 +419,8 @@ -(void)scrollWheel:(NSEvent *)theEvent -(void)viewDidChangeBackingProperties { + [super viewDidChangeBackingProperties]; + NSWindow *myWindow = self.window; if ( myWindow ) { @@ -427,7 +448,7 @@ -(void)resetCursorRects NSCursor *closedCursor = self.closedHandCursor; NSCursor *openCursor = self.openHandCursor; - if ( plotArea && (closedCursor || openCursor) ) { + if ( plotArea && (closedCursor || openCursor)) { BOOL allowsInteraction = NO; BOOL isDragging = NO; @@ -459,10 +480,10 @@ -(void)resetCursorRects /** @internal * @brief Adds a KVO observer to a new plot space added to the hosted graph. **/ --(void)plotSpaceAdded:(NSNotification *)notification +-(void)plotSpaceAdded:(nonnull NSNotification *)notification { - CPTDictionary userInfo = notification.userInfo; - CPTPlotSpace *space = userInfo[CPTGraphPlotSpaceNotificationKey]; + CPTDictionary *userInfo = notification.userInfo; + CPTPlotSpace *space = userInfo[CPTGraphPlotSpaceNotificationKey]; [space addObserver:self forKeyPath:@"isDragging" @@ -473,10 +494,10 @@ -(void)plotSpaceAdded:(NSNotification *)notification /** @internal * @brief Removes the KVO observer from a plot space removed from the hosted graph. **/ --(void)plotSpaceRemoved:(NSNotification *)notification +-(void)plotSpaceRemoved:(nonnull NSNotification *)notification { - CPTDictionary userInfo = notification.userInfo; - CPTPlotSpace *space = userInfo[CPTGraphPlotSpaceNotificationKey]; + CPTDictionary *userInfo = notification.userInfo; + CPTPlotSpace *space = userInfo[CPTGraphPlotSpaceNotificationKey]; [space removeObserver:self forKeyPath:@"isDragging" context:CPTGraphHostingViewKVOContext]; [self.window invalidateCursorRectsForView:self]; @@ -490,7 +511,7 @@ -(void)plotAreaBoundsChanged [self.window invalidateCursorRectsForView:self]; } --(void)viewWillMoveToSuperview:(NSView *)newSuperview +-(void)viewWillMoveToSuperview:(nullable NSView *)newSuperview { if ( self.superview.wantsLayer != newSuperview.wantsLayer ) { self.wantsLayer = NO; @@ -503,6 +524,11 @@ -(void)viewWillMoveToSuperview:(NSView *)newSuperview self.layer = [self makeBackingLayer]; self.wantsLayer = YES; } + + CPTGraph *theGraph = self.hostedGraph; + if ( theGraph ) { + [self.layer addSublayer:theGraph]; + } } } @@ -513,7 +539,7 @@ -(void)viewWillMoveToSuperview:(NSView *)newSuperview /// @cond --(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(CPTDictionary)change context:(void *)context +-(void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id)object change:(nullable CPTDictionary *)change context:(nullable void *)context { if ( context == CPTGraphHostingViewKVOContext ) { CPTGraph *theGraph = self.hostedGraph; @@ -521,7 +547,7 @@ -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(CP if ( [keyPath isEqualToString:@"isDragging"] && [object isKindOfClass:[CPTPlotSpace class]] ) { [self.window invalidateCursorRectsForView:self]; } - else if ( [keyPath isEqualToString:@"plotAreaFrame"] && (object == theGraph) ) { + else if ( [keyPath isEqualToString:@"plotAreaFrame"] && (object == theGraph)) { CPTPlotAreaFrame *oldPlotAreaFrame = change[NSKeyValueChangeOldKey]; CPTPlotAreaFrame *newPlotAreaFrame = change[NSKeyValueChangeNewKey]; @@ -536,7 +562,7 @@ -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(CP context:CPTGraphHostingViewKVOContext]; } } - else if ( [keyPath isEqualToString:@"plotArea"] && (object == theGraph.plotAreaFrame) ) { + else if ( [keyPath isEqualToString:@"plotArea"] && (object == theGraph.plotAreaFrame)) { CPTPlotArea *oldPlotArea = change[NSKeyValueChangeOldKey]; CPTPlotArea *newPlotArea = change[NSKeyValueChangeNewKey]; @@ -553,6 +579,9 @@ -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(CP object:newPlotArea]; } } + else if ( [keyPath isEqualToString:@"effectiveAppearance"] && (object == self)) { + [self.hostedGraph setNeedsDisplayAllLayers]; + } } else { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; @@ -566,9 +595,9 @@ -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(CP /// @cond --(void)setHostedGraph:(CPTGraph *)newGraph +-(void)setHostedGraph:(nullable CPTGraph *)newGraph { - NSParameterAssert( (newGraph == nil) || [newGraph isKindOfClass:[CPTGraph class]] ); + NSParameterAssert((newGraph == nil) || [newGraph isKindOfClass:[CPTGraph class]]); if ( newGraph != hostedGraph ) { self.wantsLayer = YES; @@ -592,21 +621,23 @@ -(void)setHostedGraph:(CPTGraph *)newGraph hostedGraph = newGraph; if ( newGraph ) { + CPTGraph *theGraph = newGraph; + newGraph.hostingView = self; [self viewDidChangeBackingProperties]; - [self.layer addSublayer:newGraph]; + [self.layer addSublayer:theGraph]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(plotSpaceAdded:) name:CPTGraphDidAddPlotSpaceNotification - object:newGraph]; + object:theGraph]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(plotSpaceRemoved:) name:CPTGraphDidRemovePlotSpaceNotification - object:newGraph]; + object:theGraph]; - [newGraph addObserver:self + [theGraph addObserver:self forKeyPath:@"plotAreaFrame" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld | NSKeyValueObservingOptionInitial context:CPTGraphHostingViewKVOContext]; @@ -621,7 +652,7 @@ -(void)setHostedGraph:(CPTGraph *)newGraph } } --(void)setClosedHandCursor:(NSCursor *)newCursor +-(void)setClosedHandCursor:(nullable NSCursor *)newCursor { if ( newCursor != closedHandCursor ) { closedHandCursor = newCursor; @@ -630,7 +661,7 @@ -(void)setClosedHandCursor:(NSCursor *)newCursor } } --(void)setOpenHandCursor:(NSCursor *)newCursor +-(void)setOpenHandCursor:(nullable NSCursor *)newCursor { if ( newCursor != openHandCursor ) { openHandCursor = newCursor; diff --git a/framework/MacOnly/CPTImagePlatformSpecific.m b/framework/MacOnly/CPTImagePlatformSpecific.m index dc46739e0..4b845f2ba 100644 --- a/framework/MacOnly/CPTImagePlatformSpecific.m +++ b/framework/MacOnly/CPTImagePlatformSpecific.m @@ -10,9 +10,9 @@ @implementation CPTImage(CPTPlatformSpecificImageExtensions) * @param anImage The platform-native image. * @return A CPTImage instance initialized with the provided image. **/ --(instancetype)initWithNativeImage:(CPTNativeImage *)anImage +-(nonnull instancetype)initWithNativeImage:(nullable CPTNativeImage *)anImage { - if ( (self = [self init]) ) { + if ((self = [self init])) { self.nativeImage = anImage; } @@ -28,7 +28,7 @@ -(instancetype)initWithNativeImage:(CPTNativeImage *)anImage * @param path The file system path of the file. * @return A CPTImage instance initialized with the contents of the PNG file. **/ --(instancetype)initForPNGFile:(NSString *)path +-(nonnull instancetype)initForPNGFile:(nonnull NSString *)path { CGFloat imageScale = CPTFloat(1.0); @@ -40,7 +40,7 @@ -(instancetype)initForPNGFile:(NSString *)path imageScale = MAX(imageScale, screen.backingScaleFactor); } - while ( imageScale > CPTFloat(1.0) ) { + while ( imageScale > CPTFloat(1.0)) { NSMutableString *hiDpiPath = [path mutableCopy]; NSUInteger replaceCount = [hiDpiPath replaceOccurrencesOfString:@".png" withString:[NSString stringWithFormat:@"@%dx.png", (int)imageScale] diff --git a/framework/MacOnly/CPTPlatformSpecificCategories.h b/framework/MacOnly/CPTPlatformSpecificCategories.h index 96732d478..2102bc1bf 100644 --- a/framework/MacOnly/CPTPlatformSpecificCategories.h +++ b/framework/MacOnly/CPTPlatformSpecificCategories.h @@ -16,17 +16,6 @@ @end -#pragma mark - CPTColor - -/** @category CPTColor(CPTPlatformSpecificColorExtensions) - * @brief Platform-specific extensions to CPTColor. - **/ -@interface CPTColor(CPTPlatformSpecificColorExtensions) - -@property (nonatomic, readonly, nonnull) NSColor *nsColor; - -@end - #pragma mark - NSAttributedString /** @category NSAttributedString(CPTPlatformSpecificAttributedStringExtensions) @@ -39,4 +28,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 f53be1a3a..8b6229cc5 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 @@ -9,25 +11,52 @@ @implementation CPTLayer(CPTPlatformSpecificLayerExtensions) /** @brief Gets an image of the layer contents. * @return A native image representation of the layer content. **/ --(CPTNativeImage *)imageOfLayer +-(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 = 0.0; + + if ( [self respondsToSelector:@selector(hostingView)] ) { + scale = ((CPTGraph *)self).hostingView.window.backingScaleFactor; + } + if ((scale == 0.0) && [CALayer instancesRespondToSelector:@selector(contentsScale)] ) { + scale = self.contentsScale; + } + if ( scale == 0.0 ) { + NSWindow *myWindow = self.graph.hostingView.window; + + if ( myWindow ) { + scale = myWindow.backingScaleFactor; + } + else { + scale = [NSScreen mainScreen].backingScaleFactor; + } + } + scale = MAX(scale, CPTFloat(1.0)); + + 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.size = NSSizeFromCGSize(boundsSize); NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; - CGContextRef context = (CGContextRef)[bitmapContext graphicsPort]; + CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; - CGContextClearRect( context, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height) ); + CGContextClearRect(context, CPTRectMake(0.0, 0.0, boundsSize.width, boundsSize.height)); CGContextSetAllowsAntialiasing(context, true); CGContextSetShouldSmoothFonts(context, false); [self layoutAndRenderInContext:context]; @@ -41,22 +70,6 @@ -(CPTNativeImage *)imageOfLayer @end -#pragma mark - CPTColor - -@implementation CPTColor(CPTPlatformSpecificColorExtensions) - -/** @property nsColor - * @brief Gets the color value as an NSColor. - **/ -@dynamic nsColor; - --(NSColor *)nsColor -{ - return [NSColor colorWithCIColor:[CIColor colorWithCGColor:self.cgColor]]; -} - -@end - #pragma mark - NSAttributedString @implementation NSAttributedString(CPTPlatformSpecificAttributedStringExtensions) @@ -65,14 +78,39 @@ @implementation NSAttributedString(CPTPlatformSpecificAttributedStringExtensions * @param rect The bounding rectangle in which to draw the text. * @param context The graphics context to draw into. **/ --(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context { CPTPushCGContext(context); [self drawWithRect:NSRectFromCGRect(rect) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine]; + options:CPTStringDrawingOptions]; 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/CPTPlatformSpecificDefines.h b/framework/MacOnly/CPTPlatformSpecificDefines.h index 354989f9f..24d77c3c6 100644 --- a/framework/MacOnly/CPTPlatformSpecificDefines.h +++ b/framework/MacOnly/CPTPlatformSpecificDefines.h @@ -1,4 +1,6 @@ /// @file +typedef NSColor CPTNativeColor; ///< Platform-native color. typedef NSImage CPTNativeImage; ///< Platform-native image format. typedef NSEvent CPTNativeEvent; ///< Platform-native OS event. +typedef NSFont CPTNativeFont; ///< Platform-native font. diff --git a/framework/MacOnly/CPTPlatformSpecificFunctions.h b/framework/MacOnly/CPTPlatformSpecificFunctions.h index 2f7d1b0cf..66fc3580a 100644 --- a/framework/MacOnly/CPTPlatformSpecificFunctions.h +++ b/framework/MacOnly/CPTPlatformSpecificFunctions.h @@ -16,7 +16,7 @@ void CPTPopCGContext(void); /// @name Color Conversion /// @{ -__nonnull CGColorRef CPTCreateCGColorFromNSColor(NSColor *__nonnull nsColor); +__nonnull CGColorRef CPTCreateCGColorFromNSColor(NSColor *__nonnull nsColor) CF_RETURNS_RETAINED; CPTRGBAColor CPTRGBAColorFromNSColor(NSColor *__nonnull nsColor); /// @} diff --git a/framework/MacOnly/CPTPlatformSpecificFunctions.m b/framework/MacOnly/CPTPlatformSpecificFunctions.m index 2951f7cdc..4e5668a58 100644 --- a/framework/MacOnly/CPTPlatformSpecificFunctions.m +++ b/framework/MacOnly/CPTPlatformSpecificFunctions.m @@ -12,7 +12,7 @@ /** @brief Pushes the current AppKit graphics context onto a stack and replaces it with the given Core Graphics context. * @param newContext The graphics context. **/ -void CPTPushCGContext(CGContextRef newContext) +void CPTPushCGContext(__nonnull CGContextRef newContext) { dispatch_once(&contextOnceToken, ^{ pushedContexts = [[NSMutableArray alloc] init]; @@ -75,7 +75,7 @@ void CPTPopCGContext(void) * @param nsColor The NSColor. * @return The @ref CGColorRef. **/ -CGColorRef CPTCreateCGColorFromNSColor(NSColor *nsColor) +__nonnull CGColorRef CPTCreateCGColorFromNSColor(NSColor *__nonnull nsColor) { NSColor *rgbColor = [nsColor colorUsingColorSpace:[NSColorSpace genericRGBColorSpace]]; CGFloat r, g, b, a; @@ -91,7 +91,7 @@ CGColorRef CPTCreateCGColorFromNSColor(NSColor *nsColor) * @param nsColor The NSColor. * @return The CPTRGBAColor. **/ -CPTRGBAColor CPTRGBAColorFromNSColor(NSColor *nsColor) +CPTRGBAColor CPTRGBAColorFromNSColor(NSColor *__nonnull nsColor) { CGFloat red, green, blue, alpha; @@ -109,7 +109,7 @@ CPTRGBAColor CPTRGBAColorFromNSColor(NSColor *nsColor) #pragma mark - #pragma mark Debugging -CPTNativeImage * __nonnull CPTQuickLookImage(CGRect rect, __nonnull CPTQuickLookImageBlock renderBlock) +CPTNativeImage *__nonnull CPTQuickLookImage(CGRect rect, __nonnull CPTQuickLookImageBlock renderBlock) { NSBitmapImageRep *layerImage = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL @@ -125,7 +125,7 @@ CPTRGBAColor CPTRGBAColorFromNSColor(NSColor *nsColor) NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:layerImage]; - CGContextRef context = (CGContextRef)[bitmapContext graphicsPort]; + CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; CGContextClearRect(context, rect); diff --git a/framework/MacOnly/CPTTextStylePlatformSpecific.h b/framework/MacOnly/CPTTextStylePlatformSpecific.h index dcb6919af..3dbcb7fc9 100644 --- a/framework/MacOnly/CPTTextStylePlatformSpecific.h +++ b/framework/MacOnly/CPTTextStylePlatformSpecific.h @@ -3,6 +3,15 @@ /** * @brief Enumeration of paragraph alignments. **/ +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= 101200) +typedef NS_ENUM (NSInteger, CPTTextAlignment) { + CPTTextAlignmentLeft = NSTextAlignmentLeft, ///< Left alignment. + CPTTextAlignmentCenter = NSTextAlignmentCenter, ///< Center alignment. + CPTTextAlignmentRight = NSTextAlignmentRight, ///< Right alignment. + CPTTextAlignmentJustified = NSTextAlignmentJustified, ///< Justified alignment. + CPTTextAlignmentNatural = NSTextAlignmentNatural ///< Natural alignment of the text's script. +}; +#else typedef NS_ENUM (NSInteger, CPTTextAlignment) { CPTTextAlignmentLeft = NSLeftTextAlignment, ///< Left alignment. CPTTextAlignmentCenter = NSCenterTextAlignment, ///< Center alignment. @@ -10,3 +19,4 @@ typedef NS_ENUM (NSInteger, CPTTextAlignment) { CPTTextAlignmentJustified = NSJustifiedTextAlignment, ///< Justified alignment. CPTTextAlignmentNatural = NSNaturalTextAlignment ///< Natural alignment of the text's script. }; +#endif diff --git a/framework/MacOnly/CPTTextStylePlatformSpecific.m b/framework/MacOnly/CPTTextStylePlatformSpecific.m index b6ed84fda..21af2ac93 100644 --- a/framework/MacOnly/CPTTextStylePlatformSpecific.m +++ b/framework/MacOnly/CPTTextStylePlatformSpecific.m @@ -6,7 +6,7 @@ @implementation CPTTextStyle(CPTPlatformSpecificTextStyleExtensions) -/** @property CPTDictionary attributes +/** @property nonnull CPTDictionary *attributes * @brief A dictionary of standard text attributes suitable for formatting an NSAttributedString. * * The dictionary will contain values for the following keys that represent the receiver's text style: @@ -32,7 +32,7 @@ @implementation CPTTextStyle(CPTPlatformSpecificTextStyleExtensions) * @param attributes A dictionary of standard text attributes. * @return A new CPTTextStyle instance. **/ -+(instancetype)textStyleWithAttributes:(CPTDictionary)attributes ++(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attributes { CPTMutableTextStyle *newStyle = [CPTMutableTextStyle textStyle]; @@ -40,6 +40,7 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes NSFont *styleFont = attributes[NSFontAttributeName]; if ( styleFont ) { + newStyle.font = styleFont; newStyle.fontName = styleFont.fontName; newStyle.fontSize = styleFont.pointSize; } @@ -47,17 +48,17 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes // Color NSColor *styleColor = attributes[NSForegroundColorAttributeName]; if ( styleColor ) { - // CGColor property is available in Mac OS 10.8 and later + // CGColor property is available in macOS 10.8 and later if ( [styleColor respondsToSelector:@selector(CGColor)] ) { newStyle.color = [CPTColor colorWithCGColor:styleColor.CGColor]; } else { - const NSInteger numberOfComponents = [styleColor numberOfComponents]; + const NSInteger numberOfComponents = styleColor.numberOfComponents; - CGFloat *components = calloc( (size_t)numberOfComponents, sizeof(CGFloat) ); + CGFloat *components = calloc((size_t)numberOfComponents, sizeof(CGFloat)); [styleColor getComponents:components]; - CGColorSpaceRef colorSpace = [[styleColor colorSpace] CGColorSpace]; + CGColorSpaceRef colorSpace = styleColor.colorSpace.CGColorSpace; CGColorRef styleCGColor = CGColorCreate(colorSpace, components); newStyle.color = [CPTColor colorWithCGColor:styleCGColor]; @@ -82,15 +83,15 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes /// @cond --(CPTDictionary)attributes +-(nonnull CPTDictionary *)attributes { - CPTMutableDictionary myAttributes = [NSMutableDictionary dictionary]; + CPTMutableDictionary *myAttributes = [NSMutableDictionary dictionary]; // Font - NSFont *styleFont = nil; + NSFont *styleFont = self.font; NSString *fontName = self.fontName; - if ( fontName ) { + if ((styleFont == nil) && fontName ) { styleFont = [NSFont fontWithName:fontName size:self.fontSize]; } @@ -125,9 +126,20 @@ -(CPTDictionary)attributes @implementation CPTMutableTextStyle(CPTPlatformSpecificMutableTextStyleExtensions) -/// @cond - -+(instancetype)textStyleWithAttributes:(CPTDictionary)attributes +/** @brief Creates and returns a new CPTMutableTextStyle instance initialized from a dictionary of text attributes. + * + * The text style will be initalized with values associated with the following keys: + * - #NSFontAttributeName: Sets the @link CPTMutableTextStyle::fontName fontName @endlink + * and @link CPTMutableTextStyle::fontSize fontSize @endlink. + * - #NSForegroundColorAttributeName: Sets the @link CPTMutableTextStyle::color color @endlink. + * - #NSParagraphStyleAttributeName: Sets the @link CPTMutableTextStyle::textAlignment textAlignment @endlink and @link CPTMutableTextStyle::lineBreakMode lineBreakMode @endlink. + * + * Properties associated with missing keys will be inialized to their default values. + * + * @param attributes A dictionary of standard text attributes. + * @return A new CPTMutableTextStyle instance. + **/ ++(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attributes { CPTMutableTextStyle *newStyle = [CPTMutableTextStyle textStyle]; @@ -135,6 +147,7 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes NSFont *styleFont = attributes[NSFontAttributeName]; if ( styleFont ) { + newStyle.font = styleFont; newStyle.fontName = styleFont.fontName; newStyle.fontSize = styleFont.pointSize; } @@ -142,17 +155,17 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes // Color NSColor *styleColor = attributes[NSForegroundColorAttributeName]; if ( styleColor ) { - // CGColor property is available in Mac OS 10.8 and later + // CGColor property is available in macOS 10.8 and later if ( [styleColor respondsToSelector:@selector(CGColor)] ) { newStyle.color = [CPTColor colorWithCGColor:styleColor.CGColor]; } else { - const NSInteger numberOfComponents = [styleColor numberOfComponents]; + const NSInteger numberOfComponents = styleColor.numberOfComponents; - CGFloat *components = calloc( (size_t)numberOfComponents, sizeof(CGFloat) ); + CGFloat *components = calloc((size_t)numberOfComponents, sizeof(CGFloat)); [styleColor getComponents:components]; - CGColorSpaceRef colorSpace = [[styleColor colorSpace] CGColorSpace]; + CGColorSpaceRef colorSpace = styleColor.colorSpace.CGColorSpace; CGColorRef styleCGColor = CGColorCreate(colorSpace, components); newStyle.color = [CPTColor colorWithCGColor:styleCGColor]; @@ -172,8 +185,6 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes return newStyle; } -/// @endcond - @end #pragma mark - @@ -187,28 +198,27 @@ @implementation NSString(CPTTextStyleExtensions) * @param style The text style. * @return The size of the text when drawn with the given style. **/ --(CGSize)sizeWithTextStyle:(CPTTextStyle *)style +-(CGSize)sizeWithTextStyle:(nullable CPTTextStyle *)style { - NSFont *theFont = nil; - NSString *fontName = style.fontName; - - if ( fontName ) { - theFont = [NSFont fontWithName:fontName size:style.fontSize]; - } - - CGSize textSize; + CGRect rect = CGRectZero; - if ( theFont ) { - CPTDictionary attributes = @{ - NSFontAttributeName: theFont - }; - - textSize = NSSizeToCGSize([self sizeWithAttributes:attributes]); + if ( [self respondsToSelector:@selector(boundingRectWithSize:options:attributes:context:)] ) { + rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + attributes:style.attributes + context:nil]; } else { - textSize = CGSizeZero; + rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + attributes:style.attributes]; } + CGSize textSize = rect.size; + + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); + return textSize; } @@ -220,7 +230,7 @@ -(CGSize)sizeWithTextStyle:(CPTTextStyle *)style * @param style The text style. * @param context The graphics context to draw into. **/ --(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CGContextRef)context +-(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inContext:(nonnull CGContextRef)context { if ( style.color == nil ) { return; @@ -233,10 +243,10 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CG CPTPushCGContext(context); - NSFont *theFont = nil; + NSFont *theFont = style.font; NSString *fontName = style.fontName; - if ( fontName ) { + if ((theFont == nil) && fontName ) { theFont = [NSFont fontWithName:fontName size:style.fontSize]; } @@ -246,13 +256,13 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CG paragraphStyle.alignment = (NSTextAlignment)style.textAlignment; paragraphStyle.lineBreakMode = style.lineBreakMode; - CPTDictionary attributes = @{ - NSFontAttributeName: theFont, - NSForegroundColorAttributeName: foregroundColor, - NSParagraphStyleAttributeName: paragraphStyle + CPTDictionary *attributes = @{ + NSFontAttributeName: theFont, + NSForegroundColorAttributeName: foregroundColor, + NSParagraphStyleAttributeName: paragraphStyle }; [self drawWithRect:NSRectFromCGRect(rect) - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions attributes:attributes]; } CPTPopCGContext(); diff --git a/framework/Source/CPTAnimation.h b/framework/Source/CPTAnimation.h index e5455235d..93f0e48ba 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 @@ -99,7 +109,7 @@ typedef NS_ENUM (NSInteger, CPTAnimationCurve) { /// @name Property Animation /// @{ -+(nonnull CPTAnimationOperation *)animate:(nullable id)object property:(nonnull NSString *)property period:(nullable CPTAnimationPeriod *)period animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate; ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property period:(nonnull CPTAnimationPeriod *)period animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate; /// @} /// @name Animation Management diff --git a/framework/Source/CPTAnimation.m b/framework/Source/CPTAnimation.m index 49956f5bd..a626f2dc7 100644 --- a/framework/Source/CPTAnimation.m +++ b/framework/Source/CPTAnimation.m @@ -1,39 +1,39 @@ #import "CPTAnimation.h" +#import "_CPTAnimationTimingFunctions.h" #import "CPTAnimationOperation.h" #import "CPTAnimationPeriod.h" #import "CPTDefinitions.h" -#import "_CPTAnimationTimingFunctions.h" +#import "CPTPlotRange.h" static const CGFloat kCPTAnimationFrameRate = CPTFloat(1.0 / 60.0); // 60 frames per second -static NSString *const CPTAnimationOperationKey = @"CPTAnimationOperationKey"; -static NSString *const CPTAnimationValueKey = @"CPTAnimationValueKey"; -static NSString *const CPTAnimationStartedKey = @"CPTAnimationStartedKey"; -static NSString *const CPTAnimationFinishedKey = @"CPTAnimationFinishedKey"; +static NSString *const CPTAnimationOperationKey = @"CPTAnimationOperationKey"; +static NSString *const CPTAnimationValueKey = @"CPTAnimationValueKey"; +static NSString *const CPTAnimationValueClassKey = @"CPTAnimationValueClassKey"; +static NSString *const CPTAnimationStartedKey = @"CPTAnimationStartedKey"; +static NSString *const CPTAnimationFinishedKey = @"CPTAnimationFinishedKey"; /// @cond -typedef NSMutableArray *CPTMutableAnimationArray; +typedef NSMutableArray CPTMutableAnimationArray; @interface CPTAnimation() @property (nonatomic, readwrite, assign) CGFloat timeOffset; -@property (nonatomic, readwrite, strong, nonnull) CPTMutableAnimationArray animationOperations; -@property (nonatomic, readwrite, strong, nonnull) CPTMutableAnimationArray runningAnimationOperations; -@property (nonatomic, readwrite) dispatch_source_t timer; -@property (nonatomic, readwrite) dispatch_queue_t animationQueue; +@property (nonatomic, readwrite, strong, nonnull) CPTMutableAnimationArray *animationOperations; +@property (nonatomic, readwrite, strong, nonnull) CPTMutableAnimationArray *runningAnimationOperations; +@property (nonatomic, readwrite, nullable) dispatch_source_t timer; +@property (nonatomic, readwrite, nonnull) dispatch_queue_t animationQueue; +(nonnull SEL)setterFromProperty:(nonnull NSString *)property; --(CPTAnimationTimingFunction)timingFunctionForAnimationCurve:(CPTAnimationCurve)animationCurve; --(void)updateOnMainThreadWithParameters:(nonnull CPTDictionary)parameters; +-(nullable CPTAnimationTimingFunction)timingFunctionForAnimationCurve:(CPTAnimationCurve)animationCurve; +-(void)updateOnMainThreadWithParameters:(nonnull CPTDictionary *)parameters; -(void)startTimer; -(void)cancelTimer; -(void)update; -dispatch_source_t CPTCreateDispatchTimer(CGFloat interval, dispatch_queue_t queue, dispatch_block_t block); - @end /// @endcond @@ -61,20 +61,20 @@ @implementation CPTAnimation @synthesize defaultAnimationCurve; /** @internal - * @property CPTMutableAnimationArray animationOperations + * @property nonnull CPTMutableAnimationArray *animationOperations * * @brief The list of animation operations currently running or waiting to run. **/ @synthesize animationOperations; /** @internal - * @property CPTMutableAnimationArray runningAnimationOperations + * @property nonnull CPTMutableAnimationArray *runningAnimationOperations * @brief The list of running animation operations. **/ @synthesize runningAnimationOperations; /** @internal - * @property dispatch_source_t timer + * @property nullable dispatch_source_t timer * @brief The animation timer. Each tick of the timer corresponds to one animation frame. **/ @synthesize timer; @@ -82,7 +82,7 @@ @implementation CPTAnimation #pragma mark - Init/Dealloc /** @internal - * @property dispatch_queue_t animationQueue; + * @property nonnull dispatch_queue_t animationQueue; * @brief The serial dispatch queue used to synchronize animation updates. **/ @synthesize animationQueue; @@ -98,9 +98,9 @@ @implementation CPTAnimation * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { animationOperations = [[NSMutableArray alloc] init]; runningAnimationOperations = [[NSMutableArray alloc] init]; timer = NULL; @@ -141,7 +141,7 @@ -(void)dealloc /** @brief A shared CPTAnimation instance responsible for scheduling and executing animations. * @return The shared CPTAnimation instance. **/ -+(instancetype)sharedInstance ++(nonnull instancetype)sharedInstance { static dispatch_once_t once = 0; static CPTAnimation *shared; @@ -163,19 +163,16 @@ +(instancetype)sharedInstance * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property period:(CPTAnimationPeriod *)period animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property period:(nonnull CPTAnimationPeriod *)period animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { - CPTAnimationOperation *animationOperation = [[CPTAnimationOperation alloc] init]; + CPTAnimationOperation *animationOperation = + [[CPTAnimationOperation alloc] initWithAnimationPeriod:period + animationCurve:animationCurve + object:object + getter:NSSelectorFromString(property) + setter:[CPTAnimation setterFromProperty:property]]; - animationOperation.period = period; - animationOperation.animationCurve = animationCurve; - animationOperation.delegate = delegate; - - if ( object ) { - animationOperation.boundObject = object; - animationOperation.boundGetter = NSSelectorFromString(property); - animationOperation.boundSetter = [CPTAnimation setterFromProperty:property]; - } + animationOperation.delegate = delegate; [[CPTAnimation sharedInstance] addAnimationOperation:animationOperation]; @@ -184,10 +181,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property perio /// @cond -+(SEL)setterFromProperty:(NSString *)property ++(nonnull SEL)setterFromProperty:(nonnull NSString *)property { return NSSelectorFromString([NSString stringWithFormat:@"set%@:", [property stringByReplacingCharactersInRange:NSMakeRange(0, 1) - withString:[[property substringToIndex:1] capitalizedString]]]); + withString:[property substringToIndex:1].capitalizedString]]); } /// @endcond @@ -198,12 +195,12 @@ +(SEL)setterFromProperty:(NSString *)property * @param animationOperation The animation operation to add. * @return The queued animation operation. **/ --(CPTAnimationOperation *)addAnimationOperation:(CPTAnimationOperation *)animationOperation +-(CPTAnimationOperation *)addAnimationOperation:(nonnull CPTAnimationOperation *)animationOperation { id boundObject = animationOperation.boundObject; CPTAnimationPeriod *period = animationOperation.period; - if ( animationOperation.delegate || (boundObject && period && ![period.startValue isEqual:period.endValue]) ) { + if ( animationOperation.delegate || (boundObject && period && ![period.startValue isEqual:period.endValue])) { dispatch_async(self.animationQueue, ^{ [self.animationOperations addObject:animationOperation]; @@ -218,7 +215,7 @@ -(CPTAnimationOperation *)addAnimationOperation:(CPTAnimationOperation *)animati /** @brief Removes an animation operation from the animation queue. * @param animationOperation The animation operation to remove. **/ --(void)removeAnimationOperation:(CPTAnimationOperation *)animationOperation +-(void)removeAnimationOperation:(nullable CPTAnimationOperation *)animationOperation { if ( animationOperation ) { dispatch_async(self.animationQueue, ^{ @@ -244,10 +241,10 @@ -(void)removeAllAnimationOperations * @param identifier An animation operation identifier. * @return The animation operation with the given identifier or @nil if it was not found. **/ --(CPTAnimationOperation *)operationWithIdentifier:(id)identifier +-(nullable CPTAnimationOperation *)operationWithIdentifier:(nullable id)identifier { for ( CPTAnimationOperation *operation in self.animationOperations ) { - if ( [[operation identifier] isEqual:identifier] ) { + if ( [operation.identifier isEqual:identifier] ) { return operation; } } @@ -262,12 +259,12 @@ -(void)update { self.timeOffset += kCPTAnimationFrameRate; - CPTMutableAnimationArray theAnimationOperations = self.animationOperations; - CPTMutableAnimationArray runningOperations = self.runningAnimationOperations; - CPTMutableAnimationArray expiredOperations = [[NSMutableArray alloc] init]; + CPTMutableAnimationArray *theAnimationOperations = self.animationOperations; + CPTMutableAnimationArray *runningOperations = self.runningAnimationOperations; + CPTMutableAnimationArray *expiredOperations = [[NSMutableArray alloc] init]; - CGFloat currentTime = self.timeOffset; - CPTStringArray runModes = @[NSRunLoopCommonModes]; + CGFloat currentTime = self.timeOffset; + CPTStringArray *runModes = @[NSRunLoopCommonModes]; dispatch_queue_t mainQueue = dispatch_get_main_queue(); @@ -280,13 +277,13 @@ -(void)update CGFloat duration = period.duration; CGFloat startTime = period.startOffset; CGFloat delay = period.delay; - if ( isnan(delay) ) { + if ( isnan(delay)) { if ( [period canStartWithValueFromObject:animationOperation.boundObject propertyGetter:animationOperation.boundGetter] ) { period.delay = currentTime - startTime; startTime = currentTime; } else { - startTime = CPTFloat(NAN); + startTime = CPTNAN; } } else { @@ -318,7 +315,7 @@ -(void)update for ( CPTAnimationOperation *operation in runningOperations ) { if ( operation.boundObject == boundObject ) { - if ( (operation.boundGetter == boundGetter) && (operation.boundSetter == boundSetter) ) { + if ((operation.boundGetter == boundGetter) && (operation.boundSetter == boundSetter)) { operation.canceled = YES; } } @@ -333,13 +330,15 @@ -(void)update [period setStartValueFromObject:animationOperation.boundObject propertyGetter:animationOperation.boundGetter]; } + Class valueClass = period.valueClass; CGFloat progress = timingFunction(currentTime - startTime, duration); - CPTDictionary parameters = @{ - CPTAnimationOperationKey: animationOperation, - CPTAnimationValueKey: [period tweenedValueForProgress:progress], - CPTAnimationStartedKey: @(started), - CPTAnimationFinishedKey: @(currentTime >= endTime) + CPTDictionary *parameters = @{ + CPTAnimationOperationKey: animationOperation, + CPTAnimationValueKey: [period tweenedValueForProgress:progress], + CPTAnimationValueClassKey: valueClass ? valueClass : [NSNull null], + CPTAnimationStartedKey: @(started), + CPTAnimationFinishedKey: @(currentTime >= endTime) }; // Used -performSelectorOnMainThread:... instead of GCD to ensure the animation continues to run in all run loop common modes. @@ -367,7 +366,7 @@ -(void)update } // This method must be called from the main thread. --(void)updateOnMainThreadWithParameters:(CPTDictionary)parameters +-(void)updateOnMainThreadWithParameters:(nonnull CPTDictionary *)parameters { CPTAnimationOperation *animationOperation = parameters[CPTAnimationOperationKey]; @@ -379,6 +378,11 @@ -(void)updateOnMainThreadWithParameters:(CPTDictionary)parameters if ( !canceled ) { @try { + Class valueClass = parameters[CPTAnimationValueClassKey]; + if ( [valueClass isKindOfClass:[NSNull class]] ) { + valueClass = Nil; + } + id delegate = animationOperation.delegate; NSNumber *started = parameters[CPTAnimationStartedKey]; @@ -396,37 +400,45 @@ -(void)updateOnMainThreadWithParameters:(CPTDictionary)parameters id boundObject = animationOperation.boundObject; id tweenedValue = parameters[CPTAnimationValueKey]; - if ( [tweenedValue isKindOfClass:[NSDecimalNumber class]] ) { - NSDecimal buffer = [(NSDecimalNumber *)tweenedValue decimalValue]; + if ( !valueClass && [tweenedValue isKindOfClass:[NSDecimalNumber class]] ) { + NSDecimal buffer = ((NSDecimalNumber *)tweenedValue).decimalValue; typedef void (*SetterType)(id, SEL, NSDecimal); - SetterType setterMethod = (SetterType)[boundObject methodForSelector : boundSetter]; + SetterType setterMethod = (SetterType)[boundObject methodForSelector:boundSetter]; setterMethod(boundObject, boundSetter, buffer); } - else if ( [tweenedValue isKindOfClass:[NSValue class]] ) { + else if ( valueClass && [tweenedValue isKindOfClass:[NSNumber class]] ) { + NSNumber *value = (NSNumber *)tweenedValue; + + typedef void (*NumberSetterType)(id, SEL, NSNumber *); + NumberSetterType setterMethod = (NumberSetterType)[boundObject methodForSelector:boundSetter]; + setterMethod(boundObject, boundSetter, value); + } + 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; NSUInteger bufferSize = 0; NSGetSizeAndAlignment(value.objCType, &bufferSize, NULL); NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[boundObject methodSignatureForSelector:boundSetter]]; - [invocation setTarget:boundObject]; - [invocation setSelector:boundSetter]; + invocation.target = boundObject; + invocation.selector = boundSetter; - void *buffer = malloc(bufferSize); + void *buffer = calloc(1, bufferSize); [value getValue:buffer]; [invocation setArgument:buffer atIndex:2]; free(buffer); [invocation invoke]; } - else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - id theObject = boundObject; - [theObject performSelector:boundSetter withObject:tweenedValue]; -#pragma clang diagnostic pop - } if ( [delegate respondsToSelector:@selector(animationDidUpdate:)] ) { [delegate animationDidUpdate:animationOperation]; @@ -450,9 +462,17 @@ -(void)updateOnMainThreadWithParameters:(CPTDictionary)parameters -(void)startTimer { - self.timer = CPTCreateDispatchTimer(kCPTAnimationFrameRate, self.animationQueue, ^{ - [self update]; - }); + dispatch_source_t newTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, self.animationQueue); + + if ( newTimer ) { + dispatch_source_set_timer(newTimer, dispatch_time(DISPATCH_TIME_NOW, 0), (uint64_t)(kCPTAnimationFrameRate * NSEC_PER_SEC), 0); + dispatch_source_set_event_handler(newTimer, ^{ + [self update]; + }); + dispatch_resume(newTimer); + + self.timer = newTimer; + } } -(void)cancelTimer @@ -465,25 +485,13 @@ -(void)cancelTimer } } -dispatch_source_t CPTCreateDispatchTimer(CGFloat interval, dispatch_queue_t queue, dispatch_block_t block) -{ - dispatch_source_t newTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, queue); - - if ( newTimer ) { - dispatch_source_set_timer(newTimer, dispatch_time(DISPATCH_TIME_NOW, 0), (uint64_t)(interval * NSEC_PER_SEC), 0); - dispatch_source_set_event_handler(newTimer, block); - dispatch_resume(newTimer); - } - return newTimer; -} - /// @endcond #pragma mark - Timing Functions /// @cond --(CPTAnimationTimingFunction)timingFunctionForAnimationCurve:(CPTAnimationCurve)animationCurve +-(nullable CPTAnimationTimingFunction)timingFunctionForAnimationCurve:(CPTAnimationCurve)animationCurve { CPTAnimationTimingFunction timingFunction; @@ -630,11 +638,11 @@ -(CPTAnimationTimingFunction)timingFunctionForAnimationCurve:(CPTAnimationCurve) /// @cond --(NSString *)description +-(nullable NSString *)description { return [NSString stringWithFormat:@"<%@ timeOffset: %g; %lu active and %lu running operations>", - [super description], - self.timeOffset, + super.description, + (double)self.timeOffset, (unsigned long)self.animationOperations.count, (unsigned long)self.runningAnimationOperations.count]; } diff --git a/framework/Source/CPTAnimationOperation.h b/framework/Source/CPTAnimationOperation.h index 779f1940b..b179bf210 100644 --- a/framework/Source/CPTAnimationOperation.h +++ b/framework/Source/CPTAnimationOperation.h @@ -20,7 +20,7 @@ /// @name Delegate /// @{ -@property (nonatomic, cpt_weak_property, nullable) cpt_weak id delegate; +@property (nonatomic, cpt_weak_property, nullable) id delegate; /// @} /// @name Status @@ -34,4 +34,9 @@ @property (nonatomic, readwrite, copy, nullable) NSDictionary *userInfo; /// @} +/// @name Initialization +/// @{ +-(nonnull instancetype)initWithAnimationPeriod:(nonnull CPTAnimationPeriod *)animationPeriod animationCurve:(CPTAnimationCurve)curve object:(nonnull id)object getter:(nonnull SEL)getter setter:(nonnull SEL)setter NS_DESIGNATED_INITIALIZER; +/// @} + @end diff --git a/framework/Source/CPTAnimationOperation.m b/framework/Source/CPTAnimationOperation.m index f99b29b43..e7047abc5 100644 --- a/framework/Source/CPTAnimationOperation.m +++ b/framework/Source/CPTAnimationOperation.m @@ -6,7 +6,7 @@ **/ @implementation CPTAnimationOperation -/** @property CPTAnimationPeriod *period +/** @property nonnull CPTAnimationPeriod *period * @brief The start value, end value, and duration of this animation operation. **/ @synthesize period; @@ -16,7 +16,7 @@ @implementation CPTAnimationOperation **/ @synthesize animationCurve; -/** @property id boundObject +/** @property nonnull id boundObject * @brief The object to update for each animation frame. **/ @synthesize boundObject; @@ -31,7 +31,7 @@ @implementation CPTAnimationOperation **/ @synthesize boundSetter; -/** @property cpt_weak iddelegate +/** @property nullable iddelegate * @brief The animation delegate. **/ @synthesize delegate; @@ -41,12 +41,12 @@ @implementation CPTAnimationOperation **/ @synthesize canceled; -/** @property id identifier - * @brief An object used to identify the layer in collections. +/** @property nullable id identifier + * @brief An object used to identify the animation operation in collections. **/ @synthesize identifier; -/** @property NSDictionary *userInfo +/** @property nullable NSDictionary *userInfo * @brief Application-specific user info that can be attached to the operation. **/ @synthesize userInfo; @@ -57,26 +57,32 @@ @implementation CPTAnimationOperation /** @brief Initializes a newly allocated CPTAnimationOperation object. * * This is the designated initializer. The initialized object will have the following properties: - * - @ref period = @nil - * - @ref animationCurve = #CPTAnimationCurveDefault - * - @ref boundObject = @nil - * - @ref boundGetter = @NULL - * - @ref boundSetter = @NULL + * - @ref period = @par{animationPeriod} + * - @ref animationCurve = @par{curve} + * - @ref boundObject = @par{object} + * - @ref boundGetter = @par{getter} + * - @ref boundSetter = @par{setter} * - @ref delegate = @nil * - @ref canceled = @NO * - @ref identifier = @nil * - @ref userInfo = @nil * + * @param animationPeriod The animation period. + * @param curve The animation curve. + * @param object The object to update for each animation frame. + * @param getter The @ref boundObject getter method for the property to update for each animation frame. + * @param setter The @ref boundObject setter method for the property to update for each animation frame. + * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)initWithAnimationPeriod:(nonnull CPTAnimationPeriod *)animationPeriod animationCurve:(CPTAnimationCurve)curve object:(nonnull id)object getter:(nonnull SEL)getter setter:(nonnull SEL)setter { - if ( (self = [super init]) ) { - period = nil; - animationCurve = CPTAnimationCurveDefault; - boundObject = nil; - boundGetter = NULL; - boundSetter = NULL; + if ((self = [super init])) { + period = animationPeriod; + animationCurve = curve; + boundObject = object; + boundGetter = getter; + boundSetter = setter; delegate = nil; canceled = NO; identifier = nil; @@ -88,14 +94,29 @@ -(instancetype)init /// @} +/// @cond + +-(nonnull instancetype)init +{ + NSAssert(NO, @"Must call -initWithAnimationPeriod:animationCurve:object:getter:setter: to initialize a CPTAnimationOperation."); + + return [self initWithAnimationPeriod:[[CPTAnimationPeriod alloc] init] + animationCurve:CPTAnimationCurveDefault + object:[[NSObject alloc] init] + getter:@selector(init) + setter:@selector(init)]; +} + +/// @endcond + #pragma mark - #pragma mark Description /// @cond --(NSString *)description +-(nullable NSString *)description { - return [NSString stringWithFormat:@"<%@ animate %@ %@ with period %@>", [super description], self.boundObject, NSStringFromSelector(self.boundGetter), self.period]; + return [NSString stringWithFormat:@"<%@ animate %@ %@ with period %@>", super.description, self.boundObject, NSStringFromSelector(self.boundGetter), self.period]; } /// @endcond diff --git a/framework/Source/CPTAnimationPeriod.h b/framework/Source/CPTAnimationPeriod.h index f0700e2c8..cfd21ac63 100644 --- a/framework/Source/CPTAnimationPeriod.h +++ b/framework/Source/CPTAnimationPeriod.h @@ -7,8 +7,9 @@ /// @name Timing Values /// @{ -@property (nonatomic, readwrite, copy, nonnull) NSValue *startValue; -@property (nonatomic, readwrite, copy, nonnull) NSValue *endValue; +@property (nonatomic, readwrite, copy, nullable) NSValue *startValue; +@property (nonatomic, readwrite, copy, nullable) NSValue *endValue; +@property (nonatomic, readonly, nullable) Class valueClass; @property (nonatomic, readwrite) CGFloat duration; @property (nonatomic, readwrite) CGFloat delay; @property (nonatomic, readonly) CGFloat startOffset; @@ -21,6 +22,7 @@ +(nonnull instancetype)periodWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; +(nonnull instancetype)periodWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; +(nonnull instancetype)periodWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecimal)anEndDecimal duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; ++(nonnull instancetype)periodWithStartNumber:(nullable NSNumber *)aStartNumber endNumber:(nonnull NSNumber *)anEndNumber duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; +(nonnull instancetype)periodWithStartPlotRange:(nonnull CPTPlotRange *)aStartPlotRange endPlotRange:(nonnull CPTPlotRange *)anEndPlotRange duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; /// @} @@ -31,6 +33,7 @@ -(nonnull instancetype)initWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; -(nonnull instancetype)initWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; -(nonnull instancetype)initWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecimal)anEndDecimal duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; +-(nonnull instancetype)initWithStartNumber:(nullable NSNumber *)aStartNumber endNumber:(nonnull NSNumber *)anEndNumber duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; -(nonnull instancetype)initWithStartPlotRange:(nonnull CPTPlotRange *)aStartPlotRange endPlotRange:(nonnull CPTPlotRange *)anEndPlotRange duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; /// @} @@ -99,6 +102,13 @@ +(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration; /// @} +/// @name NSNumber Property Animation +/// @{ ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromNumber:(nullable NSNumber *)from toNumber:(nonnull NSNumber *)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate; ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromNumber:(nullable NSNumber *)from toNumber:(nonnull NSNumber *)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate; ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromNumber:(nullable NSNumber *)from toNumber:(nonnull NSNumber *)to duration:(CGFloat)duration; +/// @} + /// @name CPTPlotRange Property Animation /// @{ +(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromPlotRange:(nonnull CPTPlotRange *)from toPlotRange:(nonnull CPTPlotRange *)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate; diff --git a/framework/Source/CPTAnimationPeriod.m b/framework/Source/CPTAnimationPeriod.m index fd94a212c..3d781b79c 100644 --- a/framework/Source/CPTAnimationPeriod.m +++ b/framework/Source/CPTAnimationPeriod.m @@ -1,21 +1,22 @@ #import "CPTAnimationPeriod.h" -#import "CPTAnimationOperation.h" -#import "CPTPlotRange.h" -#import "NSNumberExtensions.h" #import "_CPTAnimationCGFloatPeriod.h" #import "_CPTAnimationCGPointPeriod.h" #import "_CPTAnimationCGRectPeriod.h" #import "_CPTAnimationCGSizePeriod.h" #import "_CPTAnimationNSDecimalPeriod.h" +#import "_CPTAnimationNSNumberPeriod.h" #import "_CPTAnimationPlotRangePeriod.h" +#import "CPTAnimationOperation.h" +#import "CPTPlotRange.h" +#import "NSNumberExtensions.h" /// @cond @interface CPTAnimationPeriod() -+(instancetype)periodWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anEndValue duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; ++(nonnull instancetype)periodWithStartValue:(nullable NSValue *)aStartValue endValue:(nullable NSValue *)anEndValue ofClass:(nullable Class)class duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; --(instancetype)initWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anEndValue duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; +-(nonnull instancetype)initWithStartValue:(nullable NSValue *)aStartValue endValue:(nullable NSValue *)anEndValue ofClass:(nullable Class)class duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay; @property (nonatomic, readwrite) CGFloat startOffset; @@ -33,23 +34,29 @@ -(instancetype)initWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anE * - @ref CGSize * - @ref CGRect * - @ref NSDecimal + * - @ref NSNumber * - @ref CPTPlotRange (NSValue wrapper not used) * @note The starting and ending values must be the same type. **/ @implementation CPTAnimationPeriod -/** @property NSValue *startValue +/** @property nullable NSValue *startValue * @brief The starting value of the animation. * * If @nil or the encoded value is @NAN, the animation starts from the current value of the animated property. **/ @synthesize startValue; -/** @property NSValue *endValue +/** @property nullable NSValue *endValue * @brief The ending value of the animation. **/ @synthesize endValue; +/** @property Class valueClass + * @brief The Objective-C class of the animated object. If @nil, the value is a scalar or struct wrapped in an NSValue object. + **/ +@synthesize valueClass; + /** @property CGFloat duration * @brief The duration of the animation, in seconds. **/ @@ -75,13 +82,14 @@ @implementation CPTAnimationPeriod * @brief Creates and returns a new CPTAnimationPeriod instance initialized with the provided start and end values and duration. * @param aStartValue The starting value. If @nil, the animation starts from the current value of the animated property. * @param anEndValue The ending value. + * @param class The Objective-C class of the animated object. If @Nil, the value is a scalar or struct wrapped in an NSValue object. * @param aDuration The animation duration in seconds. * @param aDelay The starting delay in seconds. * @return The initialized object. **/ -+(instancetype)periodWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anEndValue duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay ++(instancetype)periodWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anEndValue ofClass:(Class)class duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { - return [[self alloc] initWithStartValue:aStartValue endValue:anEndValue duration:aDuration withDelay:aDelay]; + return [[self alloc] initWithStartValue:aStartValue endValue:anEndValue ofClass:class duration:aDuration withDelay:aDelay]; } /// @endcond @@ -94,12 +102,13 @@ +(instancetype)periodWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)a * @param aDelay The starting delay in seconds. * @return The initialized object. **/ -+(instancetype)periodWithStart:(CGFloat)aStart end:(CGFloat)anEnd duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay ++(nonnull instancetype)periodWithStart:(CGFloat)aStart end:(CGFloat)anEnd duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSNumber *start = isnan(aStart) ? nil : @(aStart); return [_CPTAnimationCGFloatPeriod periodWithStartValue:start endValue:@(anEnd) + ofClass:Nil duration:aDuration withDelay:aDelay]; } @@ -112,16 +121,17 @@ +(instancetype)periodWithStart:(CGFloat)aStart end:(CGFloat)anEnd duration:(CGFl * @param aDelay The starting delay in seconds. * @return The initialized object. **/ -+(instancetype)periodWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint)anEndPoint duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay ++(nonnull instancetype)periodWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint)anEndPoint duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSValue *start = nil; - if ( !isnan(aStartPoint.x) && !isnan(aStartPoint.y) ) { + if ( !isnan(aStartPoint.x) && !isnan(aStartPoint.y)) { start = [NSValue valueWithBytes:&aStartPoint objCType:@encode(CGPoint)]; } return [_CPTAnimationCGPointPeriod periodWithStartValue:start endValue:[NSValue valueWithBytes:&anEndPoint objCType:@encode(CGPoint)] + ofClass:Nil duration:aDuration withDelay:aDelay]; } @@ -134,16 +144,17 @@ +(instancetype)periodWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint)anEnd * @param aDelay The starting delay in seconds. * @return The initialized object. **/ -+(instancetype)periodWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay ++(nonnull instancetype)periodWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSValue *start = nil; - if ( !isnan(aStartSize.width) && !isnan(aStartSize.height) ) { + if ( !isnan(aStartSize.width) && !isnan(aStartSize.height)) { start = [NSValue valueWithBytes:&aStartSize objCType:@encode(CGSize)]; } return [_CPTAnimationCGSizePeriod periodWithStartValue:start endValue:[NSValue valueWithBytes:&anEndSize objCType:@encode(CGSize)] + ofClass:Nil duration:aDuration withDelay:aDelay]; } @@ -156,16 +167,17 @@ +(instancetype)periodWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize * @param aDelay The starting delay in seconds. * @return The initialized object. **/ -+(instancetype)periodWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay ++(nonnull instancetype)periodWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSValue *start = nil; - if ( !CGRectEqualToRect(aStartRect, CGRectNull) && !isnan(aStartRect.origin.x) && !isnan(aStartRect.origin.y) && !isnan(aStartRect.size.width) && !isnan(aStartRect.size.height) ) { + if ( !CGRectEqualToRect(aStartRect, CGRectNull) && !isnan(aStartRect.origin.x) && !isnan(aStartRect.origin.y) && !isnan(aStartRect.size.width) && !isnan(aStartRect.size.height)) { start = [NSValue valueWithBytes:&aStartRect objCType:@encode(CGRect)]; } return [_CPTAnimationCGRectPeriod periodWithStartValue:start endValue:[NSValue valueWithBytes:&anEndRect objCType:@encode(CGRect)] + ofClass:Nil duration:aDuration withDelay:aDelay]; } @@ -178,16 +190,34 @@ +(instancetype)periodWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect * @param aDelay The starting delay in seconds. * @return The initialized object. **/ -+(instancetype)periodWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecimal)anEndDecimal duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay ++(nonnull instancetype)periodWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecimal)anEndDecimal duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSDecimalNumber *start = NSDecimalIsNotANumber(&aStartDecimal) ? nil : [NSDecimalNumber decimalNumberWithDecimal:aStartDecimal]; return [_CPTAnimationNSDecimalPeriod periodWithStartValue:start endValue:[NSDecimalNumber decimalNumberWithDecimal:anEndDecimal] + ofClass:Nil duration:aDuration withDelay:aDelay]; } +/** + * @brief Creates and returns a new CPTAnimationPeriod instance initialized with the provided start and end values and duration. + * @param aStartNumber The starting value. If @NAN or @nil, the animation starts from the current value of the animated property. + * @param anEndNumber The ending value. + * @param aDuration The animation duration in seconds. + * @param aDelay The starting delay in seconds. + * @return The initialized object. + **/ ++(nonnull instancetype)periodWithStartNumber:(nullable NSNumber *)aStartNumber endNumber:(nonnull NSNumber *)anEndNumber duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +{ + return [_CPTAnimationNSNumberPeriod periodWithStartValue:aStartNumber + endValue:anEndNumber + ofClass:[NSNumber class] + duration:aDuration + withDelay:aDelay]; +} + /** * @brief Creates and returns a new CPTAnimationPeriod instance initialized with the provided start and end plot ranges and duration. * @param aStartPlotRange The starting plot range. If @nil or any component of the range is @NAN, the animation starts from the current value of the animated property. @@ -196,14 +226,17 @@ +(instancetype)periodWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDec * @param aDelay The starting delay in seconds. * @return The initialized object. **/ -+(instancetype)periodWithStartPlotRange:(CPTPlotRange *)aStartPlotRange endPlotRange:(CPTPlotRange *)anEndPlotRange duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay ++(nonnull instancetype)periodWithStartPlotRange:(nonnull CPTPlotRange *)aStartPlotRange endPlotRange:(nonnull CPTPlotRange *)anEndPlotRange duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { - if ( isnan(aStartPlotRange.locationDouble) || isnan(aStartPlotRange.lengthDouble) ) { - aStartPlotRange = nil; + CPTPlotRange *startRange = aStartPlotRange; + + if ( isnan(aStartPlotRange.locationDouble) || isnan(aStartPlotRange.lengthDouble)) { + startRange = nil; } - return [_CPTAnimationPlotRangePeriod periodWithStartValue:(NSValue *)aStartPlotRange + return [_CPTAnimationPlotRangePeriod periodWithStartValue:(NSValue *)startRange endValue:(NSValue *)anEndPlotRange + ofClass:[CPTPlotRange class] duration:aDuration withDelay:aDelay]; } @@ -216,21 +249,24 @@ +(instancetype)periodWithStartPlotRange:(CPTPlotRange *)aStartPlotRange endPlotR * This is the designated initializer. The initialized object will have the following properties: * - @ref startValue = @par{aStartValue} * - @ref endValue = @par{anEndValue} + * - @ref class = @par{class} * - @ref duration = @par{aDuration} * - @ref delay = @par{aDelay} * - @ref startOffset = The animation time clock offset when this method is called. * * @param aStartValue The starting value. If @nil, the animation starts from the current value of the animated property. * @param anEndValue The ending value. + * @param class The Objective-C class of the animated object. If @Nil, the value is a scalar or struct wrapped in an NSValue object. * @param aDuration The animation duration in seconds. * @param aDelay The starting delay in seconds. * @return The initialized object. **/ --(instancetype)initWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anEndValue duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +-(instancetype)initWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anEndValue ofClass:(Class)class duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { - if ( (self = [super init]) ) { + if ((self = [super init])) { startValue = [aStartValue copy]; endValue = [anEndValue copy]; + valueClass = class; duration = aDuration; delay = aDelay; startOffset = [CPTAnimation sharedInstance].timeOffset; @@ -249,12 +285,13 @@ -(instancetype)initWithStartValue:(NSValue *)aStartValue endValue:(NSValue *)anE * @param aDelay The starting delay in seconds. * @return The initialized object. **/ --(instancetype)initWithStart:(CGFloat)aStart end:(CGFloat)anEnd duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +-(nonnull instancetype)initWithStart:(CGFloat)aStart end:(CGFloat)anEnd duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSNumber *start = isnan(aStart) ? nil : @(aStart); self = [[_CPTAnimationCGFloatPeriod alloc] initWithStartValue:start endValue:@(anEnd) + ofClass:Nil duration:aDuration withDelay:aDelay]; @@ -269,16 +306,17 @@ -(instancetype)initWithStart:(CGFloat)aStart end:(CGFloat)anEnd duration:(CGFloa * @param aDelay The starting delay in seconds. * @return The initialized object. **/ --(instancetype)initWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint)anEndPoint duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +-(nonnull instancetype)initWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint)anEndPoint duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSValue *start = nil; - if ( !isnan(aStartPoint.x) && !isnan(aStartPoint.y) ) { + if ( !isnan(aStartPoint.x) && !isnan(aStartPoint.y)) { start = [NSValue valueWithBytes:&aStartPoint objCType:@encode(CGPoint)]; } self = [[_CPTAnimationCGPointPeriod alloc] initWithStartValue:start endValue:[NSValue valueWithBytes:&anEndPoint objCType:@encode(CGPoint)] + ofClass:Nil duration:aDuration withDelay:aDelay]; @@ -293,16 +331,17 @@ -(instancetype)initWithStartPoint:(CGPoint)aStartPoint endPoint:(CGPoint)anEndPo * @param aDelay The starting delay in seconds. * @return The initialized object. **/ --(instancetype)initWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +-(nonnull instancetype)initWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSValue *start = nil; - if ( !isnan(aStartSize.width) && !isnan(aStartSize.height) ) { + if ( !isnan(aStartSize.width) && !isnan(aStartSize.height)) { start = [NSValue valueWithBytes:&aStartSize objCType:@encode(CGSize)]; } self = [[_CPTAnimationCGSizePeriod alloc] initWithStartValue:start endValue:[NSValue valueWithBytes:&anEndSize objCType:@encode(CGSize)] + ofClass:Nil duration:aDuration withDelay:aDelay]; @@ -317,16 +356,17 @@ -(instancetype)initWithStartSize:(CGSize)aStartSize endSize:(CGSize)anEndSize du * @param aDelay The starting delay in seconds. * @return The initialized object. **/ --(instancetype)initWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +-(nonnull instancetype)initWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSValue *start = nil; - if ( !CGRectEqualToRect(aStartRect, CGRectNull) && !isnan(aStartRect.origin.x) && !isnan(aStartRect.origin.y) && !isnan(aStartRect.size.width) && !isnan(aStartRect.size.height) ) { + if ( !CGRectEqualToRect(aStartRect, CGRectNull) && !isnan(aStartRect.origin.x) && !isnan(aStartRect.origin.y) && !isnan(aStartRect.size.width) && !isnan(aStartRect.size.height)) { start = [NSValue valueWithBytes:&aStartRect objCType:@encode(CGRect)]; } self = [[_CPTAnimationCGRectPeriod alloc] initWithStartValue:start endValue:[NSValue valueWithBytes:&anEndRect objCType:@encode(CGRect)] + ofClass:Nil duration:aDuration withDelay:aDelay]; @@ -341,18 +381,38 @@ -(instancetype)initWithStartRect:(CGRect)aStartRect endRect:(CGRect)anEndRect du * @param aDelay The starting delay in seconds. * @return The initialized object. **/ --(instancetype)initWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecimal)anEndDecimal duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +-(nonnull instancetype)initWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecimal)anEndDecimal duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { NSDecimalNumber *start = NSDecimalIsNotANumber(&aStartDecimal) ? nil : [NSDecimalNumber decimalNumberWithDecimal:aStartDecimal]; self = [[_CPTAnimationNSDecimalPeriod alloc] initWithStartValue:start endValue:[NSDecimalNumber decimalNumberWithDecimal:anEndDecimal] + ofClass:Nil duration:aDuration withDelay:aDelay]; return self; } +/** + * @brief Initializes a newly allocated CPTAnimationPeriod object with the provided start and end values and duration. + * @param aStartNumber The starting value. If @NAN or @nil, the animation starts from the current value of the animated property. + * @param anEndNumber The ending value. + * @param aDuration The animation duration in seconds. + * @param aDelay The starting delay in seconds. + * @return The initialized object. + **/ +-(nonnull instancetype)initWithStartNumber:(nullable NSNumber *)aStartNumber endNumber:(nonnull NSNumber *)anEndNumber duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +{ + self = [[_CPTAnimationNSNumberPeriod alloc] initWithStartValue:aStartNumber + endValue:anEndNumber + ofClass:[NSNumber class] + duration:aDuration + withDelay:aDelay]; + + return self; +} + /** * @brief Initializes a newly allocated CPTAnimationPeriod object with the provided start and end plot ranges and duration. * @param aStartPlotRange The starting plot range. If @nil or any component of the range is @NAN, the animation starts from the current value of the animated property. @@ -361,14 +421,17 @@ -(instancetype)initWithStartDecimal:(NSDecimal)aStartDecimal endDecimal:(NSDecim * @param aDelay The starting delay in seconds. * @return The initialized object. **/ --(instancetype)initWithStartPlotRange:(CPTPlotRange *)aStartPlotRange endPlotRange:(CPTPlotRange *)anEndPlotRange duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay +-(nonnull instancetype)initWithStartPlotRange:(nonnull CPTPlotRange *)aStartPlotRange endPlotRange:(nonnull CPTPlotRange *)anEndPlotRange duration:(CGFloat)aDuration withDelay:(CGFloat)aDelay { - if ( isnan(aStartPlotRange.locationDouble) || isnan(aStartPlotRange.lengthDouble) ) { - aStartPlotRange = nil; + CPTPlotRange *startRange = aStartPlotRange; + + if ( isnan(aStartPlotRange.locationDouble) || isnan(aStartPlotRange.lengthDouble)) { + startRange = nil; } - self = [[_CPTAnimationPlotRangePeriod alloc] initWithStartValue:(NSValue *)aStartPlotRange + self = [[_CPTAnimationPlotRangePeriod alloc] initWithStartValue:(NSValue *)startRange endValue:(NSValue *)anEndPlotRange + ofClass:[CPTPlotRange class] duration:aDuration withDelay:aDelay]; @@ -380,9 +443,9 @@ -(instancetype)initWithStartPlotRange:(CPTPlotRange *)aStartPlotRange endPlotRan /** @brief Initializes a newly allocated CPTAnimationPeriod object with no start or end values and a @par{duration} and @par{delay} of zero (@num{0}). * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - return [self initWithStartValue:nil endValue:nil duration:CPTFloat(0.0) withDelay:CPTFloat(0.0)]; + return [self initWithStartValue:nil endValue:@0.0 ofClass:Nil duration:CPTFloat(0.0) withDelay:CPTFloat(0.0)]; } /// @endcond @@ -395,7 +458,7 @@ -(instancetype)init * @param boundObject The object to update for each animation frame. * @param boundGetter The getter method for the property to update. **/ --(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(void)setStartValueFromObject:(nonnull id __unused)boundObject propertyGetter:(nonnull SEL __unused)boundGetter { [NSException raise:NSGenericException format:@"The -initializeStartValue method must be implemented by CPTAnimationPeriod subclasses."]; @@ -409,7 +472,7 @@ -(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter * @param progress The fraction of the animation progress. * @return The computed value. **/ --(NSValue *)tweenedValueForProgress:(CGFloat)progress +-(nonnull NSValue *)tweenedValueForProgress:(CGFloat __unused)progress { [NSException raise:NSGenericException format:@"The -tweenedValueForProgress: method must be implemented by CPTAnimationPeriod subclasses."]; @@ -422,7 +485,7 @@ -(NSValue *)tweenedValueForProgress:(CGFloat)progress * @param boundGetter The getter method for the property to update. * @return @YES if the current value of the bound property is between the start and end value. **/ --(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(BOOL)canStartWithValueFromObject:(nonnull id __unused)boundObject propertyGetter:(nonnull SEL __unused)boundGetter { [NSException raise:NSGenericException format:@"The -canStartWithValueFromObject:propertyGetter: method must be implemented by CPTAnimationPeriod subclasses."]; @@ -434,9 +497,9 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett /// @cond --(NSString *)description +-(nullable NSString *)description { - return [NSString stringWithFormat:@"<%@ from: %@; to: %@; duration: %g, delay: %g>", [super description], self.startValue, self.endValue, self.duration, self.delay]; + return [NSString stringWithFormat:@"<%@ from: %@; to: %@; duration: %g, delay: %g>", super.description, self.startValue, self.endValue, (double)self.duration, (double)self.delay]; } /// @endcond @@ -460,7 +523,7 @@ @implementation CPTAnimation(CPTAnimationPeriodAdditions) * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStart:from end:to @@ -468,10 +531,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from: withDelay:delay]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -485,7 +548,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from: * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStart:from end:to @@ -493,10 +556,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from: withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -508,7 +571,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from: * @param duration The duration of the animation. * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property from:(CGFloat)from to:(CGFloat)to duration:(CGFloat)duration { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStart:from end:to @@ -516,10 +579,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from: withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:CPTAnimationCurveDefault - delegate:nil]; + property:property + period:period + animationCurve:CPTAnimationCurveDefault + delegate:nil]; } // CGPoint @@ -535,7 +598,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property from: * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartPoint:from endPoint:to @@ -543,10 +606,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP withDelay:delay]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -560,7 +623,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartPoint:from endPoint:to @@ -568,10 +631,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -583,7 +646,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP * @param duration The duration of the animation. * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromPoint:(CGPoint)from toPoint:(CGPoint)to duration:(CGFloat)duration { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartPoint:from endPoint:to @@ -591,10 +654,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:CPTAnimationCurveDefault - delegate:nil]; + property:property + period:period + animationCurve:CPTAnimationCurveDefault + delegate:nil]; } // CGSize @@ -610,7 +673,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartSize:from endSize:to @@ -618,10 +681,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromS withDelay:delay]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -635,7 +698,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromS * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartSize:from endSize:to @@ -643,10 +706,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromS withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -658,7 +721,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromS * @param duration The duration of the animation. * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromSize:(CGSize)from toSize:(CGSize)to duration:(CGFloat)duration { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartSize:from endSize:to @@ -666,10 +729,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromS withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:CPTAnimationCurveDefault - delegate:nil]; + property:property + period:period + animationCurve:CPTAnimationCurveDefault + delegate:nil]; } // CGRect @@ -685,7 +748,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromS * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartRect:from endRect:to @@ -693,10 +756,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromR withDelay:delay]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -710,7 +773,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromR * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartRect:from endRect:to @@ -718,10 +781,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromR withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -733,7 +796,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromR * @param duration The duration of the animation. * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromRect:(CGRect)from toRect:(CGRect)to duration:(CGFloat)duration { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartRect:from endRect:to @@ -741,10 +804,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromR withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:CPTAnimationCurveDefault - delegate:nil]; + property:property + period:period + animationCurve:CPTAnimationCurveDefault + delegate:nil]; } // NSDecimal @@ -760,7 +823,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromR * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartDecimal:from endDecimal:to @@ -768,10 +831,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromD withDelay:delay]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -785,7 +848,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromD * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartDecimal:from endDecimal:to @@ -793,10 +856,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromD withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -808,7 +871,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromD * @param duration The duration of the animation. * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromDecimal:(NSDecimal)from toDecimal:(NSDecimal)to duration:(CGFloat)duration { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartDecimal:from endDecimal:to @@ -816,10 +879,85 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromD withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:CPTAnimationCurveDefault - delegate:nil]; + property:property + period:period + animationCurve:CPTAnimationCurveDefault + delegate:nil]; +} + +// NSNumber + +/** @brief Creates an animation operation with the given properties and adds it to the animation queue. + * @param object The object to animate. + * @param property The name of the property of @par{object} to animate. The property must have both getter and setter methods. + * @param from The starting value. If @NAN or @nil, the animation starts from the current value of the animated property. + * @param to The ending value. + * @param duration The duration of the animation. + * @param delay The starting delay of the animation in seconds. + * @param animationCurve The animation curve used to animate the new operation. + * @param delegate The animation delegate (can be @nil). + * @return The queued animation operation. + **/ ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromNumber:(nullable NSNumber *)from toNumber:(nonnull NSNumber *)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate +{ + CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartNumber:from + endNumber:to + duration:duration + withDelay:delay]; + + return [self animate:object + property:property + period:period + animationCurve:animationCurve + delegate:delegate + ]; +} + +/** @brief Creates an animation operation with the given properties and adds it to the animation queue. + * @param object The object to animate. + * @param property The name of the property of @par{object} to animate. The property must have both getter and setter methods. + * @param from The starting value. If @NAN or @nil, the animation starts from the current value of the animated property. + * @param to The ending value. + * @param duration The duration of the animation. + * @param animationCurve The animation curve used to animate the new operation. + * @param delegate The animation delegate (can be @nil). + * @return The queued animation operation. + **/ ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromNumber:(nullable NSNumber *)from toNumber:(nonnull NSNumber *)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate +{ + CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartNumber:from + endNumber:to + duration:duration + withDelay:CPTFloat(0.0)]; + + return [self animate:object + property:property + period:period + animationCurve:animationCurve + delegate:delegate + ]; +} + +/** @brief Creates an animation operation with the given properties and adds it to the animation queue. + * @param object The object to animate. + * @param property The name of the property of @par{object} to animate. The property must have both getter and setter methods. + * @param from The starting value. If @NAN or @nil, the animation starts from the current value of the animated property. + * @param to The ending value. + * @param duration The duration of the animation. + * @return The queued animation operation. + **/ ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromNumber:(nullable NSNumber *)from toNumber:(nonnull NSNumber *)to duration:(CGFloat)duration +{ + CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartNumber:from + endNumber:to + duration:duration + withDelay:CPTFloat(0.0)]; + + return [self animate:object + property:property + period:period + animationCurve:CPTAnimationCurveDefault + delegate:nil]; } // CPTPlotRange @@ -835,7 +973,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromD * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPlotRange:(CPTPlotRange *)from toPlotRange:(CPTPlotRange *)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromPlotRange:(nonnull CPTPlotRange *)from toPlotRange:(nonnull CPTPlotRange *)to duration:(CGFloat)duration withDelay:(CGFloat)delay animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartPlotRange:from endPlotRange:to @@ -843,10 +981,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP withDelay:delay]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -860,7 +998,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP * @param delegate The animation delegate (can be @nil). * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPlotRange:(CPTPlotRange *)from toPlotRange:(CPTPlotRange *)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(id)delegate ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromPlotRange:(nonnull CPTPlotRange *)from toPlotRange:(nonnull CPTPlotRange *)to duration:(CGFloat)duration animationCurve:(CPTAnimationCurve)animationCurve delegate:(nullable id)delegate { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartPlotRange:from endPlotRange:to @@ -868,10 +1006,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:animationCurve - delegate:delegate + property:property + period:period + animationCurve:animationCurve + delegate:delegate ]; } @@ -883,7 +1021,7 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP * @param duration The duration of the animation. * @return The queued animation operation. **/ -+(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromPlotRange:(CPTPlotRange *)from toPlotRange:(CPTPlotRange *)to duration:(CGFloat)duration ++(nonnull CPTAnimationOperation *)animate:(nonnull id)object property:(nonnull NSString *)property fromPlotRange:(nonnull CPTPlotRange *)from toPlotRange:(nonnull CPTPlotRange *)to duration:(CGFloat)duration { CPTAnimationPeriod *period = [CPTAnimationPeriod periodWithStartPlotRange:from endPlotRange:to @@ -891,10 +1029,10 @@ +(CPTAnimationOperation *)animate:(id)object property:(NSString *)property fromP withDelay:CPTFloat(0.0)]; return [self animate:object - property:property - period:period - animationCurve:CPTAnimationCurveDefault - delegate:nil]; + property:property + period:period + animationCurve:CPTAnimationCurveDefault + delegate:nil]; } @end diff --git a/framework/Source/CPTAnnotation.h b/framework/Source/CPTAnnotation.h index 9bab1b560..cda5d79bc 100644 --- a/framework/Source/CPTAnnotation.h +++ b/framework/Source/CPTAnnotation.h @@ -9,21 +9,27 @@ /** * @brief An array of annotations. **/ -typedef NSArray<__kindof CPTAnnotation *> *CPTAnnotationArray; +typedef NSArray<__kindof CPTAnnotation *> CPTAnnotationArray; /** * @brief A mutable array of annotations. **/ -typedef NSMutableArray<__kindof CPTAnnotation *> *CPTMutableAnnotationArray; +typedef NSMutableArray<__kindof CPTAnnotation *> CPTMutableAnnotationArray; -@interface CPTAnnotation : NSObject +@interface CPTAnnotation : NSObject @property (nonatomic, readwrite, strong, nullable) CPTLayer *contentLayer; -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTAnnotationHostLayer *annotationHostLayer; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTAnnotationHostLayer *annotationHostLayer; @property (nonatomic, readwrite, assign) CGPoint contentAnchorPoint; @property (nonatomic, readwrite, assign) CGPoint displacement; @property (nonatomic, readwrite, assign) CGFloat rotation; +/// @name Initialization +/// @{ +-(nonnull instancetype)init NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +/// @} + @end #pragma mark - diff --git a/framework/Source/CPTAnnotation.m b/framework/Source/CPTAnnotation.m index 1662d9780..18483ec57 100644 --- a/framework/Source/CPTAnnotation.m +++ b/framework/Source/CPTAnnotation.m @@ -11,12 +11,12 @@ **/ @implementation CPTAnnotation -/** @property CPTLayer *contentLayer +/** @property nullable CPTLayer *contentLayer * @brief The annotation content. **/ @synthesize contentLayer; -/** @property cpt_weak CPTAnnotationHostLayer *annotationHostLayer +/** @property nullable CPTAnnotationHostLayer *annotationHostLayer * @brief The host layer for the annotation content. **/ @synthesize annotationHostLayer; @@ -53,9 +53,9 @@ @implementation CPTAnnotation * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { annotationHostLayer = nil; contentLayer = nil; displacement = CGPointZero; @@ -72,7 +72,7 @@ -(instancetype)init /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeConditionalObject:self.annotationHostLayer forKey:@"CPTAnnotation.annotationHostLayer"]; [coder encodeObject:self.contentLayer forKey:@"CPTAnnotation.contentLayer"]; @@ -81,28 +81,42 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeCGFloat:self.rotation forKey:@"CPTAnnotation.rotation"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - annotationHostLayer = [coder decodeObjectForKey:@"CPTAnnotation.annotationHostLayer"]; - contentLayer = [coder decodeObjectForKey:@"CPTAnnotation.contentLayer"]; - contentAnchorPoint = [coder decodeCPTPointForKey:@"CPTAnnotation.contentAnchorPoint"]; - displacement = [coder decodeCPTPointForKey:@"CPTAnnotation.displacement"]; - rotation = [coder decodeCGFloatForKey:@"CPTAnnotation.rotation"]; + if ((self = [super init])) { + annotationHostLayer = [coder decodeObjectOfClass:[CPTAnnotationHostLayer class] + forKey:@"CPTAnnotation.annotationHostLayer"]; + contentLayer = [coder decodeObjectOfClass:[CPTLayer class] + forKey:@"CPTAnnotation.contentLayer"]; + contentAnchorPoint = [coder decodeCPTPointForKey:@"CPTAnnotation.contentAnchorPoint"]; + displacement = [coder decodeCPTPointForKey:@"CPTAnnotation.displacement"]; + rotation = [coder decodeCGFloatForKey:@"CPTAnnotation.rotation"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Description /// @cond --(NSString *)description +-(nullable NSString *)description { - return [NSString stringWithFormat:@"<%@ {%@}>", [super description], self.contentLayer]; + return [NSString stringWithFormat:@"<%@ {%@}>", super.description, self.contentLayer]; } /// @endcond @@ -112,19 +126,21 @@ -(NSString *)description /// @cond --(void)setContentLayer:(CPTLayer *)newLayer +-(void)setContentLayer:(nullable CPTLayer *)newLayer { if ( newLayer != contentLayer ) { [contentLayer removeFromSuperlayer]; contentLayer = newLayer; if ( newLayer ) { + CPTLayer *layer = newLayer; + CPTAnnotationHostLayer *hostLayer = self.annotationHostLayer; - [hostLayer addSublayer:newLayer]; + [hostLayer addSublayer:layer]; } } } --(void)setAnnotationHostLayer:(CPTAnnotationHostLayer *)newLayer +-(void)setAnnotationHostLayer:(nullable CPTAnnotationHostLayer *)newLayer { if ( newLayer != annotationHostLayer ) { CPTLayer *myContent = self.contentLayer; @@ -139,17 +155,17 @@ -(void)setAnnotationHostLayer:(CPTAnnotationHostLayer *)newLayer -(void)setDisplacement:(CGPoint)newDisplacement { - if ( !CGPointEqualToPoint(newDisplacement, displacement) ) { + if ( !CGPointEqualToPoint(newDisplacement, displacement)) { displacement = newDisplacement; - [[self.contentLayer superlayer] setNeedsLayout]; + [self.contentLayer.superlayer setNeedsLayout]; } } -(void)setContentAnchorPoint:(CGPoint)newAnchorPoint { - if ( !CGPointEqualToPoint(newAnchorPoint, contentAnchorPoint) ) { + if ( !CGPointEqualToPoint(newAnchorPoint, contentAnchorPoint)) { contentAnchorPoint = newAnchorPoint; - [[self.contentLayer superlayer] setNeedsLayout]; + [self.contentLayer.superlayer setNeedsLayout]; } } @@ -157,7 +173,7 @@ -(void)setRotation:(CGFloat)newRotation { if ( newRotation != rotation ) { rotation = newRotation; - [[self.contentLayer superlayer] setNeedsLayout]; + [self.contentLayer.superlayer setNeedsLayout]; } } diff --git a/framework/Source/CPTAnnotationHostLayer.h b/framework/Source/CPTAnnotationHostLayer.h index 56c71ce95..a8217fa32 100644 --- a/framework/Source/CPTAnnotationHostLayer.h +++ b/framework/Source/CPTAnnotationHostLayer.h @@ -3,7 +3,7 @@ @interface CPTAnnotationHostLayer : CPTLayer -@property (nonatomic, readonly, nonnull) CPTAnnotationArray annotations; +@property (nonatomic, readonly, nonnull) CPTAnnotationArray *annotations; /// @name Annotations /// @{ diff --git a/framework/Source/CPTAnnotationHostLayer.m b/framework/Source/CPTAnnotationHostLayer.m index cbee41637..6fa9af69b 100644 --- a/framework/Source/CPTAnnotationHostLayer.m +++ b/framework/Source/CPTAnnotationHostLayer.m @@ -5,7 +5,7 @@ /// @cond @interface CPTAnnotationHostLayer() -@property (nonatomic, readwrite, strong, nonnull) CPTMutableAnnotationArray mutableAnnotations; +@property (nonatomic, readwrite, strong, nonnull) CPTMutableAnnotationArray *mutableAnnotations; @end @@ -20,7 +20,7 @@ @interface CPTAnnotationHostLayer() **/ @implementation CPTAnnotationHostLayer -/** @property CPTAnnotationArray annotations +/** @property nonnull CPTAnnotationArray *annotations * @brief An array of annotations attached to this layer. **/ @dynamic annotations; @@ -41,9 +41,9 @@ @implementation CPTAnnotationHostLayer * @param newFrame The frame rectangle. * @return The initialized CPTAnnotationHostLayer object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { mutableAnnotations = [[NSMutableArray alloc] init]; } return self; @@ -53,9 +53,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTAnnotationHostLayer *theLayer = (CPTAnnotationHostLayer *)layer; mutableAnnotations = theLayer->mutableAnnotations; @@ -70,17 +70,18 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeObject:self.mutableAnnotations forKey:@"CPTAnnotationHostLayer.mutableAnnotations"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - CPTAnnotationArray annotations = [coder decodeObjectForKey:@"CPTAnnotationHostLayer.mutableAnnotations"]; + if ((self = [super initWithCoder:coder])) { + CPTAnnotationArray *annotations = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTAnnotation class]]] + forKey:@"CPTAnnotationHostLayer.mutableAnnotations"]; if ( annotations ) { mutableAnnotations = [annotations mutableCopy]; } @@ -93,41 +94,61 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Annotations --(CPTAnnotationArray)annotations +/// @cond + +-(nonnull CPTAnnotationArray *)annotations { return [self.mutableAnnotations copy]; } +/// @endcond + /** * @brief Adds an annotation to the receiver. **/ --(void)addAnnotation:(CPTAnnotation *)annotation +-(void)addAnnotation:(nullable CPTAnnotation *)annotation { if ( annotation ) { - CPTMutableAnnotationArray annotationArray = self.mutableAnnotations; - if ( ![annotationArray containsObject:annotation] ) { - [annotationArray addObject:annotation]; + CPTAnnotation *theAnnotation = annotation; + + CPTMutableAnnotationArray *annotationArray = self.mutableAnnotations; + if ( ![annotationArray containsObject:theAnnotation] ) { + [annotationArray addObject:theAnnotation]; } - annotation.annotationHostLayer = self; - [annotation positionContentLayer]; + theAnnotation.annotationHostLayer = self; + [theAnnotation positionContentLayer]; } } /** * @brief Removes an annotation from the receiver. **/ --(void)removeAnnotation:(CPTAnnotation *)annotation +-(void)removeAnnotation:(nullable CPTAnnotation *)annotation { if ( annotation ) { - if ( [self.mutableAnnotations containsObject:annotation] ) { - annotation.annotationHostLayer = nil; - [self.mutableAnnotations removeObject:annotation]; + CPTAnnotation *theAnnotation = annotation; + + if ( [self.mutableAnnotations containsObject:theAnnotation] ) { + theAnnotation.annotationHostLayer = nil; + [self.mutableAnnotations removeObject:theAnnotation]; } else { - CPTAnnotationHostLayer *hostLayer = annotation.annotationHostLayer; + CPTAnnotationHostLayer *hostLayer = theAnnotation.annotationHostLayer; [NSException raise:CPTException format:@"Tried to remove CPTAnnotation from %@. Host layer was %@.", self, hostLayer]; } } @@ -138,7 +159,7 @@ -(void)removeAnnotation:(CPTAnnotation *)annotation **/ -(void)removeAllAnnotations { - CPTMutableAnnotationArray allAnnotations = self.mutableAnnotations; + CPTMutableAnnotationArray *allAnnotations = self.mutableAnnotations; for ( CPTAnnotation *annotation in allAnnotations ) { annotation.annotationHostLayer = nil; @@ -151,12 +172,12 @@ -(void)removeAllAnnotations /// @cond --(CPTSublayerSet)sublayersExcludedFromAutomaticLayout +-(nullable CPTSublayerSet *)sublayersExcludedFromAutomaticLayout { - CPTMutableAnnotationArray annotations = self.mutableAnnotations; + CPTMutableAnnotationArray *annotations = self.mutableAnnotations; if ( annotations.count > 0 ) { - CPTMutableSublayerSet excludedSublayers = [[super sublayersExcludedFromAutomaticLayout] mutableCopy]; + CPTMutableSublayerSet *excludedSublayers = [super.sublayersExcludedFromAutomaticLayout mutableCopy]; if ( !excludedSublayers ) { excludedSublayers = [NSMutableSet set]; @@ -172,7 +193,7 @@ -(CPTSublayerSet)sublayersExcludedFromAutomaticLayout return excludedSublayers; } else { - return [super sublayersExcludedFromAutomaticLayout]; + return super.sublayersExcludedFromAutomaticLayout; } } @@ -204,12 +225,12 @@ -(void)layoutSublayers * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { for ( CPTAnnotation *annotation in self.annotations ) { CPTLayer *content = annotation.contentLayer; if ( content ) { - if ( CGRectContainsPoint(content.frame, interactionPoint) ) { + if ( CGRectContainsPoint(content.frame, interactionPoint)) { BOOL handled = [content pointingDeviceDownEvent:event atPoint:interactionPoint]; if ( handled ) { return YES; @@ -235,12 +256,12 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { for ( CPTAnnotation *annotation in self.annotations ) { CPTLayer *content = annotation.contentLayer; if ( content ) { - if ( CGRectContainsPoint(content.frame, interactionPoint) ) { + if ( CGRectContainsPoint(content.frame, interactionPoint)) { BOOL handled = [content pointingDeviceUpEvent:event atPoint:interactionPoint]; if ( handled ) { return YES; @@ -266,12 +287,12 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { for ( CPTAnnotation *annotation in self.annotations ) { CPTLayer *content = annotation.contentLayer; if ( content ) { - if ( CGRectContainsPoint(content.frame, interactionPoint) ) { + if ( CGRectContainsPoint(content.frame, interactionPoint)) { BOOL handled = [content pointingDeviceDraggedEvent:event atPoint:interactionPoint]; if ( handled ) { return YES; @@ -297,7 +318,7 @@ -(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)inter * @param event The OS event. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event +-(BOOL)pointingDeviceCancelledEvent:(nonnull CPTNativeEvent *)event { for ( CPTAnnotation *annotation in self.annotations ) { CPTLayer *content = annotation.contentLayer; diff --git a/framework/Source/CPTAxis.h b/framework/Source/CPTAxis.h index b15f915b7..65bec6a8a 100644 --- a/framework/Source/CPTAxis.h +++ b/framework/Source/CPTAxis.h @@ -32,19 +32,19 @@ typedef NS_ENUM (NSInteger, CPTAxisLabelingPolicy) { /** * @brief An array of axes. **/ -typedef NSArray<__kindof CPTAxis *> *CPTAxisArray; +typedef NSArray<__kindof CPTAxis *> CPTAxisArray; /** * @brief A mutable array of axes. **/ -typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; +typedef NSMutableArray<__kindof CPTAxis *> CPTMutableAxisArray; #pragma mark - /** * @brief Axis labeling delegate. **/ -@protocol CPTAxisDelegate +@protocol CPTAxisDelegate @optional @@ -70,7 +70,7 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; * @param locations The locations of the major ticks. * @return @YES if the axis class should proceed with automatic labeling. **/ --(BOOL)axis:(nonnull CPTAxis *)axis shouldUpdateAxisLabelsAtLocations:(nonnull CPTNumberSet)locations; +-(BOOL)axis:(nonnull CPTAxis *)axis shouldUpdateAxisLabelsAtLocations:(nonnull CPTNumberSet *)locations; /** @brief @optional This method gives the delegate a chance to create custom labels for each minor tick. * It can be used with any labeling policy. Returning @NO will cause the axis not @@ -79,7 +79,7 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; * @param locations The locations of the minor ticks. * @return @YES if the axis class should proceed with automatic labeling. **/ --(BOOL)axis:(nonnull CPTAxis *)axis shouldUpdateMinorAxisLabelsAtLocations:(nonnull CPTNumberSet)locations; +-(BOOL)axis:(nonnull CPTAxis *)axis shouldUpdateMinorAxisLabelsAtLocations:(nonnull CPTNumberSet *)locations; /// @} @@ -200,7 +200,7 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; /// @{ @property (nonatomic, readwrite, copy, nullable) CPTLineStyle *axisLineStyle; @property (nonatomic, readwrite, assign) CPTCoordinate coordinate; -@property (nonatomic, readwrite, strong, nullable) NSNumber *labelingOrigin; +@property (nonatomic, readwrite, strong, nonnull) NSNumber *labelingOrigin; @property (nonatomic, readwrite, assign) CPTSign tickDirection; @property (nonatomic, readwrite, copy, nullable) CPTPlotRange *visibleRange; @property (nonatomic, readwrite, copy, nullable) CPTPlotRange *visibleAxisRange; @@ -236,10 +236,10 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; @property (nonatomic, readwrite, assign) CPTSign minorTickLabelDirection; @property (nonatomic, readwrite, strong, nullable) NSFormatter *labelFormatter; @property (nonatomic, readwrite, strong, nullable) NSFormatter *minorTickLabelFormatter; -@property (nonatomic, readwrite, strong, nullable) CPTAxisLabelSet axisLabels; -@property (nonatomic, readwrite, strong, nullable) CPTAxisLabelSet minorTickAxisLabels; +@property (nonatomic, readwrite, strong, nullable) CPTAxisLabelSet *axisLabels; +@property (nonatomic, readwrite, strong, nullable) CPTAxisLabelSet *minorTickAxisLabels; @property (nonatomic, readonly) BOOL needsRelabel; -@property (nonatomic, readwrite, strong, nullable) CPTPlotRangeArray labelExclusionRanges; +@property (nonatomic, readwrite, strong, nullable) CPTPlotRangeArray *labelExclusionRanges; @property (nonatomic, readwrite, strong, nullable) CPTShadow *labelShadow; @property (nonatomic, readwrite, strong, nullable) CPTShadow *minorTickLabelShadow; /// @} @@ -249,7 +249,7 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; @property (nonatomic, readwrite, strong, nullable) NSNumber *majorIntervalLength; @property (nonatomic, readwrite, assign) CGFloat majorTickLength; @property (nonatomic, readwrite, copy, nullable) CPTLineStyle *majorTickLineStyle; -@property (nonatomic, readwrite, strong, nullable) CPTNumberSet majorTickLocations; +@property (nonatomic, readwrite, strong, nullable) CPTNumberSet *majorTickLocations; @property (nonatomic, readwrite, assign) NSUInteger preferredNumberOfMajorTicks; /// @} @@ -258,7 +258,7 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; @property (nonatomic, readwrite, assign) NSUInteger minorTicksPerInterval; @property (nonatomic, readwrite, assign) CGFloat minorTickLength; @property (nonatomic, readwrite, copy, nullable) CPTLineStyle *minorTickLineStyle; -@property (nonatomic, readwrite, strong, nullable) CPTNumberSet minorTickLocations; +@property (nonatomic, readwrite, strong, nullable) CPTNumberSet *minorTickLocations; /// @} /// @name Grid Lines @@ -270,8 +270,9 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; /// @name Background Bands /// @{ -@property (nonatomic, readwrite, copy, nullable) CPTFillArray alternatingBandFills; -@property (nonatomic, readonly, nullable) CPTLimitBandArray backgroundLimitBands; +@property (nonatomic, readwrite, copy, nullable) CPTFillArray *alternatingBandFills; +@property (nonatomic, readwrite, strong, nullable) NSNumber *alternatingBandAnchor; +@property (nonatomic, readonly, nullable) CPTLimitBandArray *backgroundLimitBands; /// @} /// @name Plot Space @@ -282,9 +283,9 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; /// @name Layers /// @{ @property (nonatomic, readwrite, assign) BOOL separateLayers; -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTPlotArea *plotArea; -@property (nonatomic, readonly, nullable) cpt_weak CPTGridLines *minorGridLines; -@property (nonatomic, readonly, nullable) cpt_weak CPTGridLines *majorGridLines; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTPlotArea *plotArea; +@property (nonatomic, readonly, cpt_weak_property, nullable) CPTGridLines *minorGridLines; +@property (nonatomic, readonly, cpt_weak_property, nullable) CPTGridLines *majorGridLines; @property (nonatomic, readonly, nullable) CPTAxisSet *axisSet; /// @} @@ -303,8 +304,8 @@ typedef NSMutableArray<__kindof CPTAxis *> *CPTMutableAxisArray; /// @name Ticks /// @{ --(nullable CPTNumberSet)filteredMajorTickLocations:(nullable CPTNumberSet)allLocations; --(nullable CPTNumberSet)filteredMinorTickLocations:(nullable CPTNumberSet)allLocations; +-(nullable CPTNumberSet *)filteredMajorTickLocations:(nullable CPTNumberSet *)allLocations; +-(nullable CPTNumberSet *)filteredMinorTickLocations:(nullable CPTNumberSet *)allLocations; /// @} /// @name Background Bands diff --git a/framework/Source/CPTAxis.m b/framework/Source/CPTAxis.m index 1a5a18916..102318084 100644 --- a/framework/Source/CPTAxis.m +++ b/framework/Source/CPTAxis.m @@ -22,7 +22,7 @@ /** @defgroup axisAnimation Axes * @brief Axis properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif * @ingroup animation **/ @@ -32,22 +32,22 @@ @interface CPTAxis() @property (nonatomic, readwrite, assign) BOOL needsRelabel; -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTGridLines *minorGridLines; -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTGridLines *majorGridLines; -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTAxisLabel *pointingDeviceDownLabel; -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTAxisLabel *pointingDeviceDownTickLabel; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTGridLines *minorGridLines; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTGridLines *majorGridLines; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTAxisLabel *pointingDeviceDownLabel; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTAxisLabel *pointingDeviceDownTickLabel; @property (nonatomic, readwrite, assign) BOOL labelFormatterChanged; @property (nonatomic, readwrite, assign) BOOL minorLabelFormatterChanged; -@property (nonatomic, readwrite, strong, nullable) CPTMutableLimitBandArray mutableBackgroundLimitBands; +@property (nonatomic, readwrite, strong, nullable) CPTMutableLimitBandArray *mutableBackgroundLimitBands; @property (nonatomic, readonly) CGFloat tickOffset; @property (nonatomic, readwrite, assign) BOOL inTitleUpdate; @property (nonatomic, readwrite, assign) BOOL labelsUpdated; --(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet __nonnull __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet __nonnull __autoreleasing *)newMinorLocations; --(void)autoGenerateMajorTickLocations:(CPTNumberSet __nonnull __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet __nonnull __autoreleasing *)newMinorLocations; --(void)generateEqualMajorTickLocations:(CPTNumberSet __nonnull __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet __nonnull __autoreleasing *)newMinorLocations; --(nullable CPTNumberSet)filteredTickLocations:(nullable CPTNumberSet)allLocations; --(void)updateAxisLabelsAtLocations:(nullable CPTNumberSet)locations inRange:(nullable CPTPlotRange *)labeledRange useMajorAxisLabels:(BOOL)useMajorAxisLabels; +-(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet *__nonnull __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet *__nonnull __autoreleasing *)newMinorLocations; +-(void)autoGenerateMajorTickLocations:(CPTNumberSet *__nonnull __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet *__nonnull __autoreleasing *)newMinorLocations; +-(void)generateEqualMajorTickLocations:(CPTNumberSet *__nonnull __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet *__nonnull __autoreleasing *)newMinorLocations; +-(nullable CPTNumberSet *)filteredTickLocations:(nullable CPTNumberSet *)allLocations; +-(void)updateAxisLabelsAtLocations:(nullable CPTNumberSet *)locations inRange:(nullable CPTPlotRange *)labeledRange useMajorAxisLabels:(BOOL)useMajorAxisLabels; -(void)updateCustomTickLabels; -(void)updateMajorTickLabelOffsets; -(void)updateMinorTickLabelOffsets; @@ -73,7 +73,7 @@ @implementation CPTAxis // Axis -/** @property CPTLineStyle *axisLineStyle +/** @property nullable CPTLineStyle *axisLineStyle * @brief The line style for the axis line. * If @nil, the line is not drawn. **/ @@ -84,7 +84,7 @@ @implementation CPTAxis **/ @synthesize coordinate; -/** @property NSNumber *labelingOrigin +/** @property nonnull NSNumber *labelingOrigin * @brief The origin used for axis labels. * The default value is @num{0}. It is only used when the axis labeling * policy is #CPTAxisLabelingPolicyFixedInterval. The origin is @@ -101,7 +101,7 @@ @implementation CPTAxis **/ @synthesize tickDirection; -/** @property CPTPlotRange *visibleRange +/** @property nullable CPTPlotRange *visibleRange * @brief The plot range over which the axis and ticks are visible. * Use this to restrict an axis and its grid lines to less than the full plot area width. * Use the @ref visibleAxisRange to specify a separate range for the axis line, if needed. @@ -109,7 +109,7 @@ @implementation CPTAxis **/ @synthesize visibleRange; -/** @property CPTPlotRange *visibleAxisRange; +/** @property nullable CPTPlotRange *visibleAxisRange; * @brief The plot range over which the axis itself is visible. * Use this to restrict an axis line to less than the full plot area width. This range is independent * of the @ref visibleRange and overrides it for the axis line and line cap. @@ -117,13 +117,13 @@ @implementation CPTAxis **/ @synthesize visibleAxisRange; -/** @property CPTLineCap *axisLineCapMin +/** @property nullable CPTLineCap *axisLineCapMin * @brief The line cap for the end of the axis line with the minimum value. * @see axisLineCapMax **/ @synthesize axisLineCapMin; -/** @property CPTLineCap *axisLineCapMax +/** @property nullable CPTLineCap *axisLineCapMax * @brief The line cap for the end of the axis line with the maximum value. * @see axisLineCapMin **/ @@ -131,14 +131,14 @@ @implementation CPTAxis // Title -/** @property CPTTextStyle *titleTextStyle +/** @property nullable CPTTextStyle *titleTextStyle * @brief The text style used to draw the axis title text. * * Assigning a new value to this property also sets the value of the @ref attributedTitle property to @nil. **/ @synthesize titleTextStyle; -/** @property CPTAxisTitle *axisTitle +/** @property nullable CPTAxisTitle *axisTitle * @brief The axis title. * If @nil, no title is drawn. **/ @@ -150,14 +150,14 @@ @implementation CPTAxis **/ @synthesize titleOffset; -/** @property NSString *title +/** @property nullable NSString *title * @brief A convenience property for setting the text title of the axis. * * Assigning a new value to this property also sets the value of the @ref attributedTitle property to @nil. **/ @synthesize title; -/** @property NSAttributedString *attributedTitle +/** @property nullable NSAttributedString *attributedTitle * @brief A convenience property for setting the styled text title of the axis. * * Assigning a new value to this property also sets the value of the @ref title property to the @@ -183,13 +183,13 @@ @implementation CPTAxis **/ @synthesize titleDirection; -/** @property NSNumber *titleLocation +/** @property nullable NSNumber *titleLocation * @brief The position along the axis where the axis title should be centered. * If @NAN (the default), the @ref defaultTitleLocation will be used. **/ @synthesize titleLocation; -/** @property NSNumber *defaultTitleLocation +/** @property nonnull NSNumber *defaultTitleLocation * @brief The position along the axis where the axis title should be centered * if @ref titleLocation is @NAN. **/ @@ -197,7 +197,7 @@ @implementation CPTAxis // Plot space -/** @property CPTPlotSpace *plotSpace +/** @property nullable CPTPlotSpace *plotSpace * @brief The plot space for the axis. **/ @synthesize plotSpace; @@ -245,12 +245,12 @@ @implementation CPTAxis **/ @synthesize minorTickLabelAlignment; -/** @property CPTTextStyle *labelTextStyle +/** @property nullable CPTTextStyle *labelTextStyle * @brief The text style used to draw the label text. **/ @synthesize labelTextStyle; -/** @property CPTTextStyle *minorTickLabelTextStyle +/** @property nullable CPTTextStyle *minorTickLabelTextStyle * @brief The text style used to draw the label text of minor tick labels. **/ @synthesize minorTickLabelTextStyle; @@ -273,7 +273,7 @@ @implementation CPTAxis **/ @synthesize minorTickLabelDirection; -/** @property NSFormatter *labelFormatter +/** @property nullable NSFormatter *labelFormatter * @brief The number formatter used to format the label text. * If you need a non-numerical label, such as a date, you can use a formatter than turns * the numerical plot coordinate into a string (e.g., @quote{Jan 10, 2010}). @@ -281,7 +281,7 @@ @implementation CPTAxis **/ @synthesize labelFormatter; -/** @property NSFormatter *minorTickLabelFormatter +/** @property nullable NSFormatter *minorTickLabelFormatter * @brief The number formatter used to format the label text of minor ticks. * If you need a non-numerical label, such as a date, you can use a formatter than turns * the numerical plot coordinate into a string (e.g., @quote{Jan 10, 2010}). @@ -293,12 +293,12 @@ @implementation CPTAxis @synthesize minorLabelFormatterChanged; @dynamic tickOffset; -/** @property CPTAxisLabelSet axisLabels +/** @property nullable CPTAxisLabelSet *axisLabels * @brief The set of axis labels. **/ @synthesize axisLabels; -/** @property CPTAxisLabelSet minorTickAxisLabels +/** @property nullable CPTAxisLabelSet *minorTickAxisLabels * @brief The set of minor tick axis labels. **/ @synthesize minorTickAxisLabels; @@ -308,29 +308,29 @@ @implementation CPTAxis **/ @synthesize needsRelabel; -/** @property CPTPlotRangeArray labelExclusionRanges +/** @property nullable CPTPlotRangeArray *labelExclusionRanges * @brief An array of CPTPlotRange objects. Any tick marks and labels falling inside any of the ranges in the array will not be drawn. **/ @synthesize labelExclusionRanges; -/** @property CPTShadow *labelShadow +/** @property nullable CPTShadow *labelShadow * @brief The shadow applied to each axis label. **/ @synthesize labelShadow; -/** @property CPTShadow *minorTickLabelShadow +/** @property nullable CPTShadow *minorTickLabelShadow * @brief The shadow applied to each minor tick axis label. **/ @synthesize minorTickLabelShadow; // Major ticks -/** @property NSNumber *majorIntervalLength +/** @property nullable NSNumber *majorIntervalLength * @brief The distance between major tick marks expressed in data coordinates. **/ @synthesize majorIntervalLength; -/** @property CPTLineStyle *majorTickLineStyle +/** @property nullable CPTLineStyle *majorTickLineStyle * @brief The line style for the major tick marks. * If @nil, the major ticks are not drawn. **/ @@ -341,7 +341,7 @@ @implementation CPTAxis **/ @synthesize majorTickLength; -/** @property CPTNumberSet majorTickLocations +/** @property nullable CPTNumberSet *majorTickLocations * @brief A set of axis coordinates for all major tick marks. **/ @synthesize majorTickLocations; @@ -361,7 +361,7 @@ @implementation CPTAxis **/ @synthesize minorTicksPerInterval; -/** @property CPTLineStyle *minorTickLineStyle +/** @property nullable CPTLineStyle *minorTickLineStyle * @brief The line style for the minor tick marks. * If @nil, the minor ticks are not drawn. **/ @@ -372,26 +372,26 @@ @implementation CPTAxis **/ @synthesize minorTickLength; -/** @property CPTNumberSet minorTickLocations +/** @property nullable CPTNumberSet *minorTickLocations * @brief A set of axis coordinates for all minor tick marks. **/ @synthesize minorTickLocations; // Grid Lines -/** @property CPTLineStyle *majorGridLineStyle +/** @property nullable CPTLineStyle *majorGridLineStyle * @brief The line style for the major grid lines. * If @nil, the major grid lines are not drawn. **/ @synthesize majorGridLineStyle; -/** @property CPTLineStyle *minorGridLineStyle +/** @property nullable CPTLineStyle *minorGridLineStyle * @brief The line style for the minor grid lines. * If @nil, the minor grid lines are not drawn. **/ @synthesize minorGridLineStyle; -/** @property CPTPlotRange *CPTPlotRange *gridLinesRange +/** @property nullable CPTPlotRange *CPTPlotRange *gridLinesRange * @brief The plot range over which the grid lines are visible. * Note that this range applies to the orthogonal coordinate, not * the axis coordinate itself. @@ -401,7 +401,7 @@ @implementation CPTAxis // Background Bands -/** @property CPTFillArray alternatingBandFills +/** @property nullable CPTFillArray *alternatingBandFills * @brief An array of two or more fills to be drawn between successive major tick marks. * * When initializing the fills, provide an NSArray containing any combination of CPTFill, @@ -410,7 +410,16 @@ @implementation CPTAxis **/ @synthesize alternatingBandFills; -/** @property CPTLimitBandArray backgroundLimitBands +/** @property nullable NSNumber *alternatingBandAnchor + * @brief The starting location of the first band fill. + * + * If @nil (the default), the first fill is drawn between the bottom left corner of the plot area + * and the first major tick location inside the plot area. If the anchor falls between two + * major tick locations, the first band fill wiil be drawn between those locations. + **/ +@synthesize alternatingBandAnchor; + +/** @property nullable CPTLimitBandArray *backgroundLimitBands * @brief An array of CPTLimitBand objects. * * The limit bands are drawn on top of the alternating band fills. @@ -429,34 +438,34 @@ @implementation CPTAxis **/ @synthesize separateLayers; -/** @property cpt_weak CPTPlotArea *plotArea +/** @property nullable CPTPlotArea *plotArea * @brief The plot area that the axis belongs to. **/ @synthesize plotArea; -/** @property cpt_weak CPTGridLines *minorGridLines +/** @property nullable CPTGridLines *minorGridLines * @brief The layer that draws the minor grid lines. **/ @synthesize minorGridLines; -/** @property cpt_weak CPTGridLines *majorGridLines +/** @property nullable CPTGridLines *majorGridLines * @brief The layer that draws the major grid lines. **/ @synthesize majorGridLines; -/** @property CPTAxisSet *axisSet +/** @property nullable CPTAxisSet *axisSet * @brief The axis set that the axis belongs to. **/ @dynamic axisSet; /** @internal - * @property cpt_weak CPTAxisLabel *pointingDeviceDownLabel + * @property nullable CPTAxisLabel *pointingDeviceDownLabel * @brief The label that was selected on the pointing device down event. **/ @synthesize pointingDeviceDownLabel; /** @internal - * @property cpt_weak CPTAxisLabel *pointingDeviceDownTickLabel + * @property nullable CPTAxisLabel *pointingDeviceDownTickLabel * @brief The tick label that was selected on the pointing device down event. **/ @synthesize pointingDeviceDownTickLabel; @@ -521,6 +530,7 @@ @implementation CPTAxis * - @ref labelShadow = @nil * - @ref minorTickLabelShadow = @nil * - @ref alternatingBandFills = @nil + * - @ref alternatingBandAnchor = @nil * - @ref minorGridLines = @nil * - @ref majorGridLines = @nil * - @ref needsDisplayOnBoundsChange = @YES @@ -528,9 +538,9 @@ @implementation CPTAxis * @param newFrame The frame rectangle. * @return The initialized CPTAxis object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plotSpace = nil; majorTickLocations = [NSSet set]; minorTickLocations = [NSSet set]; @@ -577,7 +587,7 @@ -(instancetype)initWithFrame:(CGRect)newFrame tickDirection = CPTSignNone; axisTitle = nil; titleTextStyle = [[CPTTextStyle alloc] init]; - titleRotation = NAN; + titleRotation = CPTNAN; titleLocation = @(NAN); needsRelabel = YES; labelExclusionRanges = nil; @@ -589,6 +599,7 @@ -(instancetype)initWithFrame:(CGRect)newFrame visibleAxisRange = nil; gridLinesRange = nil; alternatingBandFills = nil; + alternatingBandAnchor = nil; mutableBackgroundLimitBands = nil; minorGridLines = nil; majorGridLines = nil; @@ -606,9 +617,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTAxis *theLayer = (CPTAxis *)layer; plotSpace = theLayer->plotSpace; @@ -662,6 +673,7 @@ -(instancetype)initWithLayer:(id)layer visibleAxisRange = theLayer->visibleAxisRange; gridLinesRange = theLayer->gridLinesRange; alternatingBandFills = theLayer->alternatingBandFills; + alternatingBandAnchor = theLayer->alternatingBandAnchor; mutableBackgroundLimitBands = theLayer->mutableBackgroundLimitBands; minorGridLines = theLayer->minorGridLines; majorGridLines = theLayer->majorGridLines; @@ -691,7 +703,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -744,6 +756,7 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeObject:self.visibleAxisRange forKey:@"CPTAxis.visibleAxisRange"]; [coder encodeObject:self.gridLinesRange forKey:@"CPTAxis.gridLinesRange"]; [coder encodeObject:self.alternatingBandFills forKey:@"CPTAxis.alternatingBandFills"]; + [coder encodeObject:self.alternatingBandAnchor forKey:@"CPTAxis.alternatingBandAnchor"]; [coder encodeObject:self.mutableBackgroundLimitBands forKey:@"CPTAxis.mutableBackgroundLimitBands"]; [coder encodeBool:self.separateLayers forKey:@"CPTAxis.separateLayers"]; [coder encodeObject:self.labelShadow forKey:@"CPTAxis.labelShadow"]; @@ -759,65 +772,102 @@ -(void)encodeWithCoder:(NSCoder *)coder // labelsUpdated } --(instancetype)initWithCoder:(NSCoder *)coder -{ - if ( (self = [super initWithCoder:coder]) ) { - coordinate = (CPTCoordinate)[coder decodeIntegerForKey : @"CPTAxis.coordinate"]; - plotSpace = [coder decodeObjectForKey:@"CPTAxis.plotSpace"]; - majorTickLocations = [coder decodeObjectForKey:@"CPTAxis.majorTickLocations"]; - minorTickLocations = [coder decodeObjectForKey:@"CPTAxis.minorTickLocations"]; - majorTickLength = [coder decodeCGFloatForKey:@"CPTAxis.majorTickLength"]; - minorTickLength = [coder decodeCGFloatForKey:@"CPTAxis.minorTickLength"]; - labelOffset = [coder decodeCGFloatForKey:@"CPTAxis.labelOffset"]; - minorTickLabelOffset = [coder decodeCGFloatForKey:@"CPTAxis.minorTickLabelOffset"]; - labelRotation = [coder decodeCGFloatForKey:@"CPTAxis.labelRotation"]; - minorTickLabelRotation = [coder decodeCGFloatForKey:@"CPTAxis.minorTickLabelRotation"]; - labelAlignment = (CPTAlignment)[coder decodeIntegerForKey : @"CPTAxis.labelAlignment"]; - minorTickLabelAlignment = (CPTAlignment)[coder decodeIntegerForKey : @"CPTAxis.minorTickLabelAlignment"]; - axisLineStyle = [[coder decodeObjectForKey:@"CPTAxis.axisLineStyle"] copy]; - majorTickLineStyle = [[coder decodeObjectForKey:@"CPTAxis.majorTickLineStyle"] copy]; - minorTickLineStyle = [[coder decodeObjectForKey:@"CPTAxis.minorTickLineStyle"] copy]; - tickLabelDirection = (CPTSign)[coder decodeIntegerForKey : @"CPTAxis.tickLabelDirection"]; - minorTickLabelDirection = (CPTSign)[coder decodeIntegerForKey : @"CPTAxis.minorTickLabelDirection"]; - majorGridLineStyle = [[coder decodeObjectForKey:@"CPTAxis.majorGridLineStyle"] copy]; - minorGridLineStyle = [[coder decodeObjectForKey:@"CPTAxis.minorGridLineStyle"] copy]; - axisLineCapMin = [[coder decodeObjectForKey:@"CPTAxis.axisLineCapMin"] copy]; - axisLineCapMax = [[coder decodeObjectForKey:@"CPTAxis.axisLineCapMax"] copy]; - labelingOrigin = [coder decodeObjectForKey:@"CPTAxis.labelingOrigin"]; - majorIntervalLength = [coder decodeObjectForKey:@"CPTAxis.majorIntervalLength"]; - minorTicksPerInterval = (NSUInteger)[coder decodeIntegerForKey : @"CPTAxis.minorTicksPerInterval"]; - preferredNumberOfMajorTicks = (NSUInteger)[coder decodeIntegerForKey : @"CPTAxis.preferredNumberOfMajorTicks"]; - labelingPolicy = (CPTAxisLabelingPolicy)[coder decodeIntegerForKey : @"CPTAxis.labelingPolicy"]; - labelTextStyle = [[coder decodeObjectForKey:@"CPTAxis.labelTextStyle"] copy]; - minorTickLabelTextStyle = [[coder decodeObjectForKey:@"CPTAxis.minorTickLabelTextStyle"] copy]; - titleTextStyle = [[coder decodeObjectForKey:@"CPTAxis.titleTextStyle"] copy]; - labelFormatter = [coder decodeObjectForKey:@"CPTAxis.labelFormatter"]; - minorTickLabelFormatter = [coder decodeObjectForKey:@"CPTAxis.minorTickLabelFormatter"]; - labelFormatterChanged = [coder decodeBoolForKey:@"CPTAxis.labelFormatterChanged"]; - minorLabelFormatterChanged = [coder decodeBoolForKey:@"CPTAxis.minorLabelFormatterChanged"]; - axisLabels = [coder decodeObjectForKey:@"CPTAxis.axisLabels"]; - minorTickAxisLabels = [coder decodeObjectForKey:@"CPTAxis.minorTickAxisLabels"]; - axisTitle = [coder decodeObjectForKey:@"CPTAxis.axisTitle"]; - title = [[coder decodeObjectForKey:@"CPTAxis.title"] copy]; - attributedTitle = [[coder decodeObjectForKey:@"CPTAxis.attributedTitle"] copy]; - titleOffset = [coder decodeCGFloatForKey:@"CPTAxis.titleOffset"]; - titleRotation = [coder decodeCGFloatForKey:@"CPTAxis.titleRotation"]; - titleDirection = (CPTSign)[coder decodeIntegerForKey : @"CPTAxis.titleDirection"]; - titleLocation = [coder decodeObjectForKey:@"CPTAxis.titleLocation"]; - tickDirection = (CPTSign)[coder decodeIntegerForKey : @"CPTAxis.tickDirection"]; - needsRelabel = [coder decodeBoolForKey:@"CPTAxis.needsRelabel"]; - labelExclusionRanges = [coder decodeObjectForKey:@"CPTAxis.labelExclusionRanges"]; - visibleRange = [[coder decodeObjectForKey:@"CPTAxis.visibleRange"] copy]; - visibleAxisRange = [[coder decodeObjectForKey:@"CPTAxis.visibleAxisRange"] copy]; - gridLinesRange = [[coder decodeObjectForKey:@"CPTAxis.gridLinesRange"] copy]; - alternatingBandFills = [[coder decodeObjectForKey:@"CPTAxis.alternatingBandFills"] copy]; - mutableBackgroundLimitBands = [[coder decodeObjectForKey:@"CPTAxis.mutableBackgroundLimitBands"] mutableCopy]; - separateLayers = [coder decodeBoolForKey:@"CPTAxis.separateLayers"]; - labelShadow = [coder decodeObjectForKey:@"CPTAxis.labelShadow"]; - minorTickLabelShadow = [coder decodeObjectForKey:@"CPTAxis.minorTickLabelShadow"]; - plotArea = [coder decodeObjectForKey:@"CPTAxis.plotArea"]; - minorGridLines = [coder decodeObjectForKey:@"CPTAxis.minorGridLines"]; - majorGridLines = [coder decodeObjectForKey:@"CPTAxis.majorGridLines"]; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder +{ + if ((self = [super initWithCoder:coder])) { + coordinate = (CPTCoordinate)[coder decodeIntegerForKey:@"CPTAxis.coordinate"]; + plotSpace = [coder decodeObjectOfClass:[CPTPlotSpace class] + forKey:@"CPTAxis.plotSpace"]; + majorTickLocations = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSSet class], [NSNumber class]]] + forKey:@"CPTAxis.majorTickLocations"]; + minorTickLocations = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSSet class], [NSNumber class]]] + forKey:@"CPTAxis.minorTickLocations"]; + majorTickLength = [coder decodeCGFloatForKey:@"CPTAxis.majorTickLength"]; + minorTickLength = [coder decodeCGFloatForKey:@"CPTAxis.minorTickLength"]; + labelOffset = [coder decodeCGFloatForKey:@"CPTAxis.labelOffset"]; + minorTickLabelOffset = [coder decodeCGFloatForKey:@"CPTAxis.minorTickLabelOffset"]; + labelRotation = [coder decodeCGFloatForKey:@"CPTAxis.labelRotation"]; + minorTickLabelRotation = [coder decodeCGFloatForKey:@"CPTAxis.minorTickLabelRotation"]; + labelAlignment = (CPTAlignment)[coder decodeIntegerForKey:@"CPTAxis.labelAlignment"]; + minorTickLabelAlignment = (CPTAlignment)[coder decodeIntegerForKey:@"CPTAxis.minorTickLabelAlignment"]; + axisLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTAxis.axisLineStyle"] copy]; + majorTickLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTAxis.majorTickLineStyle"] copy]; + minorTickLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTAxis.minorTickLineStyle"] copy]; + tickLabelDirection = (CPTSign)[coder decodeIntegerForKey:@"CPTAxis.tickLabelDirection"]; + minorTickLabelDirection = (CPTSign)[coder decodeIntegerForKey:@"CPTAxis.minorTickLabelDirection"]; + majorGridLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTAxis.majorGridLineStyle"] copy]; + minorGridLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTAxis.minorGridLineStyle"] copy]; + axisLineCapMin = [[coder decodeObjectOfClass:[CPTLineCap class] + forKey:@"CPTAxis.axisLineCapMin"] copy]; + axisLineCapMax = [[coder decodeObjectOfClass:[CPTLineCap class] + forKey:@"CPTAxis.axisLineCapMax"] copy]; + NSNumber *origin = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTAxis.labelingOrigin"]; + labelingOrigin = origin ? origin : @0.0; + majorIntervalLength = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTAxis.majorIntervalLength"]; + minorTicksPerInterval = (NSUInteger)[coder decodeIntegerForKey:@"CPTAxis.minorTicksPerInterval"]; + preferredNumberOfMajorTicks = (NSUInteger)[coder decodeIntegerForKey:@"CPTAxis.preferredNumberOfMajorTicks"]; + labelingPolicy = (CPTAxisLabelingPolicy)[coder decodeIntegerForKey:@"CPTAxis.labelingPolicy"]; + labelTextStyle = [[coder decodeObjectOfClass:[CPTTextStyle class] + forKey:@"CPTAxis.labelTextStyle"] copy]; + minorTickLabelTextStyle = [[coder decodeObjectOfClass:[CPTTextStyle class] + forKey:@"CPTAxis.minorTickLabelTextStyle"] copy]; + titleTextStyle = [[coder decodeObjectOfClass:[CPTTextStyle class] + forKey:@"CPTAxis.titleTextStyle"] copy]; + labelFormatter = [coder decodeObjectOfClass:[NSFormatter class] + forKey:@"CPTAxis.labelFormatter"]; + minorTickLabelFormatter = [coder decodeObjectOfClass:[NSFormatter class] + forKey:@"CPTAxis.minorTickLabelFormatter"]; + labelFormatterChanged = [coder decodeBoolForKey:@"CPTAxis.labelFormatterChanged"]; + minorLabelFormatterChanged = [coder decodeBoolForKey:@"CPTAxis.minorLabelFormatterChanged"]; + axisLabels = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSSet class], [CPTAxisLabel class]]] + forKey:@"CPTAxis.axisLabels"]; + minorTickAxisLabels = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSSet class], [CPTAxisLabel class]]] + forKey:@"CPTAxis.minorTickAxisLabels"]; + axisTitle = [coder decodeObjectOfClass:[NSString class] + forKey:@"CPTAxis.axisTitle"]; + title = [[coder decodeObjectOfClass:[NSString class] + forKey:@"CPTAxis.title"] copy]; + attributedTitle = [[coder decodeObjectOfClass:[NSAttributedString class] + forKey:@"CPTAxis.attributedTitle"] copy]; + titleOffset = [coder decodeCGFloatForKey:@"CPTAxis.titleOffset"]; + titleRotation = [coder decodeCGFloatForKey:@"CPTAxis.titleRotation"]; + titleDirection = (CPTSign)[coder decodeIntegerForKey:@"CPTAxis.titleDirection"]; + titleLocation = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTAxis.titleLocation"]; + tickDirection = (CPTSign)[coder decodeIntegerForKey:@"CPTAxis.tickDirection"]; + needsRelabel = [coder decodeBoolForKey:@"CPTAxis.needsRelabel"]; + labelExclusionRanges = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTPlotRange class]]] + forKey:@"CPTAxis.labelExclusionRanges"]; + visibleRange = [[coder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTAxis.visibleRange"] copy]; + visibleAxisRange = [[coder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTAxis.visibleAxisRange"] copy]; + gridLinesRange = [[coder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTAxis.gridLinesRange"] copy]; + alternatingBandFills = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTFill class]]] + forKey:@"CPTAxis.alternatingBandFills"] copy]; + alternatingBandAnchor = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTAxis.alternatingBandAnchor"]; + mutableBackgroundLimitBands = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTLimitBand class]]] + forKey:@"CPTAxis.mutableBackgroundLimitBands"] mutableCopy]; + separateLayers = [coder decodeBoolForKey:@"CPTAxis.separateLayers"]; + labelShadow = [coder decodeObjectOfClass:[CPTShadow class] + forKey:@"CPTAxis.labelShadow"]; + minorTickLabelShadow = [coder decodeObjectOfClass:[CPTShadow class] + forKey:@"CPTAxis.minorTickLabelShadow"]; + plotArea = [coder decodeObjectOfClass:[CPTPlotArea class] + forKey:@"CPTAxis.plotArea"]; + minorGridLines = [coder decodeObjectOfClass:[CPTGridLines class] + forKey:@"CPTAxis.minorGridLines"]; + majorGridLines = [coder decodeObjectOfClass:[CPTGridLines class] + forKey:@"CPTAxis.majorGridLines"]; pointingDeviceDownLabel = nil; pointingDeviceDownTickLabel = nil; @@ -830,12 +880,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Animation /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken = 0; @@ -870,15 +932,15 @@ +(BOOL)needsDisplayForKey:(NSString *)aKey * @param newMajorLocations A new NSSet containing the major tick locations. * @param newMinorLocations A new NSSet containing the minor tick locations. */ --(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet __autoreleasing *)newMinorLocations +-(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet *__autoreleasing *)newMinorLocations { - CPTMutableNumberSet majorLocations = [NSMutableSet set]; - CPTMutableNumberSet minorLocations = [NSMutableSet set]; + CPTMutableNumberSet *majorLocations = [NSMutableSet set]; + CPTMutableNumberSet *minorLocations = [NSMutableSet set]; NSDecimal zero = CPTDecimalFromInteger(0); NSDecimal majorInterval = self.majorIntervalLength.decimalValue; - if ( CPTDecimalGreaterThan(majorInterval, zero) ) { + if ( CPTDecimalGreaterThan(majorInterval, zero)) { CPTMutablePlotRange *range = [[self.plotSpace plotRangeForCoordinate:self.coordinate] mutableCopy]; if ( range ) { CPTPlotRange *theVisibleRange = self.visibleRange; @@ -892,7 +954,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet __autoreleasing *)n NSDecimal minorInterval; NSUInteger minorTickCount = self.minorTicksPerInterval; if ( minorTickCount > 0 ) { - minorInterval = CPTDecimalDivide( majorInterval, CPTDecimalFromUnsignedInteger(minorTickCount + 1) ); + minorInterval = CPTDecimalDivide(majorInterval, CPTDecimalFromUnsignedInteger(minorTickCount + 1)); } else { minorInterval = zero; @@ -909,7 +971,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet __autoreleasing *)n NSDecimal minorCoord = CPTDecimalSubtract(coord, minorInterval); for ( NSUInteger minorTickIndex = 0; minorTickIndex < minorTickCount; minorTickIndex++ ) { - if ( CPTDecimalLessThan(minorCoord, rangeMin) ) { + if ( CPTDecimalLessThan(minorCoord, rangeMin)) { break; } [minorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:minorCoord]]; @@ -918,7 +980,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet __autoreleasing *)n } // Set tick locations - while ( CPTDecimalLessThanOrEqualTo(coord, rangeMax) ) { + while ( CPTDecimalLessThanOrEqualTo(coord, rangeMax)) { // Major tick [majorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:coord]]; @@ -927,7 +989,7 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet __autoreleasing *)n NSDecimal minorCoord = CPTDecimalAdd(coord, minorInterval); for ( NSUInteger minorTickIndex = 0; minorTickIndex < minorTickCount; minorTickIndex++ ) { - if ( CPTDecimalGreaterThan(minorCoord, rangeMax) ) { + if ( CPTDecimalGreaterThan(minorCoord, rangeMax)) { break; } [minorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:minorCoord]]; @@ -950,11 +1012,11 @@ -(void)generateFixedIntervalMajorTickLocations:(CPTNumberSet __autoreleasing *)n * @param newMajorLocations A new NSSet containing the major tick locations. * @param newMinorLocations A new NSSet containing the minor tick locations. */ --(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet __autoreleasing *)newMinorLocations +-(void)autoGenerateMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet *__autoreleasing *)newMinorLocations { // Create sets for locations - CPTMutableNumberSet majorLocations = [NSMutableSet set]; - CPTMutableNumberSet minorLocations = [NSMutableSet set]; + CPTMutableNumberSet *majorLocations = [NSMutableSet set]; + CPTMutableNumberSet *minorLocations = [NSMutableSet set]; // Get plot range CPTMutablePlotRange *range = [[self.plotSpace plotRangeForCoordinate:self.coordinate] mutableCopy]; @@ -975,7 +1037,7 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo case CPTScaleTypeLog: // supported scale type--check range - if ( (range.minLimitDouble <= 0.0) || (range.maxLimitDouble <= 0.0) ) { + if ((range.minLimitDouble <= 0.0) || (range.maxLimitDouble <= 0.0)) { valid = NO; } break; @@ -1002,7 +1064,7 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo double length = fabs(range.lengthDouble); // Filter troublesome values and return empty sets - if ( length != 0.0 ) { + if ((length != 0.0) && !isinf(length)) { switch ( scaleType ) { case CPTScaleTypeLinear: { @@ -1029,16 +1091,16 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo majorInterval = CPTNiceLength(range.lengthDecimal); } else { - majorInterval = CPTDecimalDivide( range.lengthDecimal, CPTDecimalFromUnsignedInteger(numTicks - 1) ); + majorInterval = CPTDecimalDivide(range.lengthDecimal, CPTDecimalFromUnsignedInteger(numTicks - 1)); majorInterval = CPTNiceNum(majorInterval); } - if ( CPTDecimalLessThan(majorInterval, zero) ) { - majorInterval = CPTDecimalMultiply( majorInterval, CPTDecimalFromInteger(-1) ); + if ( CPTDecimalLessThan(majorInterval, zero)) { + majorInterval = CPTDecimalMultiply(majorInterval, CPTDecimalFromInteger(-1)); } NSDecimal minorInterval; if ( minorTicks > 1 ) { - minorInterval = CPTDecimalDivide( majorInterval, CPTDecimalFromUnsignedInteger(minorTicks) ); + minorInterval = CPTDecimalDivide(majorInterval, CPTDecimalFromUnsignedInteger(minorTicks)); } else { minorInterval = zero; @@ -1056,26 +1118,26 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo NSDecimalRound(&finalIndex, &finalIndex, 0, NSRoundUp); // Iterate through the indexes with visible ticks and build the locations sets - for ( NSDecimal i = initialIndex; CPTDecimalLessThanOrEqualTo(i, finalIndex); i = CPTDecimalAdd(i, one) ) { + for ( NSDecimal i = initialIndex; CPTDecimalLessThanOrEqualTo(i, finalIndex); i = CPTDecimalAdd(i, one)) { NSDecimal pointLocation = CPTDecimalMultiply(majorInterval, i); NSDecimal minorPointLocation = pointLocation; for ( NSUInteger j = 1; j < minorTicks; j++ ) { minorPointLocation = CPTDecimalAdd(minorPointLocation, minorInterval); - if ( CPTDecimalLessThan(minorPointLocation, minLimit) ) { + if ( CPTDecimalLessThan(minorPointLocation, minLimit)) { continue; } - if ( CPTDecimalGreaterThan(minorPointLocation, maxLimit) ) { + if ( CPTDecimalGreaterThan(minorPointLocation, maxLimit)) { continue; } [minorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:minorPointLocation]]; } - if ( CPTDecimalLessThan(pointLocation, minLimit) ) { + if ( CPTDecimalLessThan(pointLocation, minLimit)) { continue; } - if ( CPTDecimalGreaterThan(pointLocation, maxLimit) ) { + if ( CPTDecimalGreaterThan(pointLocation, maxLimit)) { continue; } [majorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:pointLocation]]; @@ -1088,19 +1150,19 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo double minLimit = range.minLimitDouble; double maxLimit = range.maxLimitDouble; - if ( (minLimit > 0.0) && (maxLimit > 0.0) ) { + if ((minLimit > 0.0) && (maxLimit > 0.0)) { // Determine interval value length = log10(maxLimit / minLimit); double interval = signbit(length) ? -1.0 : 1.0; - double intervalStep = pow( 10.0, fabs(interval) ); + double intervalStep = pow(10.0, fabs(interval)); // Determine minor interval - double minorInterval = intervalStep * 0.9 * pow( 10.0, floor( log10(minLimit) ) ) / minorTicks; + double minorInterval = intervalStep * 0.9 * pow(10.0, floor(log10(minLimit))) / minorTicks; // Determine the initial and final major indexes for the actual visible range - NSInteger initialIndex = (NSInteger)lrint( floor( log10( minLimit / fabs(interval) ) ) ); // can be negative - NSInteger finalIndex = (NSInteger)lrint( ceil( log10( maxLimit / fabs(interval) ) ) ); // can be negative + NSInteger initialIndex = (NSInteger)lrint(floor(log10(minLimit / fabs(interval)))); // can be negative + NSInteger finalIndex = (NSInteger)lrint(ceil(log10(maxLimit / fabs(interval)))); // can be negative // Iterate through the indexes with visible ticks and build the locations sets for ( NSInteger i = initialIndex; i <= finalIndex; i++ ) { @@ -1138,14 +1200,14 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo double modMinLimit = CPTLogModulus(minLimit); double modMaxLimit = CPTLogModulus(maxLimit); - double multiplier = pow( 10.0, floor( log10(length) ) ); + double multiplier = pow(10.0, floor(log10(length))); multiplier = (multiplier < 1.0) ? multiplier : 1.0; double intervalStep = 10.0; // Determine the initial and final major indexes for the actual visible range - NSInteger initialIndex = (NSInteger)lrint( floor(modMinLimit / multiplier) ); // can be negative - NSInteger finalIndex = (NSInteger)lrint( ceil(modMaxLimit / multiplier) ); // can be negative + NSInteger initialIndex = (NSInteger)lrint(floor(modMinLimit / multiplier)); // can be negative + NSInteger finalIndex = (NSInteger)lrint(ceil(modMaxLimit / multiplier)); // can be negative if ( initialIndex < 0 ) { // Determine minor interval @@ -1156,10 +1218,10 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo double sign = -multiplier; if ( multiplier < 1.0 ) { - pointLocation = sign * pow(10.0, fabs( (double)i ) - 1.0); + pointLocation = sign * pow(10.0, fabs((double)i) - 1.0); } else { - pointLocation = sign * pow( 10.0, fabs( (double)i ) ); + pointLocation = sign * pow(10.0, fabs((double)i)); } for ( NSUInteger j = 1; j < minorTicks; j++ ) { @@ -1196,10 +1258,10 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo double sign = multiplier; if ( multiplier < 1.0 ) { - pointLocation = sign * pow(10.0, fabs( (double)i ) - 1.0); + pointLocation = sign * pow(10.0, fabs((double)i) - 1.0); } else { - pointLocation = sign * pow( 10.0, fabs( (double)i ) ); + pointLocation = sign * pow(10.0, fabs((double)i)); } for ( NSUInteger j = 1; j < minorTicks; j++ ) { @@ -1245,10 +1307,10 @@ -(void)autoGenerateMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLo * @param newMajorLocations A new NSSet containing the major tick locations. * @param newMinorLocations A new NSSet containing the minor tick locations. */ --(void)generateEqualMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet __autoreleasing *)newMinorLocations +-(void)generateEqualMajorTickLocations:(CPTNumberSet *__autoreleasing *)newMajorLocations minorTickLocations:(CPTNumberSet *__autoreleasing *)newMinorLocations { - CPTMutableNumberSet majorLocations = [NSMutableSet set]; - CPTMutableNumberSet minorLocations = [NSMutableSet set]; + CPTMutableNumberSet *majorLocations = [NSMutableSet set]; + CPTMutableNumberSet *minorLocations = [NSMutableSet set]; CPTMutablePlotRange *range = [[self.plotSpace plotRangeForCoordinate:self.coordinate] mutableCopy]; @@ -1268,15 +1330,15 @@ -(void)generateEqualMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorL if ( majorTickCount < 2 ) { majorTickCount = 2; } - NSDecimal majorInterval = CPTDecimalDivide( range.lengthDecimal, CPTDecimalFromUnsignedInteger(majorTickCount - 1) ); - if ( CPTDecimalLessThan(majorInterval, zero) ) { - majorInterval = CPTDecimalMultiply( majorInterval, CPTDecimalFromInteger(-1) ); + NSDecimal majorInterval = CPTDecimalDivide(range.lengthDecimal, CPTDecimalFromUnsignedInteger(majorTickCount - 1)); + if ( CPTDecimalLessThan(majorInterval, zero)) { + majorInterval = CPTDecimalMultiply(majorInterval, CPTDecimalFromInteger(-1)); } NSDecimal minorInterval; NSUInteger minorTickCount = self.minorTicksPerInterval; if ( minorTickCount > 0 ) { - minorInterval = CPTDecimalDivide( majorInterval, CPTDecimalFromUnsignedInteger(minorTickCount + 1) ); + minorInterval = CPTDecimalDivide(majorInterval, CPTDecimalFromUnsignedInteger(minorTickCount + 1)); } else { minorInterval = zero; @@ -1285,7 +1347,7 @@ -(void)generateEqualMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorL NSDecimal coord = rangeMin; // Set tick locations - while ( CPTDecimalLessThanOrEqualTo(coord, rangeMax) ) { + while ( CPTDecimalLessThanOrEqualTo(coord, rangeMax)) { // Major tick [majorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:coord]]; @@ -1294,7 +1356,7 @@ -(void)generateEqualMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorL NSDecimal minorCoord = CPTDecimalAdd(coord, minorInterval); for ( NSUInteger minorTickIndex = 0; minorTickIndex < minorTickCount; minorTickIndex++ ) { - if ( CPTDecimalGreaterThan(minorCoord, rangeMax) ) { + if ( CPTDecimalGreaterThan(minorCoord, rangeMax)) { break; } [minorLocations addObject:[NSDecimalNumber decimalNumberWithDecimal:minorCoord]]; @@ -1319,32 +1381,32 @@ -(void)generateEqualMajorTickLocations:(CPTNumberSet __autoreleasing *)newMajorL NSDecimal CPTNiceNum(NSDecimal x) { NSDecimal zero = CPTDecimalFromInteger(0); - NSDecimal minusOne; - if ( CPTDecimalEquals(x, zero) ) { + if ( CPTDecimalEquals(x, zero)) { return zero; } + NSDecimal minusOne = CPTDecimalFromInteger(-1); + BOOL xIsNegative = CPTDecimalLessThan(x, zero); if ( xIsNegative ) { - minusOne = CPTDecimalFromInteger(-1); - x = CPTDecimalMultiply(x, minusOne); + x = CPTDecimalMultiply(x, minusOne); } - short exponent = (short)lrint( floor( log10( CPTDecimalDoubleValue(x) ) ) ); + short exponent = (short)lrint(floor(log10(CPTDecimalDoubleValue(x)))); NSDecimal fractionPart; NSDecimalMultiplyByPowerOf10(&fractionPart, &x, -exponent, NSRoundPlain); NSDecimal roundedFraction; - if ( CPTDecimalLessThan( fractionPart, CPTDecimalFromDouble(1.5) ) ) { + if ( CPTDecimalLessThan(fractionPart, CPTDecimalFromDouble(1.5))) { roundedFraction = CPTDecimalFromInteger(1); } - else if ( CPTDecimalLessThan( fractionPart, CPTDecimalFromInteger(3) ) ) { + else if ( CPTDecimalLessThan(fractionPart, CPTDecimalFromInteger(3))) { roundedFraction = CPTDecimalFromInteger(2); } - else if ( CPTDecimalLessThan( fractionPart, CPTDecimalFromInteger(7) ) ) { + else if ( CPTDecimalLessThan(fractionPart, CPTDecimalFromInteger(7))) { roundedFraction = CPTDecimalFromInteger(5); } else { @@ -1364,30 +1426,30 @@ NSDecimal CPTNiceNum(NSDecimal x) /** * @internal * @brief Determines a @quote{nice} range length (a multiple of @num{2}, @num{5}, or @num{10}) less than or equal to the given length. - * @param x The length to round. + * @param length The length to round. */ NSDecimal CPTNiceLength(NSDecimal length) { NSDecimal zero = CPTDecimalFromInteger(0); - NSDecimal minusOne; - if ( CPTDecimalEquals(length, zero) ) { + if ( CPTDecimalEquals(length, zero)) { return zero; } + NSDecimal minusOne = CPTDecimalFromInteger(-1); + BOOL isNegative = CPTDecimalLessThan(length, zero); if ( isNegative ) { - minusOne = CPTDecimalFromInteger(-1); - length = CPTDecimalMultiply(length, minusOne); + length = CPTDecimalMultiply(length, minusOne); } NSDecimal roundedNumber; - if ( CPTDecimalGreaterThan( length, CPTDecimalFromInteger(10) ) ) { + if ( CPTDecimalGreaterThan(length, CPTDecimalFromInteger(10))) { NSDecimalRound(&roundedNumber, &length, 0, NSRoundDown); } else { - short exponent = (short)lrint( floor( log10( CPTDecimalDoubleValue(length) ) ) ) - 1; + short exponent = (short)lrint(floor(log10(CPTDecimalDoubleValue(length)))) - 1; NSDecimalRound(&roundedNumber, &length, -exponent, NSRoundDown); } @@ -1404,12 +1466,12 @@ NSDecimal CPTNiceLength(NSDecimal length) * @param allLocations A set of tick locations. * @return The filtered set of tick locations. */ --(CPTNumberSet)filteredTickLocations:(CPTNumberSet)allLocations +-(nullable CPTNumberSet *)filteredTickLocations:(nullable CPTNumberSet *)allLocations { - CPTPlotRangeArray exclusionRanges = self.labelExclusionRanges; + CPTPlotRangeArray *exclusionRanges = self.labelExclusionRanges; if ( exclusionRanges ) { - CPTMutableNumberSet filteredLocations = [allLocations mutableCopy]; + CPTMutableNumberSet *filteredLocations = [allLocations mutableCopy]; for ( CPTPlotRange *range in exclusionRanges ) { for ( NSNumber *location in allLocations ) { if ( [range containsNumber:location] ) { @@ -1430,7 +1492,7 @@ -(CPTNumberSet)filteredTickLocations:(CPTNumberSet)allLocations * @param allLocations A set of major tick locations. * @return The filtered set. **/ --(CPTNumberSet)filteredMajorTickLocations:(CPTNumberSet)allLocations +-(nullable CPTNumberSet *)filteredMajorTickLocations:(nullable CPTNumberSet *)allLocations { return [self filteredTickLocations:allLocations]; } @@ -1439,7 +1501,7 @@ -(CPTNumberSet)filteredMajorTickLocations:(CPTNumberSet)allLocations * @param allLocations A set of minor tick locations. * @return The filtered set. **/ --(CPTNumberSet)filteredMinorTickLocations:(CPTNumberSet)allLocations +-(nullable CPTNumberSet *)filteredMinorTickLocations:(nullable CPTNumberSet *)allLocations { return [self filteredTickLocations:allLocations]; } @@ -1475,7 +1537,7 @@ -(CGFloat)tickOffset * @param labeledRange A plot range used to filter the generated labels. If @nil, no filtering is done. * @param useMajorAxisLabels If @YES, label the major ticks, otherwise label the minor ticks. **/ --(void)updateAxisLabelsAtLocations:(CPTNumberSet)locations inRange:(CPTPlotRange *)labeledRange useMajorAxisLabels:(BOOL)useMajorAxisLabels +-(void)updateAxisLabelsAtLocations:(nullable CPTNumberSet *)locations inRange:(nullable CPTPlotRange *)labeledRange useMajorAxisLabels:(BOOL)useMajorAxisLabels { CPTAlignment theLabelAlignment; CPTSign theLabelDirection; @@ -1486,13 +1548,16 @@ -(void)updateAxisLabelsAtLocations:(CPTNumberSet)locations inRange:(CPTPlotRange BOOL theLabelFormatterChanged; CPTShadow *theShadow; - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; if ( useMajorAxisLabels ) { - if ( [theDelegate respondsToSelector:@selector(axis:shouldUpdateAxisLabelsAtLocations:)] ) { - BOOL shouldContinue = [theDelegate axis:self shouldUpdateAxisLabelsAtLocations:locations]; - if ( !shouldContinue ) { - return; + if ( locations.count > 0 ) { + if ( [theDelegate respondsToSelector:@selector(axis:shouldUpdateAxisLabelsAtLocations:)] ) { + CPTNumberSet *locationSet = locations; + BOOL shouldContinue = [theDelegate axis:self shouldUpdateAxisLabelsAtLocations:locationSet]; + if ( !shouldContinue ) { + return; + } } } theLabelAlignment = self.labelAlignment; @@ -1505,10 +1570,13 @@ -(void)updateAxisLabelsAtLocations:(CPTNumberSet)locations inRange:(CPTPlotRange theShadow = self.labelShadow; } else { - if ( [theDelegate respondsToSelector:@selector(axis:shouldUpdateMinorAxisLabelsAtLocations:)] ) { - BOOL shouldContinue = [theDelegate axis:self shouldUpdateMinorAxisLabelsAtLocations:locations]; - if ( !shouldContinue ) { - return; + if ( locations.count > 0 ) { + if ( [theDelegate respondsToSelector:@selector(axis:shouldUpdateMinorAxisLabelsAtLocations:)] ) { + CPTNumberSet *locationSet = locations; + BOOL shouldContinue = [theDelegate axis:self shouldUpdateMinorAxisLabelsAtLocations:locationSet]; + if ( !shouldContinue ) { + return; + } } } theLabelAlignment = self.minorTickLabelAlignment; @@ -1521,7 +1589,7 @@ -(void)updateAxisLabelsAtLocations:(CPTNumberSet)locations inRange:(CPTPlotRange theShadow = self.minorTickLabelShadow; } - if ( (locations.count == 0) || !theLabelTextStyle || !theLabelFormatter ) { + if ((locations.count == 0) || !theLabelTextStyle || !theLabelFormatter ) { if ( useMajorAxisLabels ) { self.axisLabels = nil; } @@ -1531,9 +1599,9 @@ -(void)updateAxisLabelsAtLocations:(CPTNumberSet)locations inRange:(CPTPlotRange return; } - CPTDictionary textAttributes = [theLabelTextStyle attributes]; - BOOL hasAttributedFormatter = ([theLabelFormatter attributedStringForObjectValue:[NSDecimalNumber zero] - withDefaultAttributes:textAttributes] != nil); + CPTDictionary *textAttributes = theLabelTextStyle.attributes; + BOOL hasAttributedFormatter = ([theLabelFormatter attributedStringForObjectValue:[NSDecimalNumber zero] + withDefaultAttributes:textAttributes] != nil); CPTPlotSpace *thePlotSpace = self.plotSpace; CPTCoordinate myCoordinate = self.coordinate; @@ -1545,14 +1613,14 @@ -(void)updateAxisLabelsAtLocations:(CPTNumberSet)locations inRange:(CPTPlotRange theLabelDirection = direction; } - if ( (direction == CPTSignNone) || (theLabelDirection == direction) ) { + if ((direction == CPTSignNone) || (theLabelDirection == direction)) { theLabelOffset += self.tickOffset; } CPTPlotArea *thePlotArea = self.plotArea; [thePlotArea setAxisSetLayersForType:CPTGraphLayerTypeAxisLabels]; - CPTMutableAxisLabelSet oldAxisLabels; + CPTMutableAxisLabelSet *oldAxisLabels; if ( useMajorAxisLabels ) { oldAxisLabels = [self.axisLabels mutableCopy]; } @@ -1560,10 +1628,10 @@ -(void)updateAxisLabelsAtLocations:(CPTNumberSet)locations inRange:(CPTPlotRange oldAxisLabels = [self.minorTickAxisLabels mutableCopy]; } - CPTMutableAxisLabelSet newAxisLabels = [[NSMutableSet alloc] initWithCapacity:locations.count]; - CPTAxisLabel *blankLabel = [[CPTAxisLabel alloc] initWithText:nil textStyle:nil]; - CPTAxisLabelGroup *axisLabelGroup = thePlotArea.axisLabelGroup; - CPTLayer *lastLayer = nil; + CPTMutableAxisLabelSet *newAxisLabels = [[NSMutableSet alloc] initWithCapacity:locations.count]; + CPTAxisLabel *blankLabel = [[CPTAxisLabel alloc] initWithText:nil textStyle:nil]; + CPTAxisLabelGroup *axisLabelGroup = thePlotArea.axisLabelGroup; + CPTLayer *lastLayer = nil; for ( NSDecimalNumber *tickLocation in locations ) { if ( labeledRange && ![labeledRange containsNumber:tickLocation] ) { @@ -1664,14 +1732,14 @@ -(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; } - CPTNumberSet newMajorLocations = nil; - CPTNumberSet newMinorLocations = nil; + CPTNumberSet *newMajorLocations = nil; + CPTNumberSet *newMinorLocations = nil; switch ( self.labelingPolicy ) { case CPTAxisLabelingPolicyNone: @@ -1768,7 +1836,12 @@ -(void)updateCustomTickLabels if ( range.lengthDouble != 0.0 ) { CPTCoordinate orthogonalCoordinate = CPTOrthogonalCoordinate(self.coordinate); - CPTSign direction = self.tickDirection; + + CPTSign direction = self.tickLabelDirection; + + if ( direction == CPTSignNone ) { + direction = self.tickDirection; + } for ( CPTAxisLabel *label in self.axisLabels ) { BOOL visible = [range containsNumber:label.tickLocation]; @@ -1802,7 +1875,7 @@ -(void)updateMajorTickLabelOffsets CGFloat majorOffset = self.labelOffset; - if ( (direction == CPTSignNone) || (labelDirection == direction) ) { + if ((direction == CPTSignNone) || (labelDirection == direction)) { majorOffset += self.tickOffset; } @@ -1822,7 +1895,7 @@ -(void)updateMinorTickLabelOffsets CGFloat minorOffset = self.minorTickLabelOffset; - if ( (direction == CPTSignNone) || (labelDirection == direction) ) { + if ((direction == CPTSignNone) || (labelDirection == direction)) { minorOffset += self.tickOffset; } @@ -1874,7 +1947,7 @@ -(void)updateMinorTickLabels #pragma mark - #pragma mark Titles --(NSNumber *)defaultTitleLocation +-(nonnull NSNumber *)defaultTitleLocation { return @(NAN); } @@ -1927,14 +2000,15 @@ -(void)layoutSublayers /** @brief Add a background limit band. * @param limitBand The new limit band. **/ --(void)addBackgroundLimitBand:(CPTLimitBand *)limitBand +-(void)addBackgroundLimitBand:(nullable CPTLimitBand *)limitBand { if ( limitBand ) { if ( !self.mutableBackgroundLimitBands ) { self.mutableBackgroundLimitBands = [NSMutableArray array]; } - [self.mutableBackgroundLimitBands addObject:limitBand]; + CPTLimitBand *band = limitBand; + [self.mutableBackgroundLimitBands addObject:band]; CPTPlotArea *thePlotArea = self.plotArea; [thePlotArea setNeedsDisplay]; @@ -1944,10 +2018,11 @@ -(void)addBackgroundLimitBand:(CPTLimitBand *)limitBand /** @brief Remove a background limit band. * @param limitBand The limit band to be removed. **/ --(void)removeBackgroundLimitBand:(CPTLimitBand *)limitBand +-(void)removeBackgroundLimitBand:(nullable CPTLimitBand *)limitBand { if ( limitBand ) { - [self.mutableBackgroundLimitBands removeObject:limitBand]; + CPTLimitBand *band = limitBand; + [self.mutableBackgroundLimitBands removeObject:band]; CPTPlotArea *thePlotArea = self.plotArea; [thePlotArea setNeedsDisplay]; @@ -1994,7 +2069,7 @@ -(void)removeAllBackgroundLimitBands * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTGraph *theGraph = self.graph; @@ -2002,7 +2077,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; // Tick labels if ( [theDelegate respondsToSelector:@selector(axis:labelTouchDown:)] || @@ -2014,7 +2089,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact if ( contentLayer && !contentLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:contentLayer]; - if ( CGRectContainsPoint(contentLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(contentLayer.bounds, labelPoint)) { self.pointingDeviceDownLabel = label; BOOL handled = NO; @@ -2046,7 +2121,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact if ( contentLayer && !contentLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:contentLayer]; - if ( CGRectContainsPoint(contentLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(contentLayer.bounds, labelPoint)) { self.pointingDeviceDownTickLabel = label; BOOL handled = NO; @@ -2099,7 +2174,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTAxisLabel *selectedDownLabel = self.pointingDeviceDownLabel; CPTAxisLabel *selectedDownTickLabel = self.pointingDeviceDownTickLabel; @@ -2113,7 +2188,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; // Tick labels if ( [theDelegate respondsToSelector:@selector(axis:labelTouchUp:)] || @@ -2125,7 +2200,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio if ( contentLayer && !contentLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:contentLayer]; - if ( CGRectContainsPoint(contentLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(contentLayer.bounds, labelPoint)) { BOOL handled = NO; if ( [theDelegate respondsToSelector:@selector(axis:labelTouchUp:)] ) { @@ -2168,7 +2243,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio if ( contentLayer && !contentLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:contentLayer]; - if ( CGRectContainsPoint(contentLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(contentLayer.bounds, labelPoint)) { BOOL handled = NO; if ( [theDelegate respondsToSelector:@selector(axis:minorTickTouchUp:)] ) { @@ -2211,7 +2286,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio /// @cond --(void)setAxisLabels:(CPTAxisLabelSet)newLabels +-(void)setAxisLabels:(nullable CPTAxisLabelSet *)newLabels { if ( newLabels != axisLabels ) { if ( self.labelsUpdated ) { @@ -2247,11 +2322,16 @@ -(void)setAxisLabels:(CPTAxisLabelSet)newLabels } } - [self updateMajorTickLabels]; + if ( self.labelingPolicy == CPTAxisLabelingPolicyNone ) { + [self updateCustomTickLabels]; + } + else { + [self updateMajorTickLabels]; + } } } --(void)setMinorTickAxisLabels:(CPTAxisLabelSet)newLabels +-(void)setMinorTickAxisLabels:(nullable CPTAxisLabelSet *)newLabels { if ( newLabels != minorTickAxisLabels ) { if ( self.labelsUpdated ) { @@ -2287,20 +2367,25 @@ -(void)setMinorTickAxisLabels:(CPTAxisLabelSet)newLabels } } - [self updateMinorTickLabels]; + if ( self.labelingPolicy == CPTAxisLabelingPolicyNone ) { + [self updateCustomTickLabels]; + } + else { + [self updateMinorTickLabels]; + } } } --(void)setLabelTextStyle:(CPTTextStyle *)newStyle +-(void)setLabelTextStyle:(nullable CPTTextStyle *)newStyle { - if ( newStyle != labelTextStyle ) { + if ( labelTextStyle != newStyle ) { labelTextStyle = [newStyle copy]; Class textLayerClass = [CPTTextLayer class]; for ( CPTAxisLabel *axisLabel in self.axisLabels ) { CPTLayer *contentLayer = axisLabel.contentLayer; if ( [contentLayer isKindOfClass:textLayerClass] ) { - [(CPTTextLayer *)contentLayer setTextStyle : labelTextStyle]; + ((CPTTextLayer *)contentLayer).textStyle = labelTextStyle; } } @@ -2308,16 +2393,16 @@ -(void)setLabelTextStyle:(CPTTextStyle *)newStyle } } --(void)setMinorTickLabelTextStyle:(CPTTextStyle *)newStyle +-(void)setMinorTickLabelTextStyle:(nullable CPTTextStyle *)newStyle { - if ( newStyle != minorTickLabelTextStyle ) { + if ( minorTickLabelTextStyle != newStyle ) { minorTickLabelTextStyle = [newStyle copy]; Class textLayerClass = [CPTTextLayer class]; for ( CPTAxisLabel *axisLabel in self.minorTickAxisLabels ) { CPTLayer *contentLayer = axisLabel.contentLayer; if ( [contentLayer isKindOfClass:textLayerClass] ) { - [(CPTTextLayer *)contentLayer setTextStyle : minorTickLabelTextStyle]; + ((CPTTextLayer *)contentLayer).textStyle = minorTickLabelTextStyle; } } @@ -2325,7 +2410,7 @@ -(void)setMinorTickLabelTextStyle:(CPTTextStyle *)newStyle } } --(void)setAxisTitle:(CPTAxisTitle *)newTitle +-(void)setAxisTitle:(nullable CPTAxisTitle *)newTitle { if ( newTitle != axisTitle ) { [axisTitle.contentLayer removeFromSuperlayer]; @@ -2345,7 +2430,7 @@ -(void)setAxisTitle:(CPTAxisTitle *)newTitle } } --(CPTAxisTitle *)axisTitle +-(nullable CPTAxisTitle *)axisTitle { if ( !axisTitle ) { CPTAxisTitle *newTitle = nil; @@ -2366,7 +2451,7 @@ -(CPTAxisTitle *)axisTitle return axisTitle; } --(void)setTitleTextStyle:(CPTTextStyle *)newStyle +-(void)setTitleTextStyle:(nullable CPTTextStyle *)newStyle { if ( newStyle != titleTextStyle ) { titleTextStyle = [newStyle copy]; @@ -2378,7 +2463,7 @@ -(void)setTitleTextStyle:(CPTTextStyle *)newStyle CPTLayer *contentLayer = self.axisTitle.contentLayer; if ( [contentLayer isKindOfClass:[CPTTextLayer class]] ) { - ( (CPTTextLayer *)contentLayer ).textStyle = titleTextStyle; + ((CPTTextLayer *)contentLayer).textStyle = titleTextStyle; [self updateAxisTitle]; } } @@ -2414,7 +2499,7 @@ -(void)setTitleDirection:(CPTSign)newDirection } } --(void)setTitle:(NSString *)newTitle +-(void)setTitle:(nullable NSString *)newTitle { if ( newTitle != title ) { title = [newTitle copy]; @@ -2427,7 +2512,7 @@ -(void)setTitle:(NSString *)newTitle if ( title ) { CPTLayer *contentLayer = self.axisTitle.contentLayer; if ( [contentLayer isKindOfClass:[CPTTextLayer class]] ) { - ( (CPTTextLayer *)contentLayer ).text = title; + ((CPTTextLayer *)contentLayer).text = title; [self updateAxisTitle]; } } @@ -2438,7 +2523,7 @@ -(void)setTitle:(NSString *)newTitle } } --(void)setAttributedTitle:(NSAttributedString *)newTitle +-(void)setAttributedTitle:(nullable NSAttributedString *)newTitle { if ( newTitle != attributedTitle ) { attributedTitle = [newTitle copy]; @@ -2453,7 +2538,7 @@ -(void)setAttributedTitle:(NSAttributedString *)newTitle CPTLayer *contentLayer = self.axisTitle.contentLayer; if ( [contentLayer isKindOfClass:[CPTTextLayer class]] ) { - ( (CPTTextLayer *)contentLayer ).attributedText = attributedTitle; + ((CPTTextLayer *)contentLayer).attributedText = attributedTitle; [self updateAxisTitle]; } } @@ -2469,12 +2554,13 @@ -(void)setAttributedTitle:(NSAttributedString *)newTitle } } --(void)setTitleLocation:(NSNumber *)newLocation +-(void)setTitleLocation:(nullable NSNumber *)newLocation { BOOL needsUpdate = YES; if ( newLocation ) { - needsUpdate = ![titleLocation isEqualToNumber:newLocation]; + NSNumber *location = newLocation; + needsUpdate = ![titleLocation isEqualToNumber:location]; } if ( needsUpdate ) { @@ -2483,9 +2569,9 @@ -(void)setTitleLocation:(NSNumber *)newLocation } } --(NSNumber *)titleLocation +-(nullable NSNumber *)titleLocation { - if ( isnan(titleLocation.doubleValue) ) { + if ( isnan(titleLocation.doubleValue)) { return self.defaultTitleLocation; } else { @@ -2493,7 +2579,7 @@ -(NSNumber *)titleLocation } } --(void)setLabelExclusionRanges:(CPTPlotRangeArray)ranges +-(void)setLabelExclusionRanges:(nullable CPTPlotRangeArray *)ranges { if ( ranges != labelExclusionRanges ) { labelExclusionRanges = ranges; @@ -2523,7 +2609,7 @@ -(void)setNeedsRelabel:(BOOL)newNeedsRelabel } } --(void)setMajorTickLocations:(CPTNumberSet)newLocations +-(void)setMajorTickLocations:(nullable CPTNumberSet *)newLocations { if ( newLocations != majorTickLocations ) { majorTickLocations = newLocations; @@ -2540,7 +2626,7 @@ -(void)setMajorTickLocations:(CPTNumberSet)newLocations } } --(void)setMinorTickLocations:(CPTNumberSet)newLocations +-(void)setMinorTickLocations:(nullable CPTNumberSet *)newLocations { if ( newLocations != minorTickLocations ) { minorTickLocations = newLocations; @@ -2637,7 +2723,7 @@ -(void)setMinorTickLabelAlignment:(CPTAlignment)newAlignment } } --(void)setLabelShadow:(CPTShadow *)newLabelShadow +-(void)setLabelShadow:(nullable CPTShadow *)newLabelShadow { if ( newLabelShadow != labelShadow ) { labelShadow = newLabelShadow; @@ -2648,7 +2734,7 @@ -(void)setLabelShadow:(CPTShadow *)newLabelShadow } } --(void)setMinorTickLabelShadow:(CPTShadow *)newLabelShadow +-(void)setMinorTickLabelShadow:(nullable CPTShadow *)newLabelShadow { if ( newLabelShadow != minorTickLabelShadow ) { minorTickLabelShadow = newLabelShadow; @@ -2659,7 +2745,7 @@ -(void)setMinorTickLabelShadow:(CPTShadow *)newLabelShadow } } --(void)setPlotSpace:(CPTPlotSpace *)newSpace +-(void)setPlotSpace:(nullable CPTPlotSpace *)newSpace { if ( newSpace != plotSpace ) { plotSpace = newSpace; @@ -2675,7 +2761,7 @@ -(void)setCoordinate:(CPTCoordinate)newCoordinate } } --(void)setAxisLineStyle:(CPTLineStyle *)newLineStyle +-(void)setAxisLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( newLineStyle != axisLineStyle ) { axisLineStyle = [newLineStyle copy]; @@ -2683,7 +2769,7 @@ -(void)setAxisLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setMajorTickLineStyle:(CPTLineStyle *)newLineStyle +-(void)setMajorTickLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( newLineStyle != majorTickLineStyle ) { majorTickLineStyle = [newLineStyle copy]; @@ -2691,7 +2777,7 @@ -(void)setMajorTickLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setMinorTickLineStyle:(CPTLineStyle *)newLineStyle +-(void)setMinorTickLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( newLineStyle != minorTickLineStyle ) { minorTickLineStyle = [newLineStyle copy]; @@ -2699,7 +2785,7 @@ -(void)setMinorTickLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setMajorGridLineStyle:(CPTLineStyle *)newLineStyle +-(void)setMajorGridLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( newLineStyle != majorGridLineStyle ) { majorGridLineStyle = [newLineStyle copy]; @@ -2729,7 +2815,7 @@ -(void)setMajorGridLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setMinorGridLineStyle:(CPTLineStyle *)newLineStyle +-(void)setMinorGridLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( newLineStyle != minorGridLineStyle ) { minorGridLineStyle = [newLineStyle copy]; @@ -2759,7 +2845,7 @@ -(void)setMinorGridLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setAxisLineCapMin:(CPTLineCap *)newAxisLineCapMin +-(void)setAxisLineCapMin:(nullable CPTLineCap *)newAxisLineCapMin { if ( newAxisLineCapMin != axisLineCapMin ) { axisLineCapMin = [newAxisLineCapMin copy]; @@ -2767,7 +2853,7 @@ -(void)setAxisLineCapMin:(CPTLineCap *)newAxisLineCapMin } } --(void)setAxisLineCapMax:(CPTLineCap *)newAxisLineCapMax +-(void)setAxisLineCapMax:(nullable CPTLineCap *)newAxisLineCapMax { if ( newAxisLineCapMax != axisLineCapMax ) { axisLineCapMax = [newAxisLineCapMax copy]; @@ -2775,7 +2861,7 @@ -(void)setAxisLineCapMax:(CPTLineCap *)newAxisLineCapMax } } --(void)setLabelingOrigin:(NSNumber *)newLabelingOrigin +-(void)setLabelingOrigin:(nonnull NSNumber *)newLabelingOrigin { BOOL needsUpdate = YES; @@ -2790,12 +2876,13 @@ -(void)setLabelingOrigin:(NSNumber *)newLabelingOrigin } } --(void)setMajorIntervalLength:(NSNumber *)newIntervalLength +-(void)setMajorIntervalLength:(nullable NSNumber *)newIntervalLength { BOOL needsUpdate = YES; if ( newIntervalLength ) { - needsUpdate = ![majorIntervalLength isEqualToNumber:newIntervalLength]; + NSNumber *interval = newIntervalLength; + needsUpdate = ![majorIntervalLength isEqualToNumber:interval]; } if ( needsUpdate ) { @@ -2832,7 +2919,7 @@ -(void)setPreferredNumberOfMajorTicks:(NSUInteger)newPreferredNumberOfMajorTicks } } --(void)setLabelFormatter:(NSFormatter *)newTickLabelFormatter +-(void)setLabelFormatter:(nullable NSFormatter *)newTickLabelFormatter { if ( newTickLabelFormatter != labelFormatter ) { labelFormatter = newTickLabelFormatter; @@ -2842,7 +2929,7 @@ -(void)setLabelFormatter:(NSFormatter *)newTickLabelFormatter } } --(void)setMinorTickLabelFormatter:(NSFormatter *)newMinorTickLabelFormatter +-(void)setMinorTickLabelFormatter:(nullable NSFormatter *)newMinorTickLabelFormatter { if ( newMinorTickLabelFormatter != minorTickLabelFormatter ) { minorTickLabelFormatter = newMinorTickLabelFormatter; @@ -2886,9 +2973,9 @@ -(void)setMinorTickLabelDirection:(CPTSign)newDirection } } --(void)setGridLinesRange:(CPTPlotRange *)newRange +-(void)setGridLinesRange:(nullable CPTPlotRange *)newRange { - if ( newRange != gridLinesRange ) { + if ( gridLinesRange != newRange ) { gridLinesRange = [newRange copy]; if ( self.separateLayers ) { CPTGridLines *gridlines = self.majorGridLines; @@ -2905,7 +2992,7 @@ -(void)setGridLinesRange:(CPTPlotRange *)newRange } } --(void)setPlotArea:(CPTPlotArea *)newPlotArea +-(void)setPlotArea:(nullable CPTPlotArea *)newPlotArea { if ( newPlotArea != plotArea ) { plotArea = newPlotArea; @@ -2983,12 +3070,15 @@ -(void)setPlotArea:(CPTPlotArea *)newPlotArea for ( CPTAxisLabel *label in self.axisLabels ) { [label.contentLayer removeFromSuperlayer]; } + for ( CPTAxisLabel *label in self.minorTickAxisLabels ) { + [label.contentLayer removeFromSuperlayer]; + } [self.axisTitle.contentLayer removeFromSuperlayer]; } } } --(void)setVisibleRange:(CPTPlotRange *)newRange +-(void)setVisibleRange:(nullable CPTPlotRange *)newRange { if ( newRange != visibleRange ) { visibleRange = [newRange copy]; @@ -2996,7 +3086,7 @@ -(void)setVisibleRange:(CPTPlotRange *)newRange } } --(void)setVisibleAxisRange:(CPTPlotRange *)newRange +-(void)setVisibleAxisRange:(nullable CPTPlotRange *)newRange { if ( newRange != visibleAxisRange ) { visibleAxisRange = [newRange copy]; @@ -3032,7 +3122,7 @@ -(void)setSeparateLayers:(BOOL)newSeparateLayers } } --(void)setMinorGridLines:(CPTGridLines *)newGridLines +-(void)setMinorGridLines:(nullable CPTGridLines *)newGridLines { CPTGridLines *oldGridLines = minorGridLines; @@ -3041,16 +3131,18 @@ -(void)setMinorGridLines:(CPTGridLines *)newGridLines minorGridLines = newGridLines; if ( newGridLines ) { - newGridLines.major = NO; - newGridLines.axis = self; + CPTGridLines *gridLines = newGridLines; + + gridLines.major = NO; + gridLines.axis = self; CPTPlotArea *thePlotArea = self.plotArea; - [thePlotArea.minorGridLineGroup insertSublayer:newGridLines atIndex:[thePlotArea sublayerIndexForAxis:self layerType:CPTGraphLayerTypeMinorGridLines]]; + [thePlotArea.minorGridLineGroup insertSublayer:gridLines atIndex:[thePlotArea sublayerIndexForAxis:self layerType:CPTGraphLayerTypeMinorGridLines]]; } } } --(void)setMajorGridLines:(CPTGridLines *)newGridLines +-(void)setMajorGridLines:(nullable CPTGridLines *)newGridLines { CPTGridLines *oldGridLines = majorGridLines; @@ -3059,16 +3151,18 @@ -(void)setMajorGridLines:(CPTGridLines *)newGridLines majorGridLines = newGridLines; if ( newGridLines ) { - newGridLines.major = YES; - newGridLines.axis = self; + CPTGridLines *gridLines = newGridLines; + + gridLines.major = YES; + gridLines.axis = self; CPTPlotArea *thePlotArea = self.plotArea; - [thePlotArea.majorGridLineGroup insertSublayer:newGridLines atIndex:[thePlotArea sublayerIndexForAxis:self layerType:CPTGraphLayerTypeMajorGridLines]]; + [thePlotArea.majorGridLineGroup insertSublayer:gridLines atIndex:[thePlotArea sublayerIndexForAxis:self layerType:CPTGraphLayerTypeMajorGridLines]]; } } } --(void)setAlternatingBandFills:(CPTFillArray)newFills +-(void)setAlternatingBandFills:(nullable CPTFillArray *)newFills { if ( newFills != alternatingBandFills ) { Class nullClass = [NSNull class]; @@ -3090,9 +3184,9 @@ -(void)setAlternatingBandFills:(CPTFillArray)newFills Class gradientClass = [CPTGradient class]; Class imageClass = [CPTImage class]; - CPTMutableFillArray fillArray = [newFills mutableCopy]; - NSUInteger i = 0; - CPTFill *newFill = nil; + CPTMutableFillArray *fillArray = [newFills mutableCopy]; + NSUInteger i = 0; + CPTFill *newFill = nil; for ( id obj in newFills ) { if ( [obj isKindOfClass:nullClass] || [obj isKindOfClass:fillClass] ) { @@ -3128,12 +3222,22 @@ -(void)setAlternatingBandFills:(CPTFillArray)newFills } } --(CPTLimitBandArray)backgroundLimitBands +-(void)setAlternatingBandAnchor:(nullable NSNumber *)newBandAnchor +{ + if ( newBandAnchor != alternatingBandAnchor ) { + alternatingBandAnchor = newBandAnchor; + + CPTPlotArea *thePlotArea = self.plotArea; + [thePlotArea setNeedsDisplay]; + } +} + +-(nullable CPTLimitBandArray *)backgroundLimitBands { return [self.mutableBackgroundLimitBands copy]; } --(CPTAxisSet *)axisSet +-(nullable CPTAxisSet *)axisSet { CPTPlotArea *thePlotArea = self.plotArea; @@ -3143,7 +3247,7 @@ -(CPTAxisSet *)axisSet -(void)setHidden:(BOOL)newHidden { if ( newHidden != self.hidden ) { - [super setHidden:newHidden]; + super.hidden = newHidden; [self setNeedsRelabel]; } } @@ -3160,7 +3264,7 @@ @implementation CPTAxis(AbstractMethods) * @param coordinateValue The axis value in data coordinate space. * @return The drawing coordinates of the point. **/ --(CGPoint)viewPointForCoordinateValue:(NSNumber *)coordinateValue +-(CGPoint)viewPointForCoordinateValue:(nullable NSNumber *__unused)coordinateValue { return CGPointZero; } @@ -3169,7 +3273,7 @@ -(CGPoint)viewPointForCoordinateValue:(NSNumber *)coordinateValue * @param context The graphics context to draw into. * @param major Draw the major grid lines If @YES, minor grid lines otherwise. **/ --(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major +-(void)drawGridLinesInContext:(nonnull CGContextRef __unused)context isMajor:(BOOL __unused)major { // do nothing--subclasses must override to do their drawing } @@ -3177,7 +3281,7 @@ -(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major /** @brief Draws alternating background bands into the provided graphics context. * @param context The graphics context to draw into. **/ --(void)drawBackgroundBandsInContext:(CGContextRef)context +-(void)drawBackgroundBandsInContext:(nonnull CGContextRef __unused)context { // do nothing--subclasses must override to do their drawing } @@ -3185,7 +3289,7 @@ -(void)drawBackgroundBandsInContext:(CGContextRef)context /** @brief Draws background limit ranges into the provided graphics context. * @param context The graphics context to draw into. **/ --(void)drawBackgroundLimitsInContext:(CGContextRef)context +-(void)drawBackgroundLimitsInContext:(nonnull CGContextRef __unused)context { // do nothing--subclasses must override to do their drawing } diff --git a/framework/Source/CPTAxisLabel.h b/framework/Source/CPTAxisLabel.h index 954ccda40..b78d2ebd9 100644 --- a/framework/Source/CPTAxisLabel.h +++ b/framework/Source/CPTAxisLabel.h @@ -9,26 +9,26 @@ /** * @brief A set of CPTAxisLabel objects. **/ -typedef NSSet *CPTAxisLabelSet; +typedef NSSet CPTAxisLabelSet; /** * @brief A mutable set of CPTAxisLabel objects. **/ -typedef NSMutableSet *CPTMutableAxisLabelSet; +typedef NSMutableSet CPTMutableAxisLabelSet; -@interface CPTAxisLabel : NSObject +@interface CPTAxisLabel : NSObject @property (nonatomic, readwrite, strong, nullable) CPTLayer *contentLayer; @property (nonatomic, readwrite, assign) CGFloat offset; @property (nonatomic, readwrite, assign) CGFloat rotation; @property (nonatomic, readwrite, assign) CPTAlignment alignment; -@property (nonatomic, readwrite, strong, nullable) NSNumber *tickLocation; +@property (nonatomic, readwrite, strong, nonnull) NSNumber *tickLocation; /// @name Initialization /// @{ -(nonnull instancetype)initWithText:(nullable NSString *)newText textStyle:(nullable CPTTextStyle *)style; -(nonnull instancetype)initWithContentLayer:(nonnull CPTLayer *)layer NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} /// @name Layout diff --git a/framework/Source/CPTAxisLabel.m b/framework/Source/CPTAxisLabel.m index 220db2500..2f9f23f5e 100644 --- a/framework/Source/CPTAxisLabel.m +++ b/framework/Source/CPTAxisLabel.m @@ -13,7 +13,7 @@ **/ @implementation CPTAxisLabel -/** @property CPTLayer *contentLayer +/** @property nullable CPTLayer *contentLayer * @brief The label content. **/ @synthesize contentLayer; @@ -33,7 +33,7 @@ @implementation CPTAxisLabel **/ @synthesize alignment; -/** @property NSNumber *tickLocation +/** @property nonnull NSNumber *tickLocation * @brief The data coordinate of the tick location. **/ @synthesize tickLocation; @@ -47,7 +47,7 @@ @implementation CPTAxisLabel * @param newStyle The text style for the label. * @return The initialized CPTAxisLabel object. **/ --(instancetype)initWithText:(NSString *)newText textStyle:(CPTTextStyle *)newStyle +-(nonnull instancetype)initWithText:(nullable NSString *)newText textStyle:(nullable CPTTextStyle *)newStyle { CPTTextLayer *newLayer = [[CPTTextLayer alloc] initWithText:newText style:newStyle]; @@ -61,26 +61,22 @@ -(instancetype)initWithText:(NSString *)newText textStyle:(CPTTextStyle *)newSty * @param layer The label content. * @return The initialized CPTAxisLabel object. **/ --(instancetype)initWithContentLayer:(CPTLayer *)layer +-(nonnull instancetype)initWithContentLayer:(nonnull CPTLayer *)layer { - if ( layer ) { - if ( (self = [super init]) ) { - contentLayer = layer; - offset = CPTFloat(20.0); - rotation = CPTFloat(0.0); - alignment = CPTAlignmentCenter; - tickLocation = @0.0; - } - } - else { - self = nil; + if ((self = [super init])) { + contentLayer = layer; + offset = CPTFloat(20.0); + rotation = CPTFloat(0.0); + alignment = CPTAlignmentCenter; + tickLocation = @0.0; } + return self; } /// @cond --(instancetype)init +-(nonnull instancetype)init { return [self initWithText:nil textStyle:nil]; } @@ -92,7 +88,7 @@ -(instancetype)init /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeObject:self.contentLayer forKey:@"CPTAxisLabel.contentLayer"]; [coder encodeCGFloat:self.offset forKey:@"CPTAxisLabel.offset"]; @@ -107,18 +103,33 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - contentLayer = [coder decodeObjectForKey:@"CPTAxisLabel.contentLayer"]; - offset = [coder decodeCGFloatForKey:@"CPTAxisLabel.offset"]; - rotation = [coder decodeCGFloatForKey:@"CPTAxisLabel.rotation"]; - alignment = (CPTAlignment)[coder decodeIntegerForKey : @"CPTAxisLabel.alignment"]; - tickLocation = [coder decodeObjectForKey:@"CPTAxisLabel.tickLocation"]; + if ((self = [super init])) { + contentLayer = [coder decodeObjectOfClass:[CPTLayer class] + forKey:@"CPTAxisLabel.contentLayer"]; + offset = [coder decodeCGFloatForKey:@"CPTAxisLabel.offset"]; + rotation = [coder decodeCGFloatForKey:@"CPTAxisLabel.rotation"]; + alignment = (CPTAlignment)[coder decodeIntegerForKey:@"CPTAxisLabel.alignment"]; + NSNumber *location = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTAxisLabel.tickLocation"]; + tickLocation = location ? location : @0.0; } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Layout @@ -140,14 +151,14 @@ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)c } CGPoint newPosition = point; - CGFloat *value = ( coordinate == CPTCoordinateX ? &(newPosition.x) : &(newPosition.y) ); + CGFloat *value = (coordinate == CPTCoordinateX ? &(newPosition.x) : &(newPosition.y)); CGFloat angle = CPTFloat(0.0); CGFloat labelRotation = self.rotation; - if ( isnan(labelRotation) ) { - labelRotation = ( coordinate == CPTCoordinateX ? CPTFloat(M_PI_2) : CPTFloat(0.0) ); + if ( isnan(labelRotation)) { + labelRotation = (coordinate == CPTCoordinateX ? CPTFloat(M_PI_2) : CPTFloat(0.0)); } - content.transform = CATransform3DMakeRotation( labelRotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) ); + content.transform = CATransform3DMakeRotation(labelRotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0)); CGRect contentFrame = content.frame; // Position the anchor point along the closest edge. @@ -261,7 +272,7 @@ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)c CGFloat newAnchorX = cos(angle); CGFloat newAnchorY = sin(angle); - if ( ABS(newAnchorX) <= ABS(newAnchorY) ) { + if ( ABS(newAnchorX) <= ABS(newAnchorY)) { newAnchorX /= ABS(newAnchorY); newAnchorY = signbit(newAnchorY) ? CPTFloat(-1.0) : CPTFloat(1.0); } @@ -269,7 +280,7 @@ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)c newAnchorY /= ABS(newAnchorX); newAnchorX = signbit(newAnchorX) ? CPTFloat(-1.0) : CPTFloat(1.0); } - CGPoint anchor = CPTPointMake( ( newAnchorX + CPTFloat(1.0) ) / CPTFloat(2.0), ( newAnchorY + CPTFloat(1.0) ) / CPTFloat(2.0) ); + CGPoint anchor = CPTPointMake((newAnchorX + CPTFloat(1.0)) / CPTFloat(2.0), (newAnchorY + CPTFloat(1.0)) / CPTFloat(2.0)); content.anchorPoint = anchor; content.position = newPosition; @@ -284,7 +295,7 @@ -(void)positionRelativeToViewPoint:(CGPoint)point forCoordinate:(CPTCoordinate)c **/ -(void)positionBetweenViewPoint:(CGPoint)firstPoint andViewPoint:(CGPoint)secondPoint forCoordinate:(CPTCoordinate)coordinate inDirection:(CPTSign)direction { - [self positionRelativeToViewPoint:CPTPointMake( (firstPoint.x + secondPoint.x) / CPTFloat(2.0), (firstPoint.y + secondPoint.y) / CPTFloat(2.0) ) + [self positionRelativeToViewPoint:CPTPointMake((firstPoint.x + secondPoint.x) / CPTFloat(2.0), (firstPoint.y + secondPoint.y) / CPTFloat(2.0)) forCoordinate:coordinate inDirection:direction]; } @@ -294,9 +305,9 @@ -(void)positionBetweenViewPoint:(CGPoint)firstPoint andViewPoint:(CGPoint)second /// @cond --(NSString *)description +-(nullable NSString *)description { - return [NSString stringWithFormat:@"<%@ {%@}>", [super description], self.contentLayer]; + return [NSString stringWithFormat:@"<%@ {%@}>", super.description, self.contentLayer]; } /// @endcond @@ -312,13 +323,13 @@ -(NSString *)description * @param object The object to be compared with the receiver. * @return @YES if @par{object} is equal to the receiver, @NO otherwise. **/ --(BOOL)isEqual:(id)object +-(BOOL)isEqual:(nullable id)object { if ( self == object ) { return YES; } else if ( [object isKindOfClass:[self class]] ) { - NSNumber *location = ( (CPTAxisLabel *)object ).tickLocation; + NSNumber *location = ((CPTAxisLabel *)object).tickLocation; if ( location ) { return [self.tickLocation isEqualToNumber:location]; @@ -343,8 +354,8 @@ -(NSUInteger)hash // Equal objects must hash the same. double tickLocationAsDouble = self.tickLocation.doubleValue; - if ( !isnan(tickLocationAsDouble) ) { - hashValue = (NSUInteger)lrint( fmod(ABS(tickLocationAsDouble), (double)NSUIntegerMax) ); + if ( !isnan(tickLocationAsDouble)) { + hashValue = (NSUInteger)lrint(fmod(ABS(tickLocationAsDouble), (double)NSUIntegerMax)); } return hashValue; diff --git a/framework/Source/CPTAxisLabelGroup.m b/framework/Source/CPTAxisLabelGroup.m index 2603369a2..1693c7a78 100644 --- a/framework/Source/CPTAxisLabelGroup.m +++ b/framework/Source/CPTAxisLabelGroup.m @@ -15,7 +15,7 @@ -(void)display // nothing to draw } --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef __unused)context { // nothing to draw } diff --git a/framework/Source/CPTAxisLabelTests.m b/framework/Source/CPTAxisLabelTests.m index 22bf84e9a..ff3248137 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 @@ -19,8 +19,8 @@ static CGPoint roundPoint(CGPoint position, CGSize contentSize, CGPoint anchor) CGPoint newAnchor = CGPointMake(contentSize.width * anchor.x, contentSize.height * anchor.y); - newPosition.x = ceil( position.x - newAnchor.x - CPTFloat(0.5) ) + newAnchor.x; - newPosition.y = ceil( position.y - newAnchor.y - CPTFloat(0.5) ) + newAnchor.y; + newPosition.x = ceil(position.x - newAnchor.x - CPTFloat(0.5)) + newAnchor.x; + newPosition.y = ceil(position.y - newAnchor.y - CPTFloat(0.5)) + newAnchor.y; return newPosition; } @@ -32,7 +32,12 @@ -(void)testPositionRelativeToViewPointRaisesForInvalidDirection @try { label = [[CPTAxisLabel alloc] initWithText:@"CPTAxisLabelTests-testPositionRelativeToViewPointRaisesForInvalidDirection" textStyle:[CPTTextStyle textStyle]]; - XCTAssertThrowsSpecificNamed([label positionRelativeToViewPoint:CGPointZero forCoordinate:CPTCoordinateX inDirection:INT_MAX], NSException, NSInvalidArgumentException, @"Should raise NSInvalidArgumentException for invalid direction (type CPTSign)"); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wassign-enum" + + XCTAssertThrowsSpecificNamed([label positionRelativeToViewPoint:CGPointZero forCoordinate:CPTCoordinateX inDirection:NSIntegerMax], NSException, NSInvalidArgumentException, @"Should raise NSInvalidArgumentException for invalid direction (type CPTSign)"); + +#pragma clang diagnostic pop } @finally { label = nil; @@ -60,8 +65,8 @@ -(void)testPositionRelativeToViewPointPositionsForXCoordinate CGPoint newPosition = roundPoint(CGPointMake(start - label.offset, start), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(1.0), precision, @"Should anchor at (1.0, 0.5)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(0.5), precision, @"Should anchor at (1.0, 0.5)"); @@ -73,8 +78,8 @@ -(void)testPositionRelativeToViewPointPositionsForXCoordinate newPosition = roundPoint(CGPointMake(start - label.offset, start), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(1.0), precision, @"Should anchor at (1.0, 0.5)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(0.5), precision, @"Should anchor at (1.0, 0.5)"); @@ -86,8 +91,8 @@ -(void)testPositionRelativeToViewPointPositionsForXCoordinate newPosition = roundPoint(CGPointMake(start + label.offset, start), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(0.0), precision, @"Should anchor at (0.0, 0.5)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(0.5), precision, @"Should anchor at (0.0, 0.5)"); } @@ -117,8 +122,8 @@ -(void)testPositionRelativeToViewPointPositionsForYCoordinate CGPoint newPosition = roundPoint(CGPointMake(start, start - label.offset), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(0.5), precision, @"Should anchor at (0.5, 1.0)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(1.0), precision, @"Should anchor at (0.5, 1.0)"); @@ -130,8 +135,8 @@ -(void)testPositionRelativeToViewPointPositionsForYCoordinate newPosition = roundPoint(CGPointMake(start, start - label.offset), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add negative offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(0.5), precision, @"Should anchor at (0.5, 1.0)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(1.0), precision, @"Should anchor at (0.5, 1.0)"); @@ -143,8 +148,8 @@ -(void)testPositionRelativeToViewPointPositionsForYCoordinate newPosition = roundPoint(CGPointMake(start, start + label.offset), contentSize, contentLayer.anchorPoint); - XCTAssertEqualWithAccuracy( contentLayer.position.x, newPosition.x, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); - XCTAssertEqualWithAccuracy( contentLayer.position.y, newPosition.y, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition) ); + XCTAssertEqualWithAccuracy(contentLayer.position.x, newPosition.x, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); + XCTAssertEqualWithAccuracy(contentLayer.position.y, newPosition.y, precision, @"Should add positive offset, %@ != %@", CPTStringFromPoint(contentLayer.position), CPTStringFromPoint(newPosition)); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.x, CPTFloat(0.5), precision, @"Should anchor at (0.5, 0.0)"); XCTAssertEqualWithAccuracy(contentLayer.anchorPoint.y, CPTFloat(0.0), precision, @"Should anchor at (0.5, 0.0)"); } diff --git a/framework/Source/CPTAxisSet.h b/framework/Source/CPTAxisSet.h index ff41332a3..93bf35cda 100644 --- a/framework/Source/CPTAxisSet.h +++ b/framework/Source/CPTAxisSet.h @@ -7,7 +7,7 @@ /// @name Axes /// @{ -@property (nonatomic, readwrite, strong, nullable) CPTAxisArray axes; +@property (nonatomic, readwrite, strong, nullable) CPTAxisArray *axes; /// @} /// @name Drawing diff --git a/framework/Source/CPTAxisSet.m b/framework/Source/CPTAxisSet.m index 55674657e..0f37e6cb5 100644 --- a/framework/Source/CPTAxisSet.m +++ b/framework/Source/CPTAxisSet.m @@ -9,12 +9,12 @@ **/ @implementation CPTAxisSet -/** @property CPTAxisArray axes +/** @property nullable CPTAxisArray *axes * @brief The axes in the axis set. **/ @synthesize axes; -/** @property CPTLineStyle *borderLineStyle +/** @property nullable CPTLineStyle *borderLineStyle * @brief The line style for the layer border. * If @nil, the border is not drawn. **/ @@ -36,9 +36,9 @@ @implementation CPTAxisSet * @param newFrame The frame rectangle. * @return The initialized CPTAxisSet object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { axes = @[]; borderLineStyle = nil; @@ -51,9 +51,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTAxisSet *theLayer = (CPTAxisSet *)layer; axes = theLayer->axes; @@ -69,7 +69,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -77,17 +77,31 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeObject:self.borderLineStyle forKey:@"CPTAxisSet.borderLineStyle"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - axes = [[coder decodeObjectForKey:@"CPTAxisSet.axes"] copy]; - borderLineStyle = [[coder decodeObjectForKey:@"CPTAxisSet.borderLineStyle"] copy]; + if ((self = [super initWithCoder:coder])) { + axes = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTAxis class]]] + forKey:@"CPTAxisSet.axes"] copy]; + borderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTAxisSet.borderLineStyle"] copy]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing @@ -110,7 +124,7 @@ -(void)display **/ -(void)relabelAxes { - CPTAxisArray theAxes = self.axes; + CPTAxisArray *theAxes = self.axes; [theAxes makeObjectsPerformSelector:@selector(setNeedsLayout)]; [theAxes makeObjectsPerformSelector:@selector(setNeedsRelabel)]; @@ -129,7 +143,7 @@ -(void)relabelAxes * @param idx The zero-based index. * @return The axis matching the given coordinate and index, or @nil if no match is found. **/ --(CPTAxis *)axisForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx +-(nullable CPTAxis *)axisForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx { CPTAxis *foundAxis = nil; NSUInteger count = 0; @@ -168,7 +182,7 @@ -(CPTAxis *)axisForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { for ( CPTAxis *axis in self.axes ) { if ( [axis pointingDeviceDownEvent:event atPoint:interactionPoint] ) { @@ -192,7 +206,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { for ( CPTAxis *axis in self.axes ) { if ( [axis pointingDeviceUpEvent:event atPoint:interactionPoint] ) { @@ -210,7 +224,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio /// @cond --(void)setAxes:(CPTAxisArray)newAxes +-(void)setAxes:(nullable CPTAxisArray *)newAxes { if ( newAxes != axes ) { for ( CPTAxis *axis in axes ) { @@ -231,7 +245,7 @@ -(void)setAxes:(CPTAxisArray)newAxes } } --(void)setBorderLineStyle:(CPTLineStyle *)newLineStyle +-(void)setBorderLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( newLineStyle != borderLineStyle ) { borderLineStyle = [newLineStyle copy]; diff --git a/framework/Source/CPTAxisTitle.m b/framework/Source/CPTAxisTitle.m index ececfdc0e..99b26a321 100644 --- a/framework/Source/CPTAxisTitle.m +++ b/framework/Source/CPTAxisTitle.m @@ -13,14 +13,13 @@ @implementation CPTAxisTitle #pragma mark - #pragma mark Init/Dealloc -/// @name Initialization -/// @{ +/// @cond --(instancetype)initWithContentLayer:(CPTLayer *)layer +-(nonnull instancetype)initWithContentLayer:(nonnull CPTLayer *)layer { if ( layer ) { - if ( (self = [super initWithContentLayer:layer]) ) { - self.rotation = NAN; + if ((self = [super initWithContentLayer:layer])) { + self.rotation = CPTNAN; } } else { @@ -29,7 +28,7 @@ -(instancetype)initWithContentLayer:(CPTLayer *)layer return self; } -/// @} +/// @endcond #pragma mark - #pragma mark Label comparison @@ -42,7 +41,7 @@ -(instancetype)initWithContentLayer:(CPTLayer *)layer * @param object The object to be compared with the receiver. * @return @YES if @par{object} is equal to the receiver, @NO otherwise. **/ --(BOOL)isEqual:(id)object +-(BOOL)isEqual:(nullable id)object { if ( self == object ) { return YES; @@ -50,14 +49,14 @@ -(BOOL)isEqual:(id)object else if ( [object isKindOfClass:[self class]] ) { CPTAxisTitle *otherTitle = object; - if ( (self.rotation != otherTitle.rotation) || (self.offset != otherTitle.offset) ) { + if ((self.rotation != otherTitle.rotation) || (self.offset != otherTitle.offset)) { return NO; } if ( ![self.contentLayer isEqual:otherTitle] ) { return NO; } - NSNumber *location = ( (CPTAxisLabel *)object ).tickLocation; + NSNumber *location = ((CPTAxisLabel *)object).tickLocation; if ( location ) { return [self.tickLocation isEqualToNumber:location]; @@ -82,11 +81,11 @@ -(NSUInteger)hash // Equal objects must hash the same. double tickLocationAsDouble = self.tickLocation.doubleValue; - if ( !isnan(tickLocationAsDouble) ) { - hashValue = (NSUInteger)lrint( fmod(ABS(tickLocationAsDouble), (double)NSUIntegerMax) ); + if ( !isnan(tickLocationAsDouble)) { + hashValue = (NSUInteger)lrint(fmod(ABS(tickLocationAsDouble), (double)NSUIntegerMax)); } - hashValue += (NSUInteger)lrint( fmod(ABS(self.rotation), (double)NSUIntegerMax) ); - hashValue += (NSUInteger)lrint( fmod(ABS(self.offset), (double)NSUIntegerMax) ); + hashValue += (NSUInteger)lrint(fmod(ABS(self.rotation), (double)NSUIntegerMax)); + hashValue += (NSUInteger)lrint(fmod(ABS(self.offset), (double)NSUIntegerMax)); return hashValue; } diff --git a/framework/Source/CPTBarPlot.h b/framework/Source/CPTBarPlot.h index f274b0f17..282fd873d 100644 --- a/framework/Source/CPTBarPlot.h +++ b/framework/Source/CPTBarPlot.h @@ -13,13 +13,19 @@ @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; +extern CPTBarPlotBinding __nonnull const CPTBarPlotBindingBarWidths; /// @} /** @@ -47,7 +53,7 @@ typedef NS_ENUM (NSInteger, CPTBarPlotField) { * @param indexRange The range of the data indexes of interest. * @return An array of bar fills. **/ --(nullable CPTFillArray)barFillsForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; +-(nullable CPTFillArray *)barFillsForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets a bar fill for the given bar plot. * This method will not be called if @@ -65,7 +71,7 @@ typedef NS_ENUM (NSInteger, CPTBarPlotField) { * @param indexRange The range of the data indexes of interest. * @return An array of line styles. **/ --(nullable CPTLineStyleArray)barLineStylesForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; +-(nullable CPTLineStyleArray *)barLineStylesForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets a bar line style for the given bar plot. * This method will not be called if @@ -78,6 +84,23 @@ typedef NS_ENUM (NSInteger, CPTBarPlotField) { **/ -(nullable CPTLineStyle *)barLineStyleForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; +/** @brief @optional Gets an array of bar widths for the given bar plot. + * @param barPlot The bar plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of bar widths. + **/ +-(nullable CPTNumberArray *)barWidthsForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar width for the given bar plot. + * This method will not be called if + * @link CPTBarPlotDataSource::barWidthsForBarPlot:recordIndexRange: -barWidthsForBarPlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param barPlot The bar plot. + * @param idx The data index of interest. + * @return The bar width for the bar with the given index. If the data source returns @nil, the default barWidth is used. + **/ +-(nullable NSNumber *)barWidthForBarPlot:(nonnull CPTBarPlot *)barPlot recordIndex:(NSUInteger)idx; + /// @} /// @name Legends @@ -188,12 +211,12 @@ typedef NS_ENUM (NSInteger, CPTBarPlotField) { /// @name Appearance /// @{ @property (nonatomic, readwrite, assign) BOOL barWidthsAreInViewCoordinates; -@property (nonatomic, readwrite, strong, nullable) NSNumber *barWidth; -@property (nonatomic, readwrite, strong, nullable) NSNumber *barOffset; +@property (nonatomic, readwrite, strong, nonnull) NSNumber *barWidth; +@property (nonatomic, readwrite, strong, nonnull) NSNumber *barOffset; @property (nonatomic, readwrite, assign) CGFloat barCornerRadius; @property (nonatomic, readwrite, assign) CGFloat barBaseCornerRadius; @property (nonatomic, readwrite, assign) BOOL barsAreHorizontal; -@property (nonatomic, readwrite, strong, nullable) NSNumber *baseValue; +@property (nonatomic, readwrite, strong, nonnull) NSNumber *baseValue; @property (nonatomic, readwrite, assign) BOOL barBasesVary; @property (nonatomic, readwrite, copy, nullable) CPTPlotRange *plotRange; /// @} @@ -220,6 +243,8 @@ typedef NS_ENUM (NSInteger, CPTBarPlotField) { -(void)reloadBarFillsInIndexRange:(NSRange)indexRange; -(void)reloadBarLineStyles; -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange; +-(void)reloadBarWidths; +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange; /// @} @end diff --git a/framework/Source/CPTBarPlot.m b/framework/Source/CPTBarPlot.m index 7ae9af868..e667773e3 100644 --- a/framework/Source/CPTBarPlot.m +++ b/framework/Source/CPTBarPlot.m @@ -27,33 +27,36 @@ * @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. +CPTBarPlotBinding const CPTBarPlotBindingBarWidths = @"barWidths"; ///< Bar widths. /// @cond @interface CPTBarPlot() -@property (nonatomic, readwrite, copy) CPTNumberArray barLocations; -@property (nonatomic, readwrite, copy) CPTNumberArray barTips; -@property (nonatomic, readwrite, copy) CPTNumberArray barBases; -@property (nonatomic, readwrite, copy) CPTFillArray barFills; -@property (nonatomic, readwrite, copy) CPTLineStyleArray barLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *barLocations; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *barTips; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *barBases; +@property (nonatomic, readwrite, copy, nullable) CPTFillArray *barFills; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barWidths; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; --(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(CGPoint *)basePoint tipPoint:(CGPoint *)tipPoint; --(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context recordIndex:(NSUInteger)recordIndex; --(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint; --(CPTFill *)barFillForIndex:(NSUInteger)idx; --(CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx; --(void)drawBarInContext:(CGContextRef)context recordIndex:(NSUInteger)idx; +-(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint tipPoint:(nonnull CGPoint *)tipPoint; +-(nullable CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex; +-(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint width:(NSNumber *)width; +-(nullable CPTFill *)barFillForIndex:(NSUInteger)idx; +-(nullable CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx; +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx; +-(void)drawBarInContext:(nonnull CGContextRef)context recordIndex:(NSUInteger)idx; -(CGFloat)lengthInView:(NSDecimal)plotLength; -(double)doubleLengthInPlotCoordinates:(NSDecimal)decimalLength; --(BOOL)barIsVisibleWithBasePoint:(CGPoint)basePoint; +-(BOOL)barIsVisibleWithBasePoint:(CGPoint)basePoint width:(NSNumber *)width; @end @@ -75,6 +78,7 @@ @implementation CPTBarPlot @dynamic barBases; @dynamic barFills; @dynamic barLineStyles; +@dynamic barWidths; /** @property CGFloat barCornerRadius * @brief The corner radius for the end of the bars. Default is @num{0.0} for square corners. @@ -88,7 +92,7 @@ @implementation CPTBarPlot **/ @synthesize barBaseCornerRadius; -/** @property NSNumber *barOffset +/** @property nonnull NSNumber *barOffset * @brief The starting offset of the first bar in location data units. * @ingroup plotAnimationBarPlot **/ @@ -100,7 +104,7 @@ @implementation CPTBarPlot **/ @synthesize barWidthsAreInViewCoordinates; -/** @property NSNumber *barWidth +/** @property nonnull NSNumber *barWidth * @brief The width of each bar. Either view or plot coordinates can be used. * * With plot coordinates, the bar locations are one data unit apart (e.g., 1, 2, 3, etc.), @@ -112,13 +116,13 @@ @implementation CPTBarPlot **/ @synthesize barWidth; -/** @property CPTLineStyle *lineStyle +/** @property nullable CPTLineStyle *lineStyle * @brief The line style for the bar outline. * If @nil, the outline is not drawn. **/ @synthesize lineStyle; -/** @property CPTFill *fill +/** @property nullable CPTFill *fill * @brief The fill style for the bars. * If @nil, the bars are not filled. **/ @@ -129,7 +133,7 @@ @implementation CPTBarPlot **/ @synthesize barsAreHorizontal; -/** @property NSNumber *baseValue +/** @property nonnull NSNumber *baseValue * @brief The coordinate value of the fixed end of the bars. * This is only used if @ref barBasesVary is @NO. Otherwise, the data source * will be queried for an appropriate value of #CPTBarPlotFieldBarBase. @@ -144,7 +148,7 @@ @implementation CPTBarPlot **/ @synthesize barBasesVary; -/** @property CPTPlotRange *plotRange +/** @property nullable CPTPlotRange *plotRange * @brief Sets the plot range for the independent axis. * * If a plot range is provided, the bars are spaced evenly throughout the plot range. If @ref plotRange is @nil, @@ -168,9 +172,9 @@ @implementation CPTBarPlot * @param horizontal If @YES, the bars will have a horizontal orientation, otherwise they will be vertical. * @return A new CPTBarPlot instance initialized with a linear gradient bar fill. **/ -+(instancetype)tubularBarPlotWithColor:(CPTColor *)color horizontalBars:(BOOL)horizontal ++(nonnull instancetype)tubularBarPlotWithColor:(nonnull CPTColor *)color horizontalBars:(BOOL)horizontal { - CPTBarPlot *barPlot = [[CPTBarPlot alloc] init]; + CPTBarPlot *barPlot = [[self alloc] init]; CPTMutableLineStyle *barLineStyle = [[CPTMutableLineStyle alloc] init]; barLineStyle.lineWidth = CPTFloat(1.0); @@ -195,7 +199,7 @@ +(instancetype)tubularBarPlotWithColor:(CPTColor *)color horizontalBars:(BOOL)ho /// @cond -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else +(void)initialize { @@ -205,8 +209,10 @@ +(void)initialize [self exposeBinding:CPTBarPlotBindingBarBases]; [self exposeBinding:CPTBarPlotBindingBarFills]; [self exposeBinding:CPTBarPlotBindingBarLineStyles]; + [self exposeBinding:CPTBarPlotBindingBarWidths]; } } + #endif /// @endcond @@ -234,9 +240,9 @@ +(void)initialize * @param newFrame The frame rectangle. * @return The initialized CPTBarPlot object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { lineStyle = [[CPTLineStyle alloc] init]; fill = [CPTFill fillWithColor:[CPTColor blackColor]]; barWidth = @0.5; @@ -260,9 +266,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTBarPlot *theLayer = (CPTBarPlot *)layer; lineStyle = theLayer->lineStyle; @@ -288,7 +294,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -308,27 +314,50 @@ -(void)encodeWithCoder:(NSCoder *)coder // pointingDeviceDownIndex } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - lineStyle = [[coder decodeObjectForKey:@"CPTBarPlot.lineStyle"] copy]; - fill = [[coder decodeObjectForKey:@"CPTBarPlot.fill"] copy]; - barWidth = [coder decodeObjectForKey:@"CPTBarPlot.barWidth"]; - barOffset = [coder decodeObjectForKey:@"CPTBarPlot.barOffset"]; - barCornerRadius = [coder decodeCGFloatForKey:@"CPTBarPlot.barCornerRadius"]; - barBaseCornerRadius = [coder decodeCGFloatForKey:@"CPTBarPlot.barBaseCornerRadius"]; - baseValue = [coder decodeObjectForKey:@"CPTBarPlot.baseValue"]; + if ((self = [super initWithCoder:coder])) { + NSNumber *num; + + lineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTBarPlot.lineStyle"] copy]; + fill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTBarPlot.fill"] copy]; + num = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTBarPlot.barWidth"]; + barWidth = num ? num : @0.0; + num = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTBarPlot.barOffset"]; + barOffset = num ? num : @0.0; + barCornerRadius = [coder decodeCGFloatForKey:@"CPTBarPlot.barCornerRadius"]; + barBaseCornerRadius = [coder decodeCGFloatForKey:@"CPTBarPlot.barBaseCornerRadius"]; + num = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTBarPlot.baseValue"]; + baseValue = num ? num : @0.0; barsAreHorizontal = [coder decodeBoolForKey:@"CPTBarPlot.barsAreHorizontal"]; barBasesVary = [coder decodeBoolForKey:@"CPTBarPlot.barBasesVary"]; barWidthsAreInViewCoordinates = [coder decodeBoolForKey:@"CPTBarPlot.barWidthsAreInViewCoordinates"]; - plotRange = [[coder decodeObjectForKey:@"CPTBarPlot.plotRange"] copy]; - pointingDeviceDownIndex = NSNotFound; + plotRange = [[coder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTBarPlot.plotRange"] copy]; + pointingDeviceDownIndex = NSNotFound; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Data Loading @@ -344,6 +373,9 @@ -(void)reloadDataInIndexRange:(NSRange)indexRange // Bar line styles [self reloadBarLineStylesInIndexRange:indexRange]; + // Bar widths + [self reloadBarWidthsInIndexRange:indexRange]; + // Legend id theDataSource = (id)self.dataSource; @@ -382,7 +414,7 @@ -(void)reloadPlotDataInIndexRange:(NSRange)indexRange CPTMutableNumericData *locationData = nil; if ( self.doublePrecisionCache ) { locationData = [[CPTMutableNumericData alloc] initWithData:[NSData data] - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; locationData.shape = @[@(indexRange.length)]; @@ -401,13 +433,13 @@ -(void)reloadPlotDataInIndexRange:(NSRange)indexRange } else { locationData = [[CPTMutableNumericData alloc] initWithData:[NSData data] - dataType:CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent()) shape:nil]; locationData.shape = @[@(indexRange.length)]; NSDecimal delta = CPTDecimalFromInteger(1); if ( indexRange.length > 1 ) { - delta = CPTDecimalDivide( self.plotRange.lengthDecimal, CPTDecimalFromUnsignedInteger(indexRange.length - 1) ); + delta = CPTDecimalDivide(self.plotRange.lengthDecimal, CPTDecimalFromUnsignedInteger(indexRange.length - 1)); } NSDecimal locationDecimal = self.plotRange.locationDecimal; @@ -430,7 +462,7 @@ -(void)reloadPlotDataInIndexRange:(NSRange)indexRange CPTMutableNumericData *locationData = nil; if ( self.doublePrecisionCache ) { locationData = [[CPTMutableNumericData alloc] initWithData:[NSData data] - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; locationData.shape = @[@(indexRange.length)]; @@ -444,7 +476,7 @@ -(void)reloadPlotDataInIndexRange:(NSRange)indexRange } else { locationData = [[CPTMutableNumericData alloc] initWithData:[NSData data] - dataType:CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent()) shape:nil]; locationData.shape = @[@(indexRange.length)]; @@ -491,9 +523,9 @@ -(void)reloadBarFillsInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(barFillForBarPlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableFillArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableFillArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTFill *dataSourceFill = [theDataSource barFillForBarPlot:self recordIndex:idx]; @@ -505,7 +537,9 @@ -(void)reloadBarFillsInIndexRange:(NSRange)indexRange } } - [self cacheArray:array forKey:CPTBarPlotBindingBarFills atRecordIndex:indexRange.location]; + [self cacheArray:array + forKey:CPTBarPlotBindingBarFills + atRecordIndex:indexRange.location]; } // Legend @@ -543,9 +577,9 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(barLineStyleForBarPlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableLineStyleArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableLineStyleArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTLineStyle *dataSourceLineStyle = [theDataSource barLineStyleForBarPlot:self recordIndex:idx]; @@ -557,7 +591,9 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange } } - [self cacheArray:array forKey:CPTBarPlotBindingBarLineStyles atRecordIndex:indexRange.location]; + [self cacheArray:array + forKey:CPTBarPlotBindingBarLineStyles + atRecordIndex:indexRange.location]; } // Legend @@ -568,6 +604,49 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange [self setNeedsDisplay]; } +/** + * @brief Reload all bar widths from the data source immediately. + **/ +-(void)reloadBarWidths +{ + [self reloadBarWidthsInIndexRange:NSMakeRange(0, self.cachedDataCount)]; +} + +/** @brief Reload bar widths in the given index range from the data source immediately. + * @param indexRange The index range to load. + **/ +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange +{ + id theDataSource = (id)self.dataSource; + + if ( [theDataSource respondsToSelector:@selector(barWidthsForBarPlot:recordIndexRange:)] ) { + [self cacheArray:[theDataSource barWidthsForBarPlot:self recordIndexRange:indexRange] + forKey:CPTBarPlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + else if ( [theDataSource respondsToSelector:@selector(barWidthForBarPlot:recordIndex:)] ) { + id nilObject = [CPTPlot nilData]; + CPTMutableNumberArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); + + for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { + NSNumber *width = [theDataSource barWidthForBarPlot:self recordIndex:idx]; + if ( width ) { + [array addObject:width]; + } + else { + [array addObject:nilObject]; + } + } + + [self cacheArray:array + forKey:CPTBarPlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + + [self setNeedsDisplay]; +} + #pragma mark - #pragma mark Length Conversions for Independent Coordinate (e.g., widths, offsets) @@ -633,8 +712,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; @@ -658,8 +737,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; @@ -685,7 +764,7 @@ -(NSDecimal)lengthInPlotCoordinates:(NSDecimal)decimalLength /// @cond --(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord +-(nullable CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord { CPTPlotRange *range = [super plotRangeForCoordinate:coord]; @@ -720,6 +799,27 @@ -(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord return range; } +-(nullable CPTPlotRange *)plotRangeEnclosingField:(NSUInteger)fieldEnum +{ + CPTPlotRange *range = nil; + + switch ( fieldEnum ) { + case CPTBarPlotFieldBarLocation: + range = [self plotRangeEnclosingBars]; + break; + + case CPTBarPlotFieldBarTip: + case CPTBarPlotFieldBarBase: + range = [self plotRangeForField:fieldEnum]; + break; + + default: + break; + } + + return range; +} + /// @endcond /** @brief Computes a plot range that completely encloses all of the bars. @@ -730,7 +830,7 @@ -(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord * * @return A plot range that completely encloses all of the bars. **/ --(CPTPlotRange *)plotRangeEnclosingBars +-(nullable CPTPlotRange *)plotRangeEnclosingBars { BOOL horizontalBars = self.barsAreHorizontal; CPTMutablePlotRange *range; @@ -744,12 +844,12 @@ -(CPTPlotRange *)plotRangeEnclosingBars NSDecimal barOffsetLength = [self lengthInPlotCoordinates:self.barOffset.decimalValue]; NSDecimal barWidthLength = [self lengthInPlotCoordinates:self.barWidth.decimalValue]; - NSDecimal halfBarWidth = CPTDecimalDivide( barWidthLength, CPTDecimalFromInteger(2) ); + NSDecimal halfBarWidth = CPTDecimalDivide(barWidthLength, CPTDecimalFromInteger(2)); NSDecimal rangeLocation = range.locationDecimal; NSDecimal rangeLength = range.lengthDecimal; - if ( CPTDecimalGreaterThanOrEqualTo( rangeLength, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalGreaterThanOrEqualTo(rangeLength, CPTDecimalFromInteger(0))) { rangeLocation = CPTDecimalSubtract(rangeLocation, halfBarWidth); range.locationDecimal = CPTDecimalAdd(rangeLocation, barOffsetLength); @@ -770,7 +870,7 @@ -(CPTPlotRange *)plotRangeEnclosingBars /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -778,13 +878,13 @@ -(void)renderAsVectorInContext:(CGContextRef)context CPTMutableNumericData *cachedLocations = [self cachedNumbersForField:CPTBarPlotFieldBarLocation]; CPTMutableNumericData *cachedLengths = [self cachedNumbersForField:CPTBarPlotFieldBarTip]; - if ( (cachedLocations == nil) || (cachedLengths == nil) ) { + if ((cachedLocations == nil) || (cachedLengths == nil)) { return; } BOOL basesVary = self.barBasesVary; CPTMutableNumericData *cachedBases = [self cachedNumbersForField:CPTBarPlotFieldBarBase]; - if ( basesVary && (cachedBases == nil) ) { + if ( basesVary && (cachedBases == nil)) { return; } @@ -797,7 +897,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context [NSException raise:CPTException format:@"Number of bar locations and lengths do not match"]; } - if ( basesVary && (cachedLengths.numberOfSamples != cachedBases.numberOfSamples) ) { + if ( basesVary && (cachedLengths.numberOfSamples != cachedBases.numberOfSamples)) { [NSException raise:CPTException format:@"Number of bar lengths and bases do not match"]; } @@ -813,7 +913,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context CGContextEndTransparencyLayer(context); } --(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(CGPoint *)basePoint tipPoint:(CGPoint *)tipPoint +-(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(nonnull CGPoint *)basePoint tipPoint:(nonnull CGPoint *)tipPoint { BOOL horizontalBars = self.barsAreHorizontal; CPTCoordinate independentCoord = (horizontalBars ? CPTCoordinateY : CPTCoordinateX); @@ -824,13 +924,13 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(CGPoint *)basePoint tipPoint: if ( self.doublePrecisionCache ) { double plotPoint[2]; plotPoint[independentCoord] = [self cachedDoubleForField:CPTBarPlotFieldBarLocation recordIndex:idx]; - if ( isnan(plotPoint[independentCoord]) ) { + if ( isnan(plotPoint[independentCoord])) { return NO; } // Tip point plotPoint[dependentCoord] = [self cachedDoubleForField:CPTBarPlotFieldBarTip recordIndex:idx]; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { return NO; } *tipPoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; @@ -842,7 +942,7 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(CGPoint *)basePoint tipPoint: else { plotPoint[dependentCoord] = [self cachedDoubleForField:CPTBarPlotFieldBarBase recordIndex:idx]; } - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { return NO; } *basePoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; @@ -850,13 +950,13 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(CGPoint *)basePoint tipPoint: else { NSDecimal plotPoint[2]; plotPoint[independentCoord] = [self cachedDecimalForField:CPTBarPlotFieldBarLocation recordIndex:idx]; - if ( NSDecimalIsNotANumber(&plotPoint[independentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[independentCoord])) { return NO; } // Tip point plotPoint[dependentCoord] = [self cachedDecimalForField:CPTBarPlotFieldBarTip recordIndex:idx]; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { return NO; } *tipPoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; @@ -868,7 +968,7 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(CGPoint *)basePoint tipPoint: else { plotPoint[dependentCoord] = [self cachedDecimalForField:CPTBarPlotFieldBarBase recordIndex:idx]; } - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { return NO; } *basePoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; @@ -890,7 +990,7 @@ -(BOOL)barAtRecordIndex:(NSUInteger)idx basePoint:(CGPoint *)basePoint tipPoint: return YES; } --(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context recordIndex:(NSUInteger)recordIndex +-(nullable CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context recordIndex:(NSUInteger)recordIndex { // Get base and tip points CGPoint basePoint, tipPoint; @@ -900,18 +1000,23 @@ -(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context recordIndex:(NSUI return NULL; } - CGMutablePathRef path = [self newBarPathWithContext:context basePoint:basePoint tipPoint:tipPoint]; + NSNumber *width = [self barWidthForIndex:recordIndex]; + + CGMutablePathRef path = [self newBarPathWithContext:context + basePoint:basePoint + tipPoint:tipPoint + width:width]; return path; } --(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint +-(nonnull CGMutablePathRef)newBarPathWithContext:(nullable CGContextRef)context basePoint:(CGPoint)basePoint tipPoint:(CGPoint)tipPoint width:(NSNumber *)width { // This function is used to create a path which is used for both // drawing a bar and for doing hit-testing on a click/touch event BOOL horizontalBars = self.barsAreHorizontal; - CGFloat barWidthLength = [self lengthInView:self.barWidth.decimalValue]; + CGFloat barWidthLength = [self lengthInView:width.decimalValue]; CGFloat halfBarWidth = CPTFloat(0.5) * barWidthLength; CGRect barRect; @@ -938,29 +1043,31 @@ -(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context basePoint:(CGPoin barRect.size.width = round(barRect.size.width * roundingPrecision) / roundingPrecision; barRect.size.height = round(barRect.size.height * roundingPrecision) / roundingPrecision; - if ( self.lineStyle.lineWidth > 0.0 ) { - barRect = CPTAlignRectToUserSpace(context, barRect); + CGContextRef theContext = context; + + if ( self.lineStyle.lineWidth > CPTFloat(0.0)) { + barRect = CPTAlignRectToUserSpace(theContext, barRect); } else { - barRect = CPTAlignIntegralRectToUserSpace(context, barRect); + barRect = CPTAlignIntegralRectToUserSpace(theContext, barRect); } } - CGFloat radius = MIN( MIN( self.barCornerRadius, ABS(barRect.size.width) * CPTFloat(0.5) ), ABS(barRect.size.height) * CPTFloat(0.5) ); - CGFloat baseRadius = MIN( MIN( self.barBaseCornerRadius, ABS(barRect.size.width) * CPTFloat(0.5) ), ABS(barRect.size.height) * CPTFloat(0.5) ); + CGFloat radius = MIN(MIN(self.barCornerRadius, ABS(barRect.size.width) * CPTFloat(0.5)), ABS(barRect.size.height) * CPTFloat(0.5)); + CGFloat baseRadius = MIN(MIN(self.barBaseCornerRadius, ABS(barRect.size.width) * CPTFloat(0.5)), ABS(barRect.size.height) * CPTFloat(0.5)); - if ( widthNegative && (barRect.size.width > 0.0) ) { + if ( widthNegative && (barRect.size.width > CPTFloat(0.0))) { barRect.origin.x += barRect.size.width; barRect.size.width = -barRect.size.width; } - if ( heightNegative && (barRect.size.height > 0.0) ) { + if ( heightNegative && (barRect.size.height > CPTFloat(0.0))) { barRect.origin.y += barRect.size.height; barRect.size.height = -barRect.size.height; } CGMutablePathRef path = CGPathCreateMutable(); - if ( radius == 0.0 ) { - if ( baseRadius == 0.0 ) { + if ( radius == CPTFloat(0.0)) { + if ( baseRadius == CPTFloat(0.0)) { // square corners CGPathAddRect(path, NULL, barRect); } @@ -988,7 +1095,7 @@ -(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context basePoint:(CGPoin CGFloat tipX = barRect.origin.x + barRect.size.width; CGFloat tipY = barRect.origin.y + barRect.size.height; - if ( baseRadius == 0.0 ) { + if ( baseRadius == CPTFloat(0.0)) { // rounded at tip end only CGPathMoveToPoint(path, NULL, barRect.origin.x, barRect.origin.y); if ( horizontalBars ) { @@ -1006,14 +1113,14 @@ -(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context basePoint:(CGPoin else { // rounded at both ends if ( horizontalBars ) { - CGPathMoveToPoint( path, NULL, barRect.origin.x, CGRectGetMidY(barRect) ); + CGPathMoveToPoint(path, NULL, barRect.origin.x, CGRectGetMidY(barRect)); CGPathAddArcToPoint(path, NULL, barRect.origin.x, tipY, CGRectGetMidX(barRect), tipY, baseRadius); CGPathAddArcToPoint(path, NULL, tipX, tipY, tipX, CGRectGetMidY(barRect), radius); CGPathAddArcToPoint(path, NULL, tipX, barRect.origin.y, CGRectGetMidX(barRect), barRect.origin.y, radius); CGPathAddArcToPoint(path, NULL, barRect.origin.x, barRect.origin.y, barRect.origin.x, CGRectGetMidY(barRect), baseRadius); } else { - CGPathMoveToPoint( path, NULL, barRect.origin.x, CGRectGetMidY(barRect) ); + CGPathMoveToPoint(path, NULL, barRect.origin.x, CGRectGetMidY(barRect)); CGPathAddArcToPoint(path, NULL, barRect.origin.x, tipY, CGRectGetMidX(barRect), tipY, radius); CGPathAddArcToPoint(path, NULL, tipX, tipY, tipX, CGRectGetMidY(barRect), radius); CGPathAddArcToPoint(path, NULL, tipX, barRect.origin.y, CGRectGetMidX(barRect), barRect.origin.y, baseRadius); @@ -1026,44 +1133,55 @@ -(CGMutablePathRef)newBarPathWithContext:(CGContextRef)context basePoint:(CGPoin return path; } --(BOOL)barIsVisibleWithBasePoint:(CGPoint)basePoint +-(BOOL)barIsVisibleWithBasePoint:(CGPoint)basePoint width:(NSNumber *)width { BOOL horizontalBars = self.barsAreHorizontal; - CGFloat barWidthLength = [self lengthInView:self.barWidth.decimalValue]; + CGFloat barWidthLength = [self lengthInView:width.decimalValue]; CGFloat halfBarWidth = CPTFloat(0.5) * barWidthLength; CPTPlotArea *thePlotArea = self.plotArea; - CGFloat lowerBound = ( horizontalBars ? CGRectGetMinY(thePlotArea.bounds) : CGRectGetMinX(thePlotArea.bounds) ); - CGFloat upperBound = ( horizontalBars ? CGRectGetMaxY(thePlotArea.bounds) : CGRectGetMaxX(thePlotArea.bounds) ); + CGFloat lowerBound = (horizontalBars ? CGRectGetMinY(thePlotArea.bounds) : CGRectGetMinX(thePlotArea.bounds)); + CGFloat upperBound = (horizontalBars ? CGRectGetMaxY(thePlotArea.bounds) : CGRectGetMaxX(thePlotArea.bounds)); CGFloat base = (horizontalBars ? basePoint.y : basePoint.x); return (base + halfBarWidth >= lowerBound) && (base - halfBarWidth <= upperBound); } --(CPTFill *)barFillForIndex:(NSUInteger)idx +-(nullable CPTFill *)barFillForIndex:(NSUInteger)idx { CPTFill *theBarFill = [self cachedValueForKey:CPTBarPlotBindingBarFills recordIndex:idx]; - if ( (theBarFill == nil) || (theBarFill == [CPTPlot nilData]) ) { + if ((theBarFill == nil) || (theBarFill == [CPTPlot nilData])) { theBarFill = self.fill; } return theBarFill; } --(CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx +-(nullable CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theBarLineStyle = [self cachedValueForKey:CPTBarPlotBindingBarLineStyles recordIndex:idx]; - if ( (theBarLineStyle == nil) || (theBarLineStyle == [CPTPlot nilData]) ) { + if ((theBarLineStyle == nil) || (theBarLineStyle == [CPTPlot nilData])) { theBarLineStyle = self.lineStyle; } return theBarLineStyle; } --(void)drawBarInContext:(CGContextRef)context recordIndex:(NSUInteger)idx +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx +{ + NSNumber *theBarWidth = [self cachedValueForKey:CPTBarPlotBindingBarWidths recordIndex:idx]; + + if ((theBarWidth == nil) || (theBarWidth == [CPTPlot nilData])) { + theBarWidth = self.barWidth; + } + + return theBarWidth; +} + +-(void)drawBarInContext:(nonnull CGContextRef)context recordIndex:(NSUInteger)idx { // Get base and tip points CGPoint basePoint, tipPoint; @@ -1073,12 +1191,17 @@ -(void)drawBarInContext:(CGContextRef)context recordIndex:(NSUInteger)idx return; } + NSNumber *width = [self barWidthForIndex:idx]; + // Return if bar is off screen - if ( ![self barIsVisibleWithBasePoint:basePoint] ) { + if ( ![self barIsVisibleWithBasePoint:basePoint width:width] ) { return; } - CGMutablePathRef path = [self newBarPathWithContext:context basePoint:basePoint tipPoint:tipPoint]; + CGMutablePathRef path = [self newBarPathWithContext:context + basePoint:basePoint + tipPoint:tipPoint + width:width]; if ( path ) { CGContextSaveGState(context); @@ -1104,7 +1227,7 @@ -(void)drawBarInContext:(CGContextRef)context recordIndex:(NSUInteger)idx } } --(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(nonnull CGContextRef)context { [super drawSwatchForLegend:legend atIndex:idx inRect:rect inContext:context]; @@ -1138,7 +1261,7 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken = 0; @@ -1166,7 +1289,7 @@ +(BOOL)needsDisplayForKey:(NSString *)aKey /// @cond --(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx +-(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx { NSDecimal theBaseDecimalValue; @@ -1180,11 +1303,11 @@ -(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInte NSNumber *location = [self cachedNumberForField:CPTBarPlotFieldBarLocation recordIndex:idx]; NSNumber *length = [self cachedNumberForField:CPTBarPlotFieldBarTip recordIndex:idx]; - BOOL positiveDirection = CPTDecimalGreaterThanOrEqualTo([length decimalValue], theBaseDecimalValue); + BOOL positiveDirection = CPTDecimalGreaterThanOrEqualTo(length.decimalValue, theBaseDecimalValue); BOOL horizontalBars = self.barsAreHorizontal; CPTCoordinate coordinate = (horizontalBars ? CPTCoordinateX : CPTCoordinateY); CPTPlotRange *lengthRange = [self.plotSpace plotRangeForCoordinate:coordinate]; - if ( CPTDecimalLessThan( lengthRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalLessThan(lengthRange.lengthDecimal, CPTDecimalFromInteger(0))) { positiveDirection = !positiveDirection; } @@ -1193,7 +1316,7 @@ -(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInte offsetLocation = @(location.doubleValue + [self doubleLengthInPlotCoordinates:self.barOffset.decimalValue]); } else { - NSDecimal decimalLocation = [location decimalValue]; + NSDecimal decimalLocation = location.decimalValue; NSDecimal offset = [self lengthInPlotCoordinates:self.barOffset.decimalValue]; offsetLocation = [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalAdd(decimalLocation, offset)]; } @@ -1254,7 +1377,7 @@ -(NSUInteger)numberOfLegendEntries * @param idx The index of the desired title. * @return The title of the legend entry at the requested index. **/ --(NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx +-(nullable NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx { NSString *legendTitle = nil; @@ -1275,7 +1398,7 @@ -(NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx * @param idx The index of the desired title. * @return The styled title of the legend entry at the requested index. **/ --(NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger)idx +-(nullable NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger)idx { NSAttributedString *legendTitle = nil; @@ -1304,10 +1427,10 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point NSUInteger barCount = self.cachedDataCount; NSUInteger ii = 0; - while ( (ii < barCount) && (idx == NSNotFound) ) { + while ((ii < barCount) && (idx == NSNotFound)) { CGMutablePathRef path = [self newBarPathWithContext:NULL recordIndex:ii]; - if ( CGPathContainsPoint(path, NULL, point, false) ) { + if ( CGPathContainsPoint(path, NULL, point, false)) { idx = ii; } @@ -1342,7 +1465,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTGraph *theGraph = self.graph; CPTPlotArea *thePlotArea = self.plotArea; @@ -1351,7 +1474,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact 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:)] || @@ -1407,7 +1530,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { NSUInteger selectedDownIndex = self.pointingDeviceDownIndex; @@ -1420,7 +1543,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio 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:)] || @@ -1470,59 +1593,59 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio /// @cond --(CPTNumberArray)barTips +-(nullable CPTNumberArray *)barTips { return [[self cachedNumbersForField:CPTBarPlotFieldBarTip] sampleArray]; } --(void)setBarTips:(CPTNumberArray)newTips +-(void)setBarTips:(nullable CPTNumberArray *)newTips { [self cacheNumbers:newTips forField:CPTBarPlotFieldBarTip]; } --(CPTNumberArray)barBases +-(nullable CPTNumberArray *)barBases { return [[self cachedNumbersForField:CPTBarPlotFieldBarBase] sampleArray]; } --(void)setBarBases:(CPTNumberArray)newBases +-(void)setBarBases:(nullable CPTNumberArray *)newBases { [self cacheNumbers:newBases forField:CPTBarPlotFieldBarBase]; } --(CPTNumberArray)barLocations +-(nullable CPTNumberArray *)barLocations { return [[self cachedNumbersForField:CPTBarPlotFieldBarLocation] sampleArray]; } --(void)setBarLocations:(CPTNumberArray)newLocations +-(void)setBarLocations:(nullable CPTNumberArray *)newLocations { [self cacheNumbers:newLocations forField:CPTBarPlotFieldBarLocation]; } --(CPTFillArray)barFills +-(nullable CPTFillArray *)barFills { return [self cachedArrayForKey:CPTBarPlotBindingBarFills]; } --(void)setBarFills:(CPTFillArray)newBarFills +-(void)setBarFills:(nullable CPTFillArray *)newBarFills { [self cacheArray:newBarFills forKey:CPTBarPlotBindingBarFills]; [self setNeedsDisplay]; } --(CPTLineStyleArray)barLineStyles +-(nullable CPTLineStyleArray *)barLineStyles { return [self cachedArrayForKey:CPTBarPlotBindingBarLineStyles]; } --(void)setBarLineStyles:(CPTLineStyleArray)newBarLineStyles +-(void)setBarLineStyles:(nullable CPTLineStyleArray *)newBarLineStyles { [self cacheArray:newBarLineStyles forKey:CPTBarPlotBindingBarLineStyles]; [self setNeedsDisplay]; } --(void)setLineStyle:(CPTLineStyle *)newLineStyle +-(void)setLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( lineStyle != newLineStyle ) { lineStyle = [newLineStyle copy]; @@ -1531,7 +1654,7 @@ -(void)setLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setFill:(CPTFill *)newFill +-(void)setFill:(nullable CPTFill *)newFill { if ( fill != newFill ) { fill = [newFill copy]; @@ -1540,7 +1663,7 @@ -(void)setFill:(CPTFill *)newFill } } --(void)setBarWidth:(NSNumber *)newBarWidth +-(void)setBarWidth:(nonnull NSNumber *)newBarWidth { if ( ![barWidth isEqualToNumber:newBarWidth] ) { barWidth = newBarWidth; @@ -1548,7 +1671,7 @@ -(void)setBarWidth:(NSNumber *)newBarWidth } } --(void)setBarOffset:(NSNumber *)newBarOffset +-(void)setBarOffset:(nonnull NSNumber *)newBarOffset { if ( ![barOffset isEqualToNumber:newBarOffset] ) { barOffset = newBarOffset; @@ -1575,7 +1698,7 @@ -(void)setBarBaseCornerRadius:(CGFloat)newCornerRadius } } --(void)setBaseValue:(NSNumber *)newBaseValue +-(void)setBaseValue:(nonnull NSNumber *)newBaseValue { if ( ![baseValue isEqualToNumber:newBaseValue] ) { baseValue = newBaseValue; @@ -1615,16 +1738,16 @@ -(NSUInteger)numberOfFields return 3; } --(CPTNumberArray)fieldIdentifiers +-(nonnull CPTNumberArray *)fieldIdentifiers { return @[@(CPTBarPlotFieldBarLocation), @(CPTBarPlotFieldBarTip), @(CPTBarPlotFieldBarBase)]; } --(CPTNumberArray)fieldIdentifiersForCoordinate:(CPTCoordinate)coord +-(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord { - CPTNumberArray result = nil; + CPTNumberArray *result = nil; switch ( coord ) { case CPTCoordinateX: diff --git a/framework/Source/CPTBorderedLayer.m b/framework/Source/CPTBorderedLayer.m index 63910ba72..7a6126c00 100644 --- a/framework/Source/CPTBorderedLayer.m +++ b/framework/Source/CPTBorderedLayer.m @@ -1,16 +1,16 @@ #import "CPTBorderedLayer.h" +#import "_CPTBorderLayer.h" +#import "_CPTMaskLayer.h" #import "CPTFill.h" #import "CPTLineStyle.h" #import "CPTPathExtensions.h" -#import "_CPTBorderLayer.h" -#import "_CPTMaskLayer.h" /// @cond @interface CPTBorderedLayer() -@property (nonatomic, readonly) CPTLayer *borderLayer; +@property (nonatomic, readonly, nullable) CPTLayer *borderLayer; -(void)updateOpacity; @@ -27,14 +27,14 @@ -(void)updateOpacity; **/ @implementation CPTBorderedLayer -/** @property CPTLineStyle *borderLineStyle +/** @property nullable CPTLineStyle *borderLineStyle * @brief The line style for the layer border. * * If @nil, the border is not drawn. **/ @synthesize borderLineStyle; -/** @property CPTFill *fill +/** @property nullable CPTFill *fill * @brief The fill for the layer background. * * If @nil, the layer background is not filled. @@ -66,9 +66,9 @@ @implementation CPTBorderedLayer * @param newFrame The frame rectangle. * @return The initialized CPTBorderedLayer object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { borderLineStyle = nil; fill = nil; inLayout = NO; @@ -82,9 +82,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTBorderedLayer *theLayer = (CPTBorderedLayer *)layer; borderLineStyle = theLayer->borderLineStyle; @@ -101,7 +101,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -112,11 +112,13 @@ -(void)encodeWithCoder:(NSCoder *)coder // inLayout } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - borderLineStyle = [[coder decodeObjectForKey:@"CPTBorderedLayer.borderLineStyle"] copy]; - fill = [[coder decodeObjectForKey:@"CPTBorderedLayer.fill"] copy]; + if ((self = [super initWithCoder:coder])) { + borderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTBorderedLayer.borderLineStyle"] copy]; + fill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTBorderedLayer.fill"] copy]; inLayout = NO; } @@ -125,12 +127,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden || self.masksToBorder ) { return; @@ -145,7 +159,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context /** @brief Draws the fill and border of a CPTBorderedLayer into the given graphics context. * @param context The graphics context to draw into. **/ --(void)renderBorderedLayerAsVectorInContext:(CGContextRef)context +-(void)renderBorderedLayerAsVectorInContext:(nonnull CGContextRef)context { if ( !self.backgroundColor || !self.useFastRendering ) { CPTFill *theFill = self.fill; @@ -169,7 +183,7 @@ -(void)renderBorderedLayerAsVectorInContext:(CGContextRef)context CGFloat radius = self.cornerRadius; - if ( radius > CPTFloat(0.0) ) { + if ( radius > CPTFloat(0.0)) { CGContextBeginPath(context); CPTAddRoundedRectPath(context, layerBounds, radius); [theLineStyle strokePathInContext:context]; @@ -192,13 +206,13 @@ -(void)renderBorderedLayerAsVectorInContext:(CGContextRef)context * @param right The right margin. * @param bottom The bottom margin. **/ --(void)sublayerMarginLeft:(CGFloat *)left top:(CGFloat *)top right:(CGFloat *)right bottom:(CGFloat *)bottom +-(void)sublayerMarginLeft:(nonnull CGFloat *)left top:(nonnull CGFloat *)top right:(nonnull CGFloat *)right bottom:(nonnull CGFloat *)bottom { [super sublayerMarginLeft:left top:top right:right bottom:bottom]; CGFloat inset = self.borderLineStyle.lineWidth * CPTFloat(0.5); - if ( inset > CPTFloat(0.0) ) { + if ( inset > CPTFloat(0.0)) { *left += inset; *top += inset; *right += inset; @@ -224,7 +238,7 @@ -(void)layoutSublayers /// @cond --(CGPathRef)maskingPath +-(nullable CGPathRef)maskingPath { if ( self.masksToBounds ) { CGPathRef path = self.outerBorderPath; @@ -246,7 +260,7 @@ -(CGPathRef)maskingPath } } --(CGPathRef)sublayerMaskingPath +-(nullable CGPathRef)sublayerMaskingPath { if ( self.masksToBorder ) { CGPathRef path = self.innerBorderPath; @@ -257,7 +271,7 @@ -(CGPathRef)sublayerMaskingPath CGFloat lineWidth = self.borderLineStyle.lineWidth; CGRect selfBounds = CGRectInset(self.bounds, lineWidth, lineWidth); - path = CPTCreateRoundedRectPath( selfBounds, self.cornerRadius - lineWidth * CPTFloat(0.5) ); + path = CPTCreateRoundedRectPath(selfBounds, self.cornerRadius - lineWidth * CPTFloat(0.5)); self.innerBorderPath = path; CGPathRelease(path); @@ -292,7 +306,7 @@ -(void)removeFromSuperlayer -(void)updateOpacity { - BOOL opaqueLayer = ( self.cornerRadius <= CPTFloat(0.0) ); + BOOL opaqueLayer = (self.cornerRadius <= CPTFloat(0.0)); CPTFill *theFill = self.fill; @@ -316,7 +330,7 @@ -(void)updateOpacity /// @cond --(void)setBorderLineStyle:(CPTLineStyle *)newLineStyle +-(void)setBorderLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( newLineStyle != borderLineStyle ) { if ( newLineStyle.lineWidth != borderLineStyle.lineWidth ) { @@ -333,13 +347,13 @@ -(void)setBorderLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setFill:(CPTFill *)newFill +-(void)setFill:(nullable CPTFill *)newFill { if ( newFill != fill ) { fill = [newFill copy]; CPTLayer *border = self.borderLayer; - if ( self.cornerRadius != CPTFloat(0.0) ) { + if ( self.cornerRadius != CPTFloat(0.0)) { border.backgroundColor = NULL; } else { @@ -365,7 +379,7 @@ -(void)setCornerRadius:(CGFloat)newRadius -(void)setMasksToBorder:(BOOL)newMasksToBorder { if ( newMasksToBorder != self.masksToBorder ) { - [super setMasksToBorder:newMasksToBorder]; + super.masksToBorder = newMasksToBorder; if ( newMasksToBorder ) { CPTMaskLayer *maskLayer = [[CPTMaskLayer alloc] initWithFrame:self.bounds]; @@ -381,7 +395,7 @@ -(void)setMasksToBorder:(BOOL)newMasksToBorder } } --(CPTLayer *)borderLayer +-(nullable CPTLayer *)borderLayer { CPTLayer *theBorderLayer = nil; CPTBorderLayer *superLayer = (CPTBorderLayer *)self.superlayer; @@ -438,57 +452,57 @@ -(CPTLayer *)borderLayer -(void)setBounds:(CGRect)newBounds { if ( self.masksToBorder && !self.inLayout ) { - [self.borderLayer setBounds:newBounds]; + self.borderLayer.bounds = newBounds; } else { - [super setBounds:newBounds]; + super.bounds = newBounds; } } -(void)setPosition:(CGPoint)newPosition { if ( self.masksToBorder && !self.inLayout ) { - [self.borderLayer setPosition:newPosition]; + self.borderLayer.position = newPosition; } else { - [super setPosition:newPosition]; + super.position = newPosition; } } -(void)setAnchorPoint:(CGPoint)newAnchorPoint { if ( self.masksToBorder && !self.inLayout ) { - [self.borderLayer setAnchorPoint:newAnchorPoint]; + self.borderLayer.anchorPoint = newAnchorPoint; } else { - [super setAnchorPoint:newAnchorPoint]; + super.anchorPoint = newAnchorPoint; } } -(void)setHidden:(BOOL)newHidden { if ( self.masksToBorder ) { - [self.borderLayer setHidden:newHidden]; + self.borderLayer.hidden = newHidden; } else { - [super setHidden:newHidden]; + super.hidden = newHidden; } } -(void)setTransform:(CATransform3D)newTransform { if ( self.masksToBorder ) { - [self.borderLayer setTransform:newTransform]; + self.borderLayer.transform = newTransform; } else { - [super setTransform:newTransform]; + super.transform = newTransform; } } --(void)setShadow:(CPTShadow *)newShadow +-(void)setShadow:(nullable CPTShadow *)newShadow { if ( newShadow != self.shadow ) { - [super setShadow:newShadow]; + super.shadow = newShadow; if ( self.masksToBorder ) { self.borderLayer.shadow = newShadow; @@ -496,13 +510,13 @@ -(void)setShadow:(CPTShadow *)newShadow } } --(void)setBackgroundColor:(CGColorRef)newColor +-(void)setBackgroundColor:(nullable CGColorRef)newColor { if ( self.masksToBorder ) { - [self.borderLayer setBackgroundColor:newColor]; + self.borderLayer.backgroundColor = newColor; } else { - [super setBackgroundColor:newColor]; + super.backgroundColor = newColor; } } diff --git a/framework/Source/CPTCalendarFormatter.h b/framework/Source/CPTCalendarFormatter.h index 8bfa23e40..89dc656ea 100644 --- a/framework/Source/CPTCalendarFormatter.h +++ b/framework/Source/CPTCalendarFormatter.h @@ -8,7 +8,7 @@ /// @name Initialization /// @{ -(nonnull instancetype)initWithDateFormatter:(nullable NSDateFormatter *)aDateFormatter NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} @end diff --git a/framework/Source/CPTCalendarFormatter.m b/framework/Source/CPTCalendarFormatter.m index 08168baa4..928263b4e 100644 --- a/framework/Source/CPTCalendarFormatter.m +++ b/framework/Source/CPTCalendarFormatter.m @@ -14,18 +14,18 @@ **/ @implementation CPTCalendarFormatter -/** @property NSDateFormatter *dateFormatter +/** @property nullable NSDateFormatter *dateFormatter * @brief The date formatter used to generate strings from date calculations. **/ @synthesize dateFormatter; -/** @property NSDate *referenceDate +/** @property nullable NSDate *referenceDate * @brief Date from which time intervals are computed. * If @nil, the standard reference date (1 January 2001, GMT) is used. **/ @synthesize referenceDate; -/** @property NSCalendar *referenceCalendar +/** @property nullable NSCalendar *referenceCalendar * @brief Calendar which is used for date calculations. * If @nil, the current calendar is used. **/ @@ -47,7 +47,7 @@ @implementation CPTCalendarFormatter * The default formatter uses @ref NSDateFormatterMediumStyle for dates and times. * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { NSDateFormatter *newDateFormatter = [[NSDateFormatter alloc] init]; @@ -65,9 +65,9 @@ -(instancetype)init * @param aDateFormatter The date formatter. * @return The new instance. **/ --(instancetype)initWithDateFormatter:(NSDateFormatter *)aDateFormatter +-(nonnull instancetype)initWithDateFormatter:(nullable NSDateFormatter *)aDateFormatter { - if ( (self = [super init]) ) { + if ((self = [super init])) { dateFormatter = aDateFormatter; referenceDate = nil; referenceCalendar = nil; @@ -81,7 +81,7 @@ -(instancetype)initWithDateFormatter:(NSDateFormatter *)aDateFormatter /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -97,13 +97,13 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { dateFormatter = [coder decodeObjectForKey:@"CPTCalendarFormatter.dateFormatter"]; referenceDate = [[coder decodeObjectForKey:@"CPTCalendarFormatter.referenceDate"] copy]; referenceCalendar = [[coder decodeObjectForKey:@"CPTCalendarFormatter.referenceCalendar"] copy]; - referenceCalendarUnit = (NSCalendarUnit)[coder decodeIntegerForKey : @"CPTCalendarFormatter.referenceCalendarUnit"]; + referenceCalendarUnit = (NSCalendarUnit)[coder decodeIntegerForKey:@"CPTCalendarFormatter.referenceCalendarUnit"]; } return self; } @@ -113,7 +113,7 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTCalendarFormatter *newFormatter = [[CPTCalendarFormatter allocWithZone:zone] init]; @@ -142,7 +142,7 @@ -(id)copyWithZone:(NSZone *)zone * @param coordinateValue The time value. * @return The date string. **/ --(NSString *)stringForObjectValue:(id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSInteger componentIncrement = 0; diff --git a/framework/Source/CPTCalendarFormatterTests.h b/framework/Source/CPTCalendarFormatterTests.h new file mode 100644 index 000000000..21b6d4c2e --- /dev/null +++ b/framework/Source/CPTCalendarFormatterTests.h @@ -0,0 +1,5 @@ +#import "CPTTestCase.h" + +@interface CPTCalendarFormatterTests : CPTTestCase + +@end diff --git a/framework/Source/CPTCalendarFormatterTests.m b/framework/Source/CPTCalendarFormatterTests.m new file mode 100644 index 000000000..ce3a609d5 --- /dev/null +++ b/framework/Source/CPTCalendarFormatterTests.m @@ -0,0 +1,29 @@ +#import "CPTCalendarFormatterTests.h" + +#import "CPTCalendarFormatter.h" + +@implementation CPTCalendarFormatterTests + +#pragma mark - +#pragma mark NSCoding Methods + +-(void)testKeyedArchivingRoundTrip +{ + NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; + + NSDate *refDate = [dateFormatter dateFromString:@"12:00 Oct 29, 2009"]; + + dateFormatter.dateStyle = NSDateFormatterShortStyle; + + CPTCalendarFormatter *calendarFormatter = [[CPTCalendarFormatter alloc] initWithDateFormatter:dateFormatter]; + calendarFormatter.referenceDate = refDate; + + CPTCalendarFormatter *newCalendarFormatter = [self archiveRoundTrip:calendarFormatter]; + + XCTAssertEqualObjects(calendarFormatter.dateFormatter.dateFormat, newCalendarFormatter.dateFormatter.dateFormat, @"Date formatter not equal"); + XCTAssertEqualObjects(calendarFormatter.referenceDate, newCalendarFormatter.referenceDate, @"Reference date not equal"); + XCTAssertEqualObjects(calendarFormatter.referenceCalendar, newCalendarFormatter.referenceCalendar, @"Reference calendar not equal"); + XCTAssertEqual(calendarFormatter.referenceCalendarUnit, newCalendarFormatter.referenceCalendarUnit, @"Reference calendar unit not equal"); +} + +@end diff --git a/framework/Source/CPTColor.h b/framework/Source/CPTColor.h index f5872e84f..8ae9a7611 100644 --- a/framework/Source/CPTColor.h +++ b/framework/Source/CPTColor.h @@ -1,9 +1,18 @@ -@interface CPTColor : NSObject +#import "CPTPlatformSpecificDefines.h" + +@interface CPTColor : NSObject @property (nonatomic, readonly, nonnull) CGColorRef cgColor; @property (nonatomic, readonly, getter = isOpaque) BOOL opaque; -/// @name Factory Methods +#if TARGET_OS_OSX +@property (nonatomic, readonly, nonnull) NSColor *nsColor; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +@property (nonatomic, readonly, nonnull) UIColor *uiColor; +#endif +@property (nonatomic, readonly, nonnull) CPTNativeColor *nativeColor; + +/// @name Standard Colors /// @{ +(nonnull instancetype)clearColor; +(nonnull instancetype)whiteColor; @@ -20,17 +29,35 @@ +(nonnull instancetype)orangeColor; +(nonnull instancetype)purpleColor; +(nonnull instancetype)brownColor; +/// @} +/// @name Factory Methods +/// @{ +(nonnull instancetype)colorWithCGColor:(nonnull CGColorRef)newCGColor; +(nonnull instancetype)colorWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; +(nonnull instancetype)colorWithGenericGray:(CGFloat)gray; + +#if TARGET_OS_OSX ++(nonnull instancetype)colorWithNSColor:(nonnull NSColor *)newNSColor; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE ++(nonnull instancetype)colorWithUIColor:(nonnull UIColor *)newUIColor; +#endif ++(nonnull instancetype)colorWithNativeColor:(nonnull CPTNativeColor *)newColor; + /// @} /// @name Initialization /// @{ -(nonnull instancetype)initWithCGColor:(nonnull CGColorRef)cgColor NS_DESIGNATED_INITIALIZER; -(nonnull instancetype)initWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; + +#if TARGET_OS_OSX +-(nonnull instancetype)initWithNSColor:(nonnull NSColor *)newNSColor NS_DESIGNATED_INITIALIZER; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +-(nonnull instancetype)initWithUIColor:(nonnull UIColor *)newUIColor NS_DESIGNATED_INITIALIZER; +#endif +-(nonnull instancetype)initWithNativeColor:(nonnull CPTNativeColor *)newColor; -(nonnull instancetype)colorWithAlphaComponent:(CGFloat)alpha; /// @} diff --git a/framework/Source/CPTColor.m b/framework/Source/CPTColor.m index 5e7f813d7..2be62efdf 100644 --- a/framework/Source/CPTColor.m +++ b/framework/Source/CPTColor.m @@ -5,6 +5,22 @@ #import "CPTPlatformSpecificCategories.h" #import "NSCoderExtensions.h" +/// @cond + +@interface CPTColor() + +#if TARGET_OS_OSX +@property (nonatomic, readonly, nullable) NSColor *nsColorCache; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +@property (nonatomic, readonly, nullable) UIColor *uiColorCache; +#endif + +@end + +/// @endcond + +#pragma mark - + /** @brief An immutable color. * * An immutable object wrapper class around @ref CGColorRef. @@ -14,24 +30,106 @@ **/ @implementation CPTColor -/** @property CGColorRef cgColor +#if TARGET_OS_OSX + +/** @internal + * @property nullable NSColor *nsColorCache + * @brief The NSColor to wrap around. + **/ +@synthesize nsColorCache; + +/** @property nonnull NSColor *nsColor + * @brief The NSColor to wrap around. + **/ +@dynamic nsColor; + +-(NSColor *)nsColor +{ + NSColor *theNSColor = self.nsColorCache; + + if ( theNSColor ) { + return theNSColor; + } + else { + return [NSColor colorWithCIColor:[CIColor colorWithCGColor:self.cgColor]]; + } +} + +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + +/** @internal + * @property nullable UIColor *uiColorCache + * @brief The UIColor to wrap around. + **/ +@synthesize uiColorCache; + +/** @property nonnull UIColor *uiColor + * @brief The UIColor to wrap around. + **/ +@dynamic uiColor; + +-(UIColor *)uiColor +{ + UIColor *theUIColor = self.uiColorCache; + + if ( theUIColor ) { + return theUIColor; + } + else { + return [UIColor colorWithCGColor:self.cgColor]; + } +} + +#endif + +/** @property nonnull CPTNativeColor *nativeColor + * @brief The platform-native color to wrap around. + **/ +@dynamic nativeColor; + +-(CPTNativeColor *)nativeColor +{ +#if TARGET_OS_OSX + return self.nsColor; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + return self.uiColor; +#endif +} + +/** @property nonnull CGColorRef cgColor * @brief The @ref CGColorRef to wrap around. **/ @synthesize cgColor; +-(CGColorRef)cgColor +{ +#if TARGET_OS_OSX + NSColor *theNSColor = self.nsColorCache; + if ( theNSColor ) { + return theNSColor.CGColor; + } +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + UIColor *theUIColor = self.uiColorCache; + if ( theUIColor ) { + return theUIColor.CGColor; + } +#endif + return cgColor; +} + /** @property BOOL opaque * @brief If @YES, the color is completely opaque. */ @dynamic opaque; #pragma mark - -#pragma mark Factory Methods +#pragma mark Standard Colors /** @brief Returns a shared instance of CPTColor initialized with a fully transparent color. * * @return A shared CPTColor object initialized with a fully transparent color. **/ -+(instancetype)clearColor ++(nonnull instancetype)clearColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; @@ -41,7 +139,7 @@ +(instancetype)clearColor CGColorRef clear = CGColorCreate([CPTColorSpace genericRGBSpace].cgColorSpace, values); - color = [[CPTColor alloc] initWithCGColor:clear]; + color = [[self alloc] initWithCGColor:clear]; CGColorRelease(clear); }); @@ -53,7 +151,7 @@ +(instancetype)clearColor * * @return A shared CPTColor object initialized with a fully opaque white color. **/ -+(instancetype)whiteColor ++(nonnull instancetype)whiteColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; @@ -69,7 +167,7 @@ +(instancetype)whiteColor * * @return A shared CPTColor object initialized with a fully opaque 67% gray color. **/ -+(instancetype)lightGrayColor ++(nonnull instancetype)lightGrayColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; @@ -85,7 +183,7 @@ +(instancetype)lightGrayColor * * @return A shared CPTColor object initialized with a fully opaque 50% gray color. **/ -+(instancetype)grayColor ++(nonnull instancetype)grayColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; @@ -101,7 +199,7 @@ +(instancetype)grayColor * * @return A shared CPTColor object initialized with a fully opaque 33% gray color. **/ -+(instancetype)darkGrayColor ++(nonnull instancetype)darkGrayColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; @@ -117,7 +215,7 @@ +(instancetype)darkGrayColor * * @return A shared CPTColor object initialized with a fully opaque black color. **/ -+(instancetype)blackColor ++(nonnull instancetype)blackColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; @@ -133,16 +231,16 @@ +(instancetype)blackColor * * @return A shared CPTColor object initialized with a fully opaque red color. **/ -+(instancetype)redColor ++(nonnull instancetype)redColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(1.0) - green:CPTFloat(0.0) - blue:CPTFloat(0.0) - alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(1.0) + green:CPTFloat(0.0) + blue:CPTFloat(0.0) + alpha:CPTFloat(1.0)]; }); return color; @@ -152,16 +250,16 @@ +(instancetype)redColor * * @return A shared CPTColor object initialized with a fully opaque green color. **/ -+(instancetype)greenColor ++(nonnull instancetype)greenColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.0) - green:CPTFloat(1.0) - blue:CPTFloat(0.0) - alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.0) + green:CPTFloat(1.0) + blue:CPTFloat(0.0) + alpha:CPTFloat(1.0)]; }); return color; @@ -171,16 +269,16 @@ +(instancetype)greenColor * * @return A shared CPTColor object initialized with a fully opaque blue color. **/ -+(instancetype)blueColor ++(nonnull instancetype)blueColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.0) - green:CPTFloat(0.0) - blue:CPTFloat(1.0) - alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.0) + green:CPTFloat(0.0) + blue:CPTFloat(1.0) + alpha:CPTFloat(1.0)]; }); return color; @@ -190,16 +288,16 @@ +(instancetype)blueColor * * @return A shared CPTColor object initialized with a fully opaque cyan color. **/ -+(instancetype)cyanColor ++(nonnull instancetype)cyanColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.0) - green:CPTFloat(1.0) - blue:CPTFloat(1.0) - alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.0) + green:CPTFloat(1.0) + blue:CPTFloat(1.0) + alpha:CPTFloat(1.0)]; }); return color; @@ -209,13 +307,13 @@ +(instancetype)cyanColor * * @return A shared CPTColor object initialized with a fully opaque yellow color. **/ -+(instancetype)yellowColor ++(nonnull instancetype)yellowColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(1.0) blue:CPTFloat(0.0) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(1.0) blue:CPTFloat(0.0) alpha:CPTFloat(1.0)]; }); return color; @@ -225,12 +323,12 @@ +(instancetype)yellowColor * * @return A shared CPTColor object initialized with a fully opaque magenta color. **/ -+(instancetype)magentaColor ++(nonnull instancetype)magentaColor { static CPTColor *color = nil; if ( nil == color ) { - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(0.0) blue:CPTFloat(1.0) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(0.0) blue:CPTFloat(1.0) alpha:CPTFloat(1.0)]; } return color; } @@ -239,13 +337,13 @@ +(instancetype)magentaColor * * @return A shared CPTColor object initialized with a fully opaque orange color. **/ -+(instancetype)orangeColor ++(nonnull instancetype)orangeColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(0.5) blue:CPTFloat(0.0) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(1.0) green:CPTFloat(0.5) blue:CPTFloat(0.0) alpha:CPTFloat(1.0)]; }); return color; @@ -255,13 +353,13 @@ +(instancetype)orangeColor * * @return A shared CPTColor object initialized with a fully opaque purple color. **/ -+(instancetype)purpleColor ++(nonnull instancetype)purpleColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.5) green:CPTFloat(0.0) blue:CPTFloat(0.5) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.5) green:CPTFloat(0.0) blue:CPTFloat(0.5) alpha:CPTFloat(1.0)]; }); return color; @@ -271,25 +369,28 @@ +(instancetype)purpleColor * * @return A shared CPTColor object initialized with a fully opaque brown color. **/ -+(instancetype)brownColor ++(nonnull instancetype)brownColor { static CPTColor *color = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - color = [[CPTColor alloc] initWithComponentRed:CPTFloat(0.6) green:CPTFloat(0.4) blue:CPTFloat(0.2) alpha:CPTFloat(1.0)]; + color = [[self alloc] initWithComponentRed:CPTFloat(0.6) green:CPTFloat(0.4) blue:CPTFloat(0.2) alpha:CPTFloat(1.0)]; }); return color; } +#pragma mark - +#pragma mark Factory Methods + /** @brief Creates and returns a new CPTColor instance initialized with the provided @ref CGColorRef. * @param newCGColor The color to wrap. * @return A new CPTColor instance initialized with the provided @ref CGColorRef. **/ -+(instancetype)colorWithCGColor:(CGColorRef)newCGColor ++(nonnull instancetype)colorWithCGColor:(nonnull CGColorRef)newCGColor { - return [[CPTColor alloc] initWithCGColor:newCGColor]; + return [[self alloc] initWithCGColor:newCGColor]; } /** @brief Creates and returns a new CPTColor instance initialized with the provided RGBA color components. @@ -299,25 +400,71 @@ +(instancetype)colorWithCGColor:(CGColorRef)newCGColor * @param alpha The alpha component (@num{0} ≤ @par{alpha} ≤ @num{1}). * @return A new CPTColor instance initialized with the provided RGBA color components. **/ -+(instancetype)colorWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha ++(nonnull instancetype)colorWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { - return [[CPTColor alloc] initWithComponentRed:red green:green blue:blue alpha:alpha]; + return [[self alloc] initWithComponentRed:red green:green blue:blue alpha:alpha]; } /** @brief Creates and returns a new CPTColor instance initialized with the provided gray level. * @param gray The gray level (@num{0} ≤ @par{gray} ≤ @num{1}). * @return A new CPTColor instance initialized with the provided gray level. **/ -+(instancetype)colorWithGenericGray:(CGFloat)gray ++(nonnull instancetype)colorWithGenericGray:(CGFloat)gray { CGFloat values[4] = { gray, gray, gray, CPTFloat(1.0) }; CGColorRef colorRef = CGColorCreate([CPTColorSpace genericRGBSpace].cgColorSpace, values); - CPTColor *color = [[CPTColor alloc] initWithCGColor:colorRef]; + CPTColor *color = [[self alloc] initWithCGColor:colorRef]; CGColorRelease(colorRef); return color; } +#if TARGET_OS_OSX + +/** @brief Creates and returns a new CPTColor instance initialized with the provided NSColor. + * + * The NSColor can be a dynamic system color or catalog color. This adds support for Dark Mode in macOS 10.14. + * + * @param newNSColor The color to wrap. + * @return A new CPTColor instance initialized with the provided NSColor. + **/ ++(nonnull instancetype)colorWithNSColor:(nonnull NSColor *)newNSColor +{ + return [[self alloc] initWithNSColor:newNSColor]; +} + +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + +/** @brief Creates and returns a new CPTColor instance initialized with the provided UIColor. + * + * The UIColor can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS 13. + * + * @param newUIColor The color to wrap. + * @return A new CPTColor instance initialized with the provided UIColor. + **/ ++(nonnull instancetype)colorWithUIColor:(nonnull UIColor *)newUIColor +{ + return [[self alloc] initWithUIColor:newUIColor]; +} + +#endif + +/** @brief Creates and returns a new CPTColor instance initialized with the provided platform-native color. + * + * The color can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS13. + * + * @param newColor The color to wrap. + * @return A new CPTColor instance initialized with the provided platform-native color. + **/ ++(nonnull instancetype)colorWithNativeColor:(nonnull CPTNativeColor *)newColor +{ +#if TARGET_OS_OSX + return [[self alloc] initWithNSColor:newColor]; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + return [[self alloc] initWithUIColor:newColor]; +#endif +} + #pragma mark - #pragma mark Init/Dealloc @@ -326,9 +473,9 @@ +(instancetype)colorWithGenericGray:(CGFloat)gray * @param newCGColor The color to wrap. * @return The initialized CPTColor object. **/ --(instancetype)initWithCGColor:(CGColorRef)newCGColor +-(nonnull instancetype)initWithCGColor:(nonnull CGColorRef)newCGColor { - if ( (self = [super init]) ) { + if ((self = [super init])) { CGColorRetain(newCGColor); cgColor = newCGColor; } @@ -343,7 +490,7 @@ -(instancetype)initWithCGColor:(CGColorRef)newCGColor * @param alpha The alpha component (@num{0} ≤ @par{alpha} ≤ @num{1}). * @return The initialized CPTColor object. **/ --(instancetype)initWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha +-(nonnull instancetype)initWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha { CGFloat colorComponents[4]; @@ -357,9 +504,61 @@ -(instancetype)initWithComponentRed:(CGFloat)red green:(CGFloat)green blue:(CGFl return self; } +#if TARGET_OS_OSX + +/** @brief Initializes a newly allocated CPTColor object with the provided NSColor. + * + * The NSColor can be a dynamic system color or catalog color. This adds support for Dark Mode in macOS 10.14. + * + * @param newNSColor The color to wrap. + * @return The initialized CPTColor object. + **/ +-(nonnull instancetype)initWithNSColor:(nonnull NSColor *)newNSColor +{ + if ((self = [super init])) { + nsColorCache = newNSColor; + } + return self; +} + +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + +/** @brief Initializes a newly allocated CPTColor object with the provided UIColor. + * + * The UIColor can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS 13. + * + * @param newUIColor The color to wrap. + * @return The initialized CPTColor object. + **/ +-(nonnull instancetype)initWithUIColor:(nonnull UIColor *)newUIColor +{ + if ((self = [super init])) { + uiColorCache = newUIColor; + } + return self; +} + +#endif + +/** @brief Initializes a newly allocated CPTColor object with the provided platform-native color. + * + * The color can be a dynamic system color or catalog color. This adds support for Dark Mode in macOS 10.14 and iOS 13. + * + * @param newColor The color to wrap. + * @return The initialized CPTColor object. + **/ +-(nonnull instancetype)initWithNativeColor:(nonnull CPTNativeColor *)newColor +{ +#if TARGET_OS_OSX + return [self initWithNSColor:newColor]; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + return [self initWithUIColor:newColor]; +#endif +} + /// @cond --(instancetype)init +-(nonnull instancetype)init { return [self initWithComponentRed:0.0 green:0.0 blue:0.0 alpha:0.0]; } @@ -379,10 +578,23 @@ -(void)dealloc * @param alpha The alpha component (@num{0} ≤ @par{alpha} ≤ @num{1}). * @return A new CPTColor instance having the provided alpha component. **/ --(instancetype)colorWithAlphaComponent:(CGFloat)alpha +-(nonnull instancetype)colorWithAlphaComponent:(CGFloat)alpha { +#if TARGET_OS_OSX + NSColor *theNSColor = self.nsColorCache; + if ( theNSColor ) { + NSColor *newNSColor = [theNSColor colorWithAlphaComponent:alpha]; + return [[self class] colorWithNSColor:newNSColor]; + } +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + UIColor *theUIColor = self.uiColorCache; + if ( theUIColor ) { + UIColor *newUIColor = [theUIColor colorWithAlphaComponent:alpha]; + return [[self class] colorWithUIColor:newUIColor]; + } +#endif CGColorRef newCGColor = CGColorCreateCopyWithAlpha(self.cgColor, alpha); - CPTColor *newColor = [CPTColor colorWithCGColor:newCGColor]; + CPTColor *newColor = [[self class] colorWithCGColor:newCGColor]; CGColorRelease(newCGColor); return newColor; @@ -391,18 +603,28 @@ -(instancetype)colorWithAlphaComponent:(CGFloat)alpha #pragma mark - #pragma mark Opacity +/// @cond + -(BOOL)isOpaque { return CGColorGetAlpha(self.cgColor) >= CPTFloat(1.0); } +/// @endcond + #pragma mark - #pragma mark NSCoding Methods /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { +#if TARGET_OS_OSX + [coder encodeConditionalObject:self.nsColorCache forKey:@"CPTColor.nsColorCache"]; +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + [coder encodeConditionalObject:self.uiColorCache forKey:@"CPTColor.uiColorCache"]; +#endif + CGColorRef theColor = self.cgColor; [coder encodeCGColorSpace:CGColorGetColorSpace(theColor) forKey:@"CPTColor.colorSpace"]; @@ -424,14 +646,27 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { +#if TARGET_OS_OSX + NSColor *decodedNSColor = [coder decodeObjectOfClass:[NSColor class] + forKey:@"CPTColor.nsColorCache"]; + if ( decodedNSColor ) { + nsColorCache = decodedNSColor; + } +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + UIColor *decodedUIColor = [coder decodeObjectOfClass:[UIColor class] + forKey:@"CPTColor.uiColorCache"]; + if ( decodedUIColor ) { + uiColorCache = decodedUIColor; + } +#endif CGColorSpaceRef colorSpace = [coder newCGColorSpaceDecodeForKey:@"CPTColor.colorSpace"]; - size_t numberOfComponents = (size_t)[coder decodeInt64ForKey : @"CPTColor.numberOfComponents"]; + size_t numberOfComponents = (size_t)[coder decodeInt64ForKey:@"CPTColor.numberOfComponents"]; - CGFloat *colorComponents = malloc( numberOfComponents * sizeof(CGFloat) ); + CGFloat *colorComponents = calloc(numberOfComponents, sizeof(CGFloat)); for ( size_t i = 0; i < numberOfComponents; i++ ) { NSString *newKey = [[NSString alloc] initWithFormat:@"CPTColor.component[%zu]", i]; @@ -447,23 +682,51 @@ -(instancetype)initWithCoder:(NSCoder *)coder return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark NSCopying Methods /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { +#if TARGET_OS_OSX + NSColor *nsColorCopy = [self.nsColorCache copyWithZone:zone]; + if ( nsColorCopy ) { + CPTColor *colorCopy = [[[self class] allocWithZone:zone] initWithNSColor:nsColorCopy]; + return colorCopy; + } +#elif TARGET_OS_SIMULATOR || TARGET_OS_IPHONE + UIColor *uiColorCopy = [self.uiColorCache copyWithZone:zone]; + if ( uiColorCopy ) { + CPTColor *colorCopy = [[[self class] allocWithZone:zone] initWithUIColor:uiColorCopy]; + return colorCopy; + } +#endif CGColorRef cgColorCopy = NULL; CGColorRef myColor = self.cgColor; if ( myColor ) { cgColorCopy = CGColorCreateCopy(myColor); + CPTColor *colorCopy = [[[self class] allocWithZone:zone] initWithCGColor:cgColorCopy]; + CGColorRelease(cgColorCopy); + return colorCopy; + } + else { + return nil; } - CPTColor *colorCopy = [[[self class] allocWithZone:zone] initWithCGColor:cgColorCopy]; - CGColorRelease(cgColorCopy); - return colorCopy; } /// @endcond @@ -479,13 +742,13 @@ -(id)copyWithZone:(NSZone *)zone * @param object The object to be compared with the receiver. * @return @YES if @par{object} is equal to the receiver, @NO otherwise. **/ --(BOOL)isEqual:(id)object +-(BOOL)isEqual:(nullable id)object { if ( self == object ) { return YES; } else if ( [object isKindOfClass:[self class]] ) { - return CGColorEqualToColor(self.cgColor, ( (CPTColor *)object ).cgColor); + return CGColorEqualToColor(self.cgColor, ((CPTColor *)object).cgColor); } else { return NO; @@ -521,11 +784,10 @@ -(NSUInteger)hash /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE return self.uiColor; - #else return self.nsColor; #endif diff --git a/framework/Source/CPTColorSpace.h b/framework/Source/CPTColorSpace.h index fa6b1ddfb..bb38bb379 100644 --- a/framework/Source/CPTColorSpace.h +++ b/framework/Source/CPTColorSpace.h @@ -1,6 +1,6 @@ -@interface CPTColorSpace : NSObject +@interface CPTColorSpace : NSObject -@property (nonatomic, readonly, nullable) CGColorSpaceRef cgColorSpace; +@property (nonatomic, readonly, nonnull) CGColorSpaceRef cgColorSpace; /// @name Factory Methods /// @{ @@ -10,7 +10,7 @@ /// @name Initialization /// @{ -(nonnull instancetype)initWithCGColorSpace:(nonnull CGColorSpaceRef)colorSpace NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} @end diff --git a/framework/Source/CPTColorSpace.m b/framework/Source/CPTColorSpace.m index 0f184e7cd..6086f09ef 100644 --- a/framework/Source/CPTColorSpace.m +++ b/framework/Source/CPTColorSpace.m @@ -9,7 +9,7 @@ @implementation CPTColorSpace -/** @property CGColorSpaceRef cgColorSpace +/** @property nonnull CGColorSpaceRef cgColorSpace * @brief The @ref CGColorSpaceRef to wrap around. **/ @synthesize cgColorSpace; @@ -25,19 +25,19 @@ @implementation CPTColorSpace * * @return A shared CPTColorSpace object initialized with the standard RGB colorspace. **/ -+(instancetype)genericRGBSpace ++(nonnull instancetype)genericRGBSpace { static CPTColorSpace *space = nil; static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ CGColorSpaceRef cgSpace = NULL; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE cgSpace = CGColorSpaceCreateDeviceRGB(); #else cgSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); #endif - space = [[CPTColorSpace alloc] initWithCGColorSpace:cgSpace]; + space = [[self alloc] initWithCGColorSpace:cgSpace]; CGColorSpaceRelease(cgSpace); }); @@ -53,9 +53,9 @@ +(instancetype)genericRGBSpace * @param colorSpace The color space. * @return The initialized CPTColorSpace object. **/ --(instancetype)initWithCGColorSpace:(CGColorSpaceRef)colorSpace +-(nonnull instancetype)initWithCGColorSpace:(nonnull CGColorSpaceRef)colorSpace { - if ( (self = [super init]) ) { + if ((self = [super init])) { CGColorSpaceRetain(colorSpace); cgColorSpace = colorSpace; } @@ -64,11 +64,11 @@ -(instancetype)initWithCGColorSpace:(CGColorSpaceRef)colorSpace /// @cond --(instancetype)init +-(nonnull instancetype)init { CGColorSpaceRef cgSpace = NULL; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE cgSpace = CGColorSpaceCreateDeviceRGB(); #else cgSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); @@ -93,7 +93,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeCGColorSpace:self.cgColorSpace forKey:@"CPTColorSpace.cgColorSpace"]; } @@ -104,12 +104,31 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - cgColorSpace = [coder newCGColorSpaceDecodeForKey:@"CPTColorSpace.cgColorSpace"]; + if ((self = [super init])) { + CGColorSpaceRef colorSpace = [coder newCGColorSpaceDecodeForKey:@"CPTColorSpace.cgColorSpace"]; + + if ( colorSpace ) { + cgColorSpace = colorSpace; + } + else { + self = nil; + } } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end diff --git a/framework/Source/CPTColorSpaceTests.m b/framework/Source/CPTColorSpaceTests.m index 93ebc4f08..40fecd110 100644 --- a/framework/Source/CPTColorSpaceTests.m +++ b/framework/Source/CPTColorSpaceTests.m @@ -11,13 +11,23 @@ -(void)testKeyedArchivingRoundTrip { CPTColorSpace *colorSpace = [CPTColorSpace genericRGBSpace]; - CPTColorSpace *newColorSpace = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:colorSpace]]; + CPTColorSpace *newColorSpace = [self archiveRoundTrip:colorSpace]; - CFDataRef iccProfile = CGColorSpaceCopyICCProfile(colorSpace.cgColorSpace); - CFDataRef newIccProfile = CGColorSpaceCopyICCProfile(newColorSpace.cgColorSpace); + CFDataRef iccProfile = NULL; + CFDataRef newIccProfile = NULL; + + // CGColorSpaceCopyICCProfile() is deprecated as of macOS 10.13 + if ( CGColorSpaceCopyICCData ) { + iccProfile = CGColorSpaceCopyICCData(colorSpace.cgColorSpace); + newIccProfile = CGColorSpaceCopyICCData(newColorSpace.cgColorSpace); + } + else { + iccProfile = CGColorSpaceCopyICCProfile(colorSpace.cgColorSpace); + newIccProfile = CGColorSpaceCopyICCProfile(newColorSpace.cgColorSpace); + } if ( iccProfile && newIccProfile ) { - XCTAssertTrue([(__bridge NSData *)iccProfile isEqualToData: (__bridge NSData *)newIccProfile], @"Color spaces not equal"); + XCTAssertTrue([(__bridge NSData *) iccProfile isEqualToData:(__bridge NSData *)newIccProfile], @"Color spaces not equal"); } if ( iccProfile ) { diff --git a/framework/Source/CPTColorTests.m b/framework/Source/CPTColorTests.m index 73a1566aa..ea7a9fb8c 100644 --- a/framework/Source/CPTColorTests.m +++ b/framework/Source/CPTColorTests.m @@ -11,9 +11,23 @@ -(void)testKeyedArchivingRoundTrip { CPTColor *color = [CPTColor redColor]; - CPTColor *newColor = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:color]]; + CPTColor *newColor = [self archiveRoundTrip:color]; XCTAssertEqualObjects(color, newColor, @"Colors not equal"); + +#if TARGET_OS_OSX +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" + // Workaround since @available macro is not there + if ( [NSColor respondsToSelector:@selector(systemRedColor)] ) { + color = [CPTColor colorWithNSColor:[NSColor systemRedColor]]; + + newColor = [self archiveRoundTrip:color]; + + XCTAssertEqualObjects(color, newColor, @"Colors not equal"); + } +#pragma clang diagnostic pop +#endif } @end diff --git a/framework/Source/CPTConstraints.h b/framework/Source/CPTConstraints.h index c8a4b89ac..d6bf75bd3 100644 --- a/framework/Source/CPTConstraints.h +++ b/framework/Source/CPTConstraints.h @@ -1,4 +1,4 @@ -@interface CPTConstraints : NSObject +@interface CPTConstraints : NSObject /// @name Factory Methods /// @{ diff --git a/framework/Source/CPTConstraints.m b/framework/Source/CPTConstraints.m index 261148c33..c9896ea25 100644 --- a/framework/Source/CPTConstraints.m +++ b/framework/Source/CPTConstraints.m @@ -1,8 +1,9 @@ #import "CPTConstraints.h" -#import "NSCoderExtensions.h" #import "_CPTConstraintsFixed.h" #import "_CPTConstraintsRelative.h" +#import "CPTDefinitions.h" +#import "NSCoderExtensions.h" /** @brief Implements a one-dimensional constrained position within a given numeric range. * @@ -17,7 +18,7 @@ @implementation CPTConstraints * @param newOffset The offset. * @return A new CPTConstraints instance initialized with the given offset. **/ -+(instancetype)constraintWithLowerOffset:(CGFloat)newOffset ++(nonnull instancetype)constraintWithLowerOffset:(CGFloat)newOffset { return [[_CPTConstraintsFixed alloc] initWithLowerOffset:newOffset]; } @@ -26,7 +27,7 @@ +(instancetype)constraintWithLowerOffset:(CGFloat)newOffset * @param newOffset The offset. * @return A new CPTConstraints instance initialized with the given offset. **/ -+(instancetype)constraintWithUpperOffset:(CGFloat)newOffset ++(nonnull instancetype)constraintWithUpperOffset:(CGFloat)newOffset { return [[_CPTConstraintsFixed alloc] initWithUpperOffset:newOffset]; } @@ -39,7 +40,7 @@ +(instancetype)constraintWithUpperOffset:(CGFloat)newOffset * @param newOffset The offset. * @return A new CPTConstraints instance initialized with the given offset. **/ -+(instancetype)constraintWithRelativeOffset:(CGFloat)newOffset ++(nonnull instancetype)constraintWithRelativeOffset:(CGFloat)newOffset { return [[_CPTConstraintsRelative alloc] initWithRelativeOffset:newOffset]; } @@ -51,7 +52,7 @@ +(instancetype)constraintWithRelativeOffset:(CGFloat)newOffset * @param newOffset The offset. * @return The initialized CPTConstraints object. **/ --(instancetype)initWithLowerOffset:(CGFloat)newOffset +-(nonnull instancetype)initWithLowerOffset:(CGFloat)newOffset { self = [[_CPTConstraintsFixed alloc] initWithLowerOffset:newOffset]; @@ -62,7 +63,7 @@ -(instancetype)initWithLowerOffset:(CGFloat)newOffset * @param newOffset The offset. * @return The initialized CPTConstraints object. **/ --(instancetype)initWithUpperOffset:(CGFloat)newOffset +-(nonnull instancetype)initWithUpperOffset:(CGFloat)newOffset { self = [[_CPTConstraintsFixed alloc] initWithUpperOffset:newOffset]; @@ -77,7 +78,7 @@ -(instancetype)initWithUpperOffset:(CGFloat)newOffset * @param newOffset The offset. * @return The initialized CPTConstraints object. **/ --(instancetype)initWithRelativeOffset:(CGFloat)newOffset +-(nonnull instancetype)initWithRelativeOffset:(CGFloat)newOffset { self = [[_CPTConstraintsRelative alloc] initWithRelativeOffset:newOffset]; @@ -89,7 +90,7 @@ -(instancetype)initWithRelativeOffset:(CGFloat)newOffset /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *__unused)zone { // do nothing--implemented in subclasses return nil; @@ -102,12 +103,12 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *__unused)coder { // do nothing--implemented in subclasses } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { if ( [coder containsValueForKey:@"_CPTConstraintsFixed.offset"] ) { CGFloat offset = [coder decodeCGFloatForKey:@"_CPTConstraintsFixed.offset"]; @@ -129,6 +130,18 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end #pragma mark - @@ -142,7 +155,7 @@ @implementation CPTConstraints(AbstractMethods) * @param otherConstraint The constraint to check. * @return @YES if the constraints are equal. **/ --(BOOL)isEqualToConstraint:(CPTConstraints *)otherConstraint +-(BOOL)isEqualToConstraint:(nullable CPTConstraints *)otherConstraint { // subclasses override to do comparison here return [super isEqual:otherConstraint]; @@ -156,10 +169,10 @@ -(BOOL)isEqualToConstraint:(CPTConstraints *)otherConstraint * @param upperBound The upper bound; must be greater than or equal to the @par{lowerBound}. * @return The calculated position. **/ --(CGFloat)positionForLowerBound:(CGFloat)lowerBound upperBound:(CGFloat)upperBound +-(CGFloat)positionForLowerBound:(CGFloat __unused)lowerBound upperBound:(CGFloat __unused)upperBound { // subclasses override to do position calculation here - return NAN; + return CPTNAN; } @end diff --git a/framework/Source/CPTDarkGradientThemeTests.m b/framework/Source/CPTDarkGradientThemeTests.m index 67dbe9801..71b64df7a 100644 --- a/framework/Source/CPTDarkGradientThemeTests.m +++ b/framework/Source/CPTDarkGradientThemeTests.m @@ -1,7 +1,7 @@ #import "CPTDarkGradientThemeTests.h" -#import "CPTDerivedXYGraph.h" #import "_CPTDarkGradientTheme.h" +#import "CPTDerivedXYGraph.h" @implementation CPTDarkGradientThemeTests @@ -22,7 +22,7 @@ -(void)testNewThemeSetGraphClassReturnedClassShouldBeOfCorrectType // Arrange _CPTDarkGradientTheme *theme = [[_CPTDarkGradientTheme alloc] init]; - [theme setGraphClass:[CPTDerivedXYGraph class]]; + theme.graphClass = [CPTDerivedXYGraph class]; // Act CPTGraph *graph = [theme newGraph]; diff --git a/framework/Source/CPTDataSourceTestCase.h b/framework/Source/CPTDataSourceTestCase.h index cdd05cbbb..3847a3cb0 100644 --- a/framework/Source/CPTDataSourceTestCase.h +++ b/framework/Source/CPTDataSourceTestCase.h @@ -6,15 +6,15 @@ @interface CPTDataSourceTestCase : CPTTestCase -@property (nonatomic, readwrite, copy) CPTNumberArray xData; -@property (nonatomic, readwrite, copy) CPTNumberArray yData; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *xData; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *yData; @property (nonatomic, readwrite, assign) NSUInteger nRecords; -@property (nonatomic, readonly, strong) CPTPlotRange *xRange; -@property (nonatomic, readonly, strong) CPTPlotRange *yRange; -@property (nonatomic, readwrite, strong) CPTMutablePlotArray plots; +@property (nonatomic, readonly, strong, nonnull) CPTPlotRange *xRange; +@property (nonatomic, readonly, strong, nonnull) CPTPlotRange *yRange; +@property (nonatomic, readwrite, strong, nonnull) CPTMutablePlotArray *plots; -(void)buildData; --(void)addPlot:(CPTPlot *)newPlot; +-(void)addPlot:(nonnull CPTPlot *)newPlot; @end diff --git a/framework/Source/CPTDataSourceTestCase.m b/framework/Source/CPTDataSourceTestCase.m index 9f1d87e58..1c71e3e1d 100644 --- a/framework/Source/CPTDataSourceTestCase.m +++ b/framework/Source/CPTDataSourceTestCase.m @@ -10,7 +10,7 @@ /// @cond @interface CPTDataSourceTestCase() --(CPTMutablePlotRange *)plotRangeForData:(CPTNumberArray)dataArray; +-(nonnull CPTMutablePlotRange *)plotRangeForData:(nonnull CPTNumberArray *)dataArray; @end @@ -27,7 +27,7 @@ @implementation CPTDataSourceTestCase -(void)setUp { - //check CPTDataSource conformance + // check CPTDataSource conformance XCTAssertTrue([self conformsToProtocol:@protocol(CPTPlotDataSource)], @"CPTDataSourceTestCase should conform to "); } @@ -35,14 +35,14 @@ -(void)tearDown { self.xData = nil; self.yData = nil; - [[self plots] removeAllObjects]; + [self.plots removeAllObjects]; } -(void)buildData { NSUInteger recordCount = self.nRecords; - CPTMutableNumberArray arr = [NSMutableArray arrayWithCapacity:recordCount]; + CPTMutableNumberArray *arr = [NSMutableArray arrayWithCapacity:recordCount]; for ( NSUInteger i = 0; i < recordCount; i++ ) { [arr insertObject:@(i) atIndex:i]; @@ -51,39 +51,43 @@ -(void)buildData arr = [NSMutableArray arrayWithCapacity:recordCount]; for ( NSUInteger i = 0; i < recordCount; i++ ) { - [arr insertObject:@( sin(2 * M_PI * (double)i / (double)recordCount) ) atIndex:i]; + [arr insertObject:@(sin(2 * M_PI * (double)i / (double)recordCount)) atIndex:i]; } self.yData = arr; } --(void)addPlot:(CPTPlot *)newPlot +-(void)addPlot:(nonnull CPTPlot *)newPlot { if ( nil == self.plots ) { self.plots = [NSMutableArray array]; } - [[self plots] addObject:newPlot]; + [self.plots addObject:newPlot]; } --(CPTPlotRange *)xRange +-(nonnull CPTPlotRange *)xRange { [self buildData]; - return [self plotRangeForData:self.xData]; + + CPTNumberArray *data = self.xData; + return [self plotRangeForData:data]; } --(CPTPlotRange *)yRange +-(nonnull CPTPlotRange *)yRange { [self buildData]; - CPTMutablePlotRange *range = [self plotRangeForData:self.yData]; + + CPTNumberArray *data = self.yData; + CPTMutablePlotRange *range = [self plotRangeForData:data]; if ( self.plots.count > 1 ) { - range.lengthDecimal = CPTDecimalAdd( range.lengthDecimal, CPTDecimalFromUnsignedInteger(self.plots.count) ); + range.lengthDecimal = CPTDecimalAdd(range.lengthDecimal, CPTDecimalFromUnsignedInteger(self.plots.count)); } return range; } --(CPTMutablePlotRange *)plotRangeForData:(CPTNumberArray)dataArray +-(nonnull CPTMutablePlotRange *)plotRangeForData:(nonnull CPTNumberArray *)dataArray { double min = [[dataArray valueForKeyPath:@"@min.doubleValue"] doubleValue]; double max = [[dataArray valueForKeyPath:@"@max.doubleValue"] doubleValue]; @@ -96,29 +100,29 @@ -(CPTMutablePlotRange *)plotRangeForData:(CPTNumberArray)dataArray #pragma mark - #pragma mark Plot Data Source Methods --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *__unused)plot { return self.nRecords; } --(CPTNumberArray)numbersForPlot:(CPTPlot *)plot - field:(NSUInteger)fieldEnum - recordIndexRange:(NSRange)indexRange +-(nullable CPTNumberArray *)numbersForPlot:(nonnull CPTPlot *)plot + field:(NSUInteger)fieldEnum + recordIndexRange:(NSRange)indexRange { - CPTNumberArray result; + CPTNumberArray *result; switch ( fieldEnum ) { case CPTScatterPlotFieldX: - result = [[self xData] objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:indexRange]]; + result = [self.xData objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:indexRange]]; break; case CPTScatterPlotFieldY: - result = [[self yData] objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:indexRange]]; + result = [self.yData objectsAtIndexes:[NSIndexSet indexSetWithIndexesInRange:indexRange]]; if ( self.plots.count > 1 ) { XCTAssertTrue([[self plots] containsObject:plot], @"Plot missing"); - CPTMutableNumberArray shiftedResult = [NSMutableArray arrayWithCapacity:result.count]; + 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/CPTDebugQuickLook.h b/framework/Source/CPTDebugQuickLook.h index 3b306a33c..62afb37c9 100644 --- a/framework/Source/CPTDebugQuickLook.h +++ b/framework/Source/CPTDebugQuickLook.h @@ -9,7 +9,7 @@ /** * @brief Used to show QuickLook previews of objects in the Xcode debugger and Swift playgrounds. **/ --(id)debugQuickLookObject; +-(nullable id)debugQuickLookObject; /// @} @@ -20,7 +20,8 @@ /** @category NSObject(CPTDebugQuickLookExtension) * @brief Debugging extensions to NSObject. **/ -@interface NSObject(CPTDebugQuickLookExtension) { +@interface NSObject(CPTDebugQuickLookExtension) +{ } @end diff --git a/framework/Source/CPTDefinitions.h b/framework/Source/CPTDefinitions.h index 6ca6a5350..ff6f39eb7 100644 --- a/framework/Source/CPTDefinitions.h +++ b/framework/Source/CPTDefinitions.h @@ -9,13 +9,6 @@ * @brief Defined as @num{1} if the compiler and active SDK support weak references, @num{0} otherwise. **/ -/** - * @def cpt_weak - * @hideinitializer - * @brief A custom definition for automatic reference counting (ARC) weak references that falls back to - * __unsafe_unretained values on older platforms. - **/ - /** * @def cpt_weak_property * @hideinitializer @@ -34,15 +27,9 @@ #endif #if CPT_SDK_SUPPORTS_WEAK -#define cpt_weak __weak #define cpt_weak_property weak #else -#if __clang__ && (__clang_major__ >= 3) -#define cpt_weak __unsafe_unretained -#else -#define cpt_weak -#endif -#define cpt_weak_property assign +#define cpt_weak_property unsafe_unretained #endif // Deprecated method attribute @@ -53,7 +40,37 @@ * @brief Marks a method declaration as deprecated. **/ -#define cpt_deprecated __attribute__( (deprecated) ) +#define cpt_deprecated __attribute__((deprecated)) + +// Unused parameter attribute (DEBUG only) + +/** + * @def cpt_unused + * @hideinitializer + * @brief Marks a parameter value as unused only in RELEASE builds. + **/ + +#ifdef DEBUG +#define cpt_unused +#else +#define cpt_unused __unused +#endif + +// 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 @@ -63,7 +80,7 @@ * @param x The number to cast. * @brief Casts a number to @ref CGFloat. **/ -#define CPTFloat(x) ( (CGFloat)(x) ) +#define CPTFloat(x) ((CGFloat)(x)) /** * @def CPTPointMake @@ -72,7 +89,7 @@ * @param y The y-coordinate of the point. * @brief A replacement for @ref CGPointMake(), casting each parameter to @ref CGFloat. **/ -#define CPTPointMake(x, y) CGPointMake( (CGFloat)(x), (CGFloat)(y) ) +#define CPTPointMake(x, y) CGPointMake((CGFloat)(x), (CGFloat)(y)) /** * @def CPTSizeMake @@ -81,7 +98,7 @@ * @param h The height of the size. * @brief A replacement for @ref CGSizeMake(), casting each parameter to @ref CGFloat. **/ -#define CPTSizeMake(w, h) CGSizeMake( (CGFloat)(w), (CGFloat)(h) ) +#define CPTSizeMake(w, h) CGSizeMake((CGFloat)(w), (CGFloat)(h)) /** * @def CPTRectMake @@ -92,7 +109,7 @@ * @param h The height of the rectangle. * @brief A replacement for @ref CGRectMake(), casting each parameter to @ref CGFloat. **/ -#define CPTRectMake(x, y, w, h) CGRectMake( (CGFloat)(x), (CGFloat)(y), (CGFloat)(w), (CGFloat)(h) ) +#define CPTRectMake(x, y, w, h) CGRectMake((CGFloat)(x), (CGFloat)(y), (CGFloat)(w), (CGFloat)(h)) /** * @def CPTRectInset @@ -102,7 +119,14 @@ * @param dy The y-offset. * @brief A replacement for @ref CGRectInset(), casting each offset parameter to @ref CGFloat. **/ -#define CPTRectInset(rect, dx, dy) CGRectInset( rect, (CGFloat)(dx), (CGFloat)(dy) ) +#define CPTRectInset(rect, dx, dy) CGRectInset(rect, (CGFloat)(dx), (CGFloat)(dy)) + +/** + * @def CPTNAN + * @hideinitializer + * @brief The not-a-number constant (@NAN), cast to @ref CGFloat. + **/ +#define CPTNAN ((CGFloat)NAN) /** * @brief Enumeration of numeric types @@ -158,7 +182,7 @@ CPTRGBAColor; /** * @brief Enumeration of label positioning offset directions **/ -typedef NS_ENUM (NSInteger, CPTSign) { +typedef NS_CLOSED_ENUM(NSInteger, CPTSign) { CPTSignNone = 0, ///< No offset CPTSignPositive = +1, ///< Positive offset CPTSignNegative = -1 ///< Negative offset @@ -204,45 +228,57 @@ 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. **/ -typedef NSArray *CPTNumberArray; +typedef NSArray CPTNumberArray; /** * @brief A mutable array of numbers. **/ -typedef NSMutableArray *CPTMutableNumberArray; +typedef NSMutableArray CPTMutableNumberArray; /** * @brief A set of numbers. **/ -typedef NSSet *CPTNumberSet; +typedef NSSet CPTNumberSet; /** * @brief A mutable set of numbers. **/ -typedef NSMutableSet *CPTMutableNumberSet; +typedef NSMutableSet CPTMutableNumberSet; /** * @brief An array of strings. **/ -typedef NSArray *CPTStringArray; +typedef NSArray CPTStringArray; /** * @brief A mutable array of strings. **/ -typedef NSMutableArray *CPTMutableStringArray; +typedef NSMutableArray CPTMutableStringArray; + +/** + * @brief An array of values. + **/ +typedef NSArray CPTValueArray; + +/** + * @brief A mutable array of values. + **/ +typedef NSMutableArray CPTMutableValueArray; /** * @brief An array of strings. **/ -typedef NSDictionary *CPTDictionary; +typedef NSDictionary CPTDictionary; /** * @brief A mutable array of strings. **/ -typedef NSMutableDictionary *CPTMutableDictionary; +typedef NSMutableDictionary CPTMutableDictionary; /** * @brief Render a Quick Look image into the given context. 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/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/CPTFill.h b/framework/Source/CPTFill.h index 990f30ef9..a011c8feb 100644 --- a/framework/Source/CPTFill.h +++ b/framework/Source/CPTFill.h @@ -8,27 +8,27 @@ /** * @brief An array of fills. **/ -typedef NSArray *CPTFillArray; +typedef NSArray CPTFillArray; /** * @brief A mutable array of fills. **/ -typedef NSMutableArray *CPTMutableFillArray; +typedef NSMutableArray CPTMutableFillArray; -@interface CPTFill : NSObject +@interface CPTFill : NSObject /// @name Factory Methods /// @{ -+(nonnull instancetype)fillWithColor:(nullable CPTColor *)aColor; -+(nonnull instancetype)fillWithGradient:(nullable CPTGradient *)aGradient; -+(nonnull instancetype)fillWithImage:(nullable CPTImage *)anImage; ++(nonnull instancetype)fillWithColor:(nonnull CPTColor *)aColor; ++(nonnull instancetype)fillWithGradient:(nonnull CPTGradient *)aGradient; ++(nonnull instancetype)fillWithImage:(nonnull CPTImage *)anImage; /// @} /// @name Initialization /// @{ --(nonnull instancetype)initWithColor:(nullable CPTColor *)aColor; --(nonnull instancetype)initWithGradient:(nullable CPTGradient *)aGradient; --(nonnull instancetype)initWithImage:(nullable CPTImage *)anImage; +-(nonnull instancetype)initWithColor:(nonnull CPTColor *)aColor; +-(nonnull instancetype)initWithGradient:(nonnull CPTGradient *)aGradient; +-(nonnull instancetype)initWithImage:(nonnull CPTImage *)anImage; /// @} @end diff --git a/framework/Source/CPTFill.m b/framework/Source/CPTFill.m index c4c63382a..b884fdd99 100644 --- a/framework/Source/CPTFill.m +++ b/framework/Source/CPTFill.m @@ -1,11 +1,12 @@ #import "CPTFill.h" -#import "CPTColor.h" -#import "CPTImage.h" -#import "CPTPlatformSpecificFunctions.h" #import "_CPTFillColor.h" #import "_CPTFillGradient.h" #import "_CPTFillImage.h" +#import "CPTColor.h" +#import "CPTGradient.h" +#import "CPTImage.h" +#import "CPTPlatformSpecificFunctions.h" /** @brief Draws area fills. * @@ -23,7 +24,7 @@ @implementation CPTFill * @param aColor The color. * @return A new CPTFill instance initialized with the given color. **/ -+(instancetype)fillWithColor:(CPTColor *)aColor ++(nonnull instancetype)fillWithColor:(nonnull CPTColor *)aColor { return [[_CPTFillColor alloc] initWithColor:aColor]; } @@ -32,7 +33,7 @@ +(instancetype)fillWithColor:(CPTColor *)aColor * @param aGradient The gradient. * @return A new CPTFill instance initialized with the given gradient. **/ -+(instancetype)fillWithGradient:(CPTGradient *)aGradient ++(nonnull instancetype)fillWithGradient:(nonnull CPTGradient *)aGradient { return [[_CPTFillGradient alloc] initWithGradient:aGradient]; } @@ -41,7 +42,7 @@ +(instancetype)fillWithGradient:(CPTGradient *)aGradient * @param anImage The image. * @return A new CPTFill instance initialized with the given image. **/ -+(instancetype)fillWithImage:(CPTImage *)anImage ++(nonnull instancetype)fillWithImage:(nonnull CPTImage *)anImage { return [[_CPTFillImage alloc] initWithImage:anImage]; } @@ -50,7 +51,7 @@ +(instancetype)fillWithImage:(CPTImage *)anImage * @param aColor The color. * @return The initialized CPTFill object. **/ --(instancetype)initWithColor:(CPTColor *)aColor +-(nonnull instancetype)initWithColor:(nonnull CPTColor *)aColor { self = [[_CPTFillColor alloc] initWithColor:aColor]; @@ -61,7 +62,7 @@ -(instancetype)initWithColor:(CPTColor *)aColor * @param aGradient The gradient. * @return The initialized CPTFill object. **/ --(instancetype)initWithGradient:(CPTGradient *)aGradient +-(nonnull instancetype)initWithGradient:(nonnull CPTGradient *)aGradient { self = [[_CPTFillGradient alloc] initWithGradient:aGradient]; @@ -72,7 +73,7 @@ -(instancetype)initWithGradient:(CPTGradient *)aGradient * @param anImage The image. * @return The initialized CPTFill object. **/ --(instancetype)initWithImage:(CPTImage *)anImage +-(nonnull instancetype)initWithImage:(nonnull CPTImage *)anImage { self = [[_CPTFillImage alloc] initWithImage:anImage]; @@ -84,7 +85,7 @@ -(instancetype)initWithImage:(CPTImage *)anImage /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *__unused)zone { // do nothing--implemented in subclasses return nil; @@ -97,25 +98,28 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *__unused)coder { // do nothing--implemented in subclasses } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - id fill = [coder decodeObjectForKey:@"_CPTFillColor.fillColor"]; + id fill = [coder decodeObjectOfClass:[CPTColor class] + forKey:@"_CPTFillColor.fillColor"]; if ( fill ) { return [self initWithColor:fill]; } - id gradient = [coder decodeObjectForKey:@"_CPTFillGradient.fillGradient"]; + id gradient = [coder decodeObjectOfClass:[CPTGradient class] + forKey:@"_CPTFillGradient.fillGradient"]; if ( gradient ) { return [self initWithGradient:gradient]; } - id image = [coder decodeObjectForKey:@"_CPTFillImage.fillImage"]; + id image = [coder decodeObjectOfClass:[CPTImage class] + forKey:@"_CPTFillImage.fillImage"]; if ( image ) { return [self initWithImage:image]; } @@ -125,6 +129,18 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end #pragma mark - @@ -136,7 +152,7 @@ @implementation CPTFill(AbstractMethods) */ @dynamic opaque; -/** @property CGColorRef cgColor +/** @property nullable CGColorRef cgColor * @brief Returns a @ref CGColorRef describing the fill if the fill can be represented as a color, @NULL otherwise. */ @dynamic cgColor; @@ -144,16 +160,20 @@ @implementation CPTFill(AbstractMethods) #pragma mark - #pragma mark Opacity +/// @cond + -(BOOL)isOpaque { // do nothing--subclasses override to describe the fill opacity return NO; } +/// @endcond + #pragma mark - #pragma mark Color --(CGColorRef)cgColor +-(nullable CGColorRef)cgColor { // do nothing--subclasses override to describe the color return NULL; @@ -166,7 +186,7 @@ -(CGColorRef)cgColor * @param rect The rectangle to draw into. * @param context The graphics context to draw into. **/ --(void)fillRect:(CGRect)rect inContext:(CGContextRef)context +-(void)fillRect:(CGRect __unused)rect inContext:(nonnull CGContextRef __unused)context { // do nothing--subclasses override to do drawing here } @@ -174,7 +194,7 @@ -(void)fillRect:(CGRect)rect inContext:(CGContextRef)context /** @brief Draws the gradient into the given graphics context clipped to the current drawing path. * @param context The graphics context to draw into. **/ --(void)fillPathInContext:(CGContextRef)context +-(void)fillPathInContext:(nonnull CGContextRef __unused)context { // do nothing--subclasses override to do drawing here } @@ -184,11 +204,11 @@ -(void)fillPathInContext:(CGContextRef)context /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { const CGRect rect = CGRectMake(0.0, 0.0, 100.0, 100.0); - return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat scale, CGRect bounds) { + return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat __unused scale, CGRect bounds) { [self fillRect:bounds inContext:context]; }); } diff --git a/framework/Source/CPTFillTests.m b/framework/Source/CPTFillTests.m index c0acf4d02..8029b0a73 100644 --- a/framework/Source/CPTFillTests.m +++ b/framework/Source/CPTFillTests.m @@ -1,16 +1,16 @@ #import "CPTFillTests.h" +#import "_CPTFillColor.h" +#import "_CPTFillGradient.h" +#import "_CPTFillImage.h" #import "CPTColor.h" #import "CPTFill.h" #import "CPTGradient.h" #import "CPTImage.h" -#import "_CPTFillColor.h" -#import "_CPTFillGradient.h" -#import "_CPTFillImage.h" @interface _CPTFillColor() -@property (nonatomic, readwrite, copy) CPTColor *fillColor; +@property (nonatomic, readwrite, copy, nonnull) CPTColor *fillColor; @end @@ -18,7 +18,7 @@ @interface _CPTFillColor() @interface _CPTFillGradient() -@property (nonatomic, readwrite, copy) CPTGradient *fillGradient; +@property (nonatomic, readwrite, copy, nonnull) CPTGradient *fillGradient; @end @@ -26,7 +26,7 @@ @interface _CPTFillGradient() @interface _CPTFillImage() -@property (nonatomic, readwrite, copy) CPTImage *fillImage; +@property (nonatomic, readwrite, copy, nonnull) CPTImage *fillImage; @end @@ -41,7 +41,7 @@ -(void)testKeyedArchivingRoundTripColor { _CPTFillColor *fill = (_CPTFillColor *)[CPTFill fillWithColor:[CPTColor redColor]]; - _CPTFillColor *newFill = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:fill]]; + _CPTFillColor *newFill = [self archiveRoundTrip:fill toClass:[CPTFill class]]; XCTAssertEqualObjects(fill.fillColor, newFill.fillColor, @"Fill with color not equal"); } @@ -50,7 +50,7 @@ -(void)testKeyedArchivingRoundTripGradient { _CPTFillGradient *fill = (_CPTFillGradient *)[CPTFill fillWithGradient:[CPTGradient rainbowGradient]]; - _CPTFillGradient *newFill = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:fill]]; + _CPTFillGradient *newFill = [self archiveRoundTrip:fill toClass:[CPTFill class]]; XCTAssertEqualObjects(fill.fillGradient, newFill.fillGradient, @"Fill with gradient not equal"); } @@ -62,7 +62,7 @@ -(void)testKeyedArchivingRoundTripImage size_t bytesPerRow = (4 * width + 15) & ~15ul; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); #else CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); @@ -80,7 +80,7 @@ -(void)testKeyedArchivingRoundTripImage _CPTFillImage *fill = (_CPTFillImage *)[CPTFill fillWithImage:image]; - _CPTFillImage *newFill = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:fill]]; + _CPTFillImage *newFill = [self archiveRoundTrip:fill toClass:[CPTFill class]]; XCTAssertEqualObjects(fill.fillImage, newFill.fillImage, @"Fill with image not equal"); } diff --git a/framework/Source/CPTFunctionDataSource.h b/framework/Source/CPTFunctionDataSource.h index b7141b312..251919c40 100644 --- a/framework/Source/CPTFunctionDataSource.h +++ b/framework/Source/CPTFunctionDataSource.h @@ -25,14 +25,18 @@ typedef double (^CPTDataSourceBlock)(double); /// @name Factory Methods /// @{ -+(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction)function; -+(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock)block; ++(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction) function NS_SWIFT_NAME(init(for:withFunction:)); + ++(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock) block NS_SWIFT_NAME(init(for:withBlock:)); + /// @} /// @name Initialization /// @{ --(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction)function; --(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock)block; +-(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction) function NS_SWIFT_NAME(init(forPlot:withFunction:)); + +-(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock) block NS_SWIFT_NAME(init(forPlot:withBlock:)); + /// @} @end diff --git a/framework/Source/CPTFunctionDataSource.m b/framework/Source/CPTFunctionDataSource.m index a74a6ab3d..0e038673a 100644 --- a/framework/Source/CPTFunctionDataSource.m +++ b/framework/Source/CPTFunctionDataSource.m @@ -14,13 +14,13 @@ @interface CPTFunctionDataSource() -@property (nonatomic, readwrite) CPTPlot *dataPlot; +@property (nonatomic, readwrite, nonnull) CPTPlot *dataPlot; @property (nonatomic, readwrite) double cachedStep; @property (nonatomic, readwrite) NSUInteger dataCount; @property (nonatomic, readwrite) NSUInteger cachedCount; -@property (nonatomic, readwrite, strong) CPTMutablePlotRange *cachedPlotRange; +@property (nonatomic, readwrite, strong, nullable) CPTMutablePlotRange *cachedPlotRange; --(instancetype)initForPlot:(CPTPlot *)plot NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot NS_DESIGNATED_INITIALIZER; -(void)plotBoundsChanged; -(void)plotSpaceChanged; @@ -35,17 +35,17 @@ -(void)plotSpaceChanged; **/ @implementation CPTFunctionDataSource -/** @property CPTDataSourceFunction dataSourceFunction +/** @property nullable CPTDataSourceFunction dataSourceFunction * @brief The function used to generate plot data. **/ @synthesize dataSourceFunction; -/** @property CPTDataSourceBlock dataSourceBlock +/** @property nullable CPTDataSourceBlock dataSourceBlock * @brief The Objective-C block used to generate plot data. **/ @synthesize dataSourceBlock; -/** @property CPTPlot *dataPlot +/** @property nonnull CPTPlot *dataPlot * @brief The plot that will display the function values. Must be an instance of CPTScatterPlot. **/ @synthesize dataPlot; @@ -55,7 +55,7 @@ @implementation CPTFunctionDataSource **/ @synthesize resolution; -/** @property CPTPlotRange *dataRange +/** @property nullable CPTPlotRange *dataRange * @brief The maximum range of x-values that will be plotted. If @nil (the default), the function will be plotted for all visible x-values. **/ @synthesize dataRange; @@ -73,7 +73,7 @@ @implementation CPTFunctionDataSource * @param function The function used to generate plot data. * @return A new CPTFunctionDataSource instance initialized with the provided function and plot. **/ -+(instancetype)dataSourceForPlot:(CPTPlot *)plot withFunction:(CPTDataSourceFunction)function ++(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction)function { return [[self alloc] initForPlot:plot withFunction:function]; } @@ -83,7 +83,7 @@ +(instancetype)dataSourceForPlot:(CPTPlot *)plot withFunction:(CPTDataSourceFunc * @param block The Objective-C block used to generate plot data. * @return A new CPTFunctionDataSource instance initialized with the provided block and plot. **/ -+(instancetype)dataSourceForPlot:(CPTPlot *)plot withBlock:(CPTDataSourceBlock)block ++(nonnull instancetype)dataSourceForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock)block { return [[self alloc] initForPlot:plot withBlock:block]; } @@ -93,11 +93,11 @@ +(instancetype)dataSourceForPlot:(CPTPlot *)plot withBlock:(CPTDataSourceBlock)b * @param function The function used to generate plot data. * @return The initialized CPTFunctionDataSource object. **/ --(instancetype)initForPlot:(CPTPlot *)plot withFunction:(CPTDataSourceFunction)function +-(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withFunction:(nonnull CPTDataSourceFunction)function { NSParameterAssert(function); - if ( (self = [self initForPlot:plot]) ) { + if ((self = [self initForPlot:plot])) { dataSourceFunction = function; plot.dataSource = self; @@ -110,11 +110,11 @@ -(instancetype)initForPlot:(CPTPlot *)plot withFunction:(CPTDataSourceFunction)f * @param block The Objective-C block used to generate plot data. * @return The initialized CPTFunctionDataSource object. **/ --(instancetype)initForPlot:(CPTPlot *)plot withBlock:(CPTDataSourceBlock)block +-(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot withBlock:(nonnull CPTDataSourceBlock)block { NSParameterAssert(block); - if ( (self = [self initForPlot:plot]) ) { + if ((self = [self initForPlot:plot])) { dataSourceBlock = block; plot.dataSource = self; @@ -124,11 +124,11 @@ -(instancetype)initForPlot:(CPTPlot *)plot withBlock:(CPTDataSourceBlock)block /// @cond --(instancetype)initForPlot:(CPTPlot *)plot +-(nonnull instancetype)initForPlot:(nonnull CPTPlot *)plot { NSParameterAssert([plot isKindOfClass:[CPTScatterPlot class]]); - if ( (self = [super init]) ) { + if ((self = [super init])) { dataPlot = plot; dataSourceFunction = NULL; dataSourceBlock = nil; @@ -154,7 +154,7 @@ -(instancetype)initForPlot:(CPTPlot *)plot } // function and plot are required; this will fail the assertions in -initForPlot:withFunction: --(instancetype)init +-(nonnull instancetype)init { [NSException raise:CPTException format:@"%@ must be initialized with a function or a block.", NSStringFromClass([self class])]; return [self initForPlot:[CPTScatterPlot layer] withFunction:sin]; @@ -176,7 +176,7 @@ -(void)dealloc -(void)setResolution:(CGFloat)newResolution { - NSParameterAssert( newResolution > CPTFloat(0.0) ); + NSParameterAssert(newResolution > CPTFloat(0.0)); if ( newResolution != resolution ) { resolution = newResolution; @@ -188,7 +188,7 @@ -(void)setResolution:(CGFloat)newResolution } } --(void)setDataRange:(CPTPlotRange *)newRange +-(void)setDataRange:(nullable CPTPlotRange *)newRange { if ( newRange != dataRange ) { dataRange = newRange; @@ -221,8 +221,8 @@ -(void)plotBoundsChanged if ( plotSpace ) { CGFloat width = plot.bounds.size.width; - if ( width > CPTFloat(0.0) ) { - NSUInteger count = (NSUInteger)lrint( ceil(width / self.resolution) ) + 1; + if ( width > CPTFloat(0.0)) { + NSUInteger count = (NSUInteger)lrint(ceil(width / self.resolution)) + 1; if ( count > self.cachedCount ) { self.dataCount = count; @@ -261,7 +261,7 @@ -(void)plotSpaceChanged if ( [cachedRange containsRange:plotRange] ) { // no new data needed } - else if ( ![cachedRange intersectsRange:plotRange] || (step == 0.0) ) { + else if ( ![cachedRange intersectsRange:plotRange] || (step == 0.0)) { self.cachedCount = 0; self.cachedPlotRange = plotRange; @@ -271,7 +271,7 @@ -(void)plotSpaceChanged if ( step > 0.0 ) { double minLimit = plotRange.minLimitDouble; if ( ![cachedRange containsDouble:minLimit] ) { - NSUInteger numPoints = (NSUInteger)lrint( ( ceil( (cachedRange.minLimitDouble - minLimit) / step ) ) ); + NSUInteger numPoints = (NSUInteger)lrint((ceil((cachedRange.minLimitDouble - minLimit) / step))); NSDecimal offset = CPTDecimalFromDouble(step * numPoints); cachedRange.locationDecimal = CPTDecimalSubtract(cachedRange.locationDecimal, offset); @@ -284,7 +284,7 @@ -(void)plotSpaceChanged double maxLimit = plotRange.maxLimitDouble; if ( ![cachedRange containsDouble:maxLimit] ) { - NSUInteger numPoints = (NSUInteger)lrint( ceil( (maxLimit - cachedRange.maxLimitDouble) / step ) ); + NSUInteger numPoints = (NSUInteger)lrint(ceil((maxLimit - cachedRange.maxLimitDouble) / step)); NSDecimal offset = CPTDecimalFromDouble(step * numPoints); cachedRange.lengthDecimal = CPTDecimalAdd(cachedRange.lengthDecimal, offset); @@ -297,7 +297,7 @@ -(void)plotSpaceChanged else { double maxLimit = plotRange.maxLimitDouble; if ( ![cachedRange containsDouble:maxLimit] ) { - NSUInteger numPoints = (NSUInteger)lrint( ceil( (cachedRange.maxLimitDouble - maxLimit) / step ) ); + NSUInteger numPoints = (NSUInteger)lrint(ceil((cachedRange.maxLimitDouble - maxLimit) / step)); NSDecimal offset = CPTDecimalFromDouble(step * numPoints); cachedRange.locationDecimal = CPTDecimalSubtract(cachedRange.locationDecimal, offset); @@ -310,7 +310,7 @@ -(void)plotSpaceChanged double minLimit = plotRange.minLimitDouble; if ( ![cachedRange containsDouble:minLimit] ) { - NSUInteger numPoints = (NSUInteger)lrint( ceil( (minLimit - cachedRange.minLimitDouble) / step ) ); + NSUInteger numPoints = (NSUInteger)lrint(ceil((minLimit - cachedRange.minLimitDouble) / step)); NSDecimal offset = CPTDecimalFromDouble(step * numPoints); cachedRange.lengthDecimal = CPTDecimalAdd(cachedRange.lengthDecimal, offset); @@ -330,9 +330,9 @@ -(void)plotSpaceChanged /// @cond --(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context +-(void)observeValueForKeyPath:(nullable NSString *)keyPath ofObject:(nullable id)object change:(NSDictionary *)change context:(nullable void *)context { - if ( (context == CPTFunctionDataSourceKVOContext) && [keyPath isEqualToString:@"plotSpace"] && [object isEqual:self.dataPlot] ) { + if ((context == CPTFunctionDataSourceKVOContext) && [keyPath isEqualToString:@"plotSpace"] && [object isEqual:self.dataPlot] ) { CPTPlotSpace *oldSpace = change[NSKeyValueChangeOldKey]; CPTPlotSpace *newSpace = change[NSKeyValueChangeNewKey]; @@ -364,7 +364,7 @@ -(void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NS /// @cond --(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot +-(NSUInteger)numberOfRecordsForPlot:(nonnull CPTPlot *)plot { NSUInteger count = 0; @@ -375,58 +375,60 @@ -(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot return count; } --(CPTNumericData *)dataForPlot:(CPTPlot *)plot recordIndexRange:(NSRange)indexRange +-(nullable CPTNumericData *)dataForPlot:(nonnull CPTPlot *)plot recordIndexRange:(NSRange)indexRange { CPTNumericData *numericData = nil; - NSUInteger count = self.dataCount; + if ( [plot isEqual:self.dataPlot] ) { + NSUInteger count = self.dataCount; - if ( count > 0 ) { - CPTPlotRange *xRange = self.cachedPlotRange; + if ( count > 0 ) { + CPTPlotRange *xRange = self.cachedPlotRange; - if ( !xRange ) { - [self plotSpaceChanged]; - xRange = self.cachedPlotRange; - } + if ( !xRange ) { + [self plotSpaceChanged]; + xRange = self.cachedPlotRange; + } - NSMutableData *data = [[NSMutableData alloc] initWithLength:indexRange.length * 2 * sizeof(double)]; + NSMutableData *data = [[NSMutableData alloc] initWithLength:indexRange.length * 2 * sizeof(double)]; - double *xBytes = data.mutableBytes; - double *yBytes = data.mutableBytes + ( indexRange.length * sizeof(double) ); + double *xBytes = data.mutableBytes; + double *yBytes = data.mutableBytes + (indexRange.length * sizeof(double)); - double location = xRange.locationDouble; - double length = xRange.lengthDouble; - double denom = (double)( count - ( (count > 1) ? 1 : 0 ) ); + double location = xRange.locationDouble; + double length = xRange.lengthDouble; + double denom = (double)(count - ((count > 1) ? 1 : 0)); - NSUInteger lastIndex = NSMaxRange(indexRange); + NSUInteger lastIndex = NSMaxRange(indexRange); - CPTDataSourceFunction function = self.dataSourceFunction; + CPTDataSourceFunction function = self.dataSourceFunction; - if ( function ) { - for ( NSUInteger i = indexRange.location; i < lastIndex; i++ ) { - double x = location + ( (double)i / denom ) * length; + if ( function ) { + for ( NSUInteger i = indexRange.location; i < lastIndex; i++ ) { + double x = location + ((double)i / denom) * length; - *xBytes++ = x; - *yBytes++ = function(x); + *xBytes++ = x; + *yBytes++ = function(x); + } } - } - else { - CPTDataSourceBlock functionBlock = self.dataSourceBlock; + else { + CPTDataSourceBlock functionBlock = self.dataSourceBlock; - if ( functionBlock ) { - for ( NSUInteger i = indexRange.location; i < lastIndex; i++ ) { - double x = location + ( (double)i / denom ) * length; + if ( functionBlock ) { + for ( NSUInteger i = indexRange.location; i < lastIndex; i++ ) { + double x = location + ((double)i / denom) * length; - *xBytes++ = x; - *yBytes++ = functionBlock(x); + *xBytes++ = x; + *yBytes++ = functionBlock(x); + } } } - } - numericData = [CPTNumericData numericDataWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) - shape:@[@(indexRange.length), @2] - dataOrder:CPTDataOrderColumnsFirst]; + numericData = [CPTNumericData numericDataWithData:data + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) + shape:@[@(indexRange.length), @2] + dataOrder:CPTDataOrderColumnsFirst]; + } } return numericData; diff --git a/framework/Source/CPTGradient.h b/framework/Source/CPTGradient.h index 637ea858f..b07f6d920 100644 --- a/framework/Source/CPTGradient.h +++ b/framework/Source/CPTGradient.h @@ -9,8 +9,8 @@ * @brief A structure representing one node in a linked list of RGBA colors. **/ typedef struct _CPTGradientElement { - CPTRGBAColor color; ///< Color - CGFloat position; ///< Gradient position (0 ≤ @par{position} ≤ 1) + CPTRGBAColor color; ///< Color + CGFloat position; ///< Gradient position (0 ≤ @par{position} ≤ 1) struct _CPTGradientElement *__nullable nextElement; ///< Pointer to the next CPTGradientElement in the list (last element == @NULL) } @@ -36,7 +36,7 @@ typedef NS_ENUM (NSInteger, CPTGradientType) { @class CPTColorSpace; @class CPTColor; -@interface CPTGradient : NSObject +@interface CPTGradient : NSObject @property (nonatomic, readonly, getter = isOpaque) BOOL opaque; @@ -90,8 +90,8 @@ typedef NS_ENUM (NSInteger, CPTGradientType) { /// @name Information /// @{ --(nullable CGColorRef)newColorStopAtIndex:(NSUInteger)idx; --(nonnull CGColorRef)newColorAtPosition:(CGFloat)position; +-(nullable CGColorRef)newColorStopAtIndex:(NSUInteger)idx CF_RETURNS_RETAINED; +-(nonnull CGColorRef)newColorAtPosition:(CGFloat)position CF_RETURNS_RETAINED; /// @} /// @name Drawing diff --git a/framework/Source/CPTGradient.m b/framework/Source/CPTGradient.m index 1d30027bf..3d6028025 100644 --- a/framework/Source/CPTGradient.m +++ b/framework/Source/CPTGradient.m @@ -10,18 +10,18 @@ /// @cond @interface CPTGradient() -@property (nonatomic, readwrite, strong) CPTColorSpace *colorspace; +@property (nonatomic, readwrite, strong, nonnull) CPTColorSpace *colorspace; @property (nonatomic, readwrite, assign) CPTGradientBlendingMode blendingMode; @property (nonatomic, readwrite, assign) CPTGradientElement *elementList; -@property (nonatomic, readwrite, assign) CGFunctionRef gradientFunction; +@property (nonatomic, readwrite, assign, nonnull) CGFunctionRef gradientFunction; -(void)commonInit; --(void)addElement:(CPTGradientElement *)newElement; +-(void)addElement:(nonnull CPTGradientElement *)newElement; --(CGShadingRef)newAxialGradientInRect:(CGRect)rect; --(CGShadingRef)newRadialGradientInRect:(CGRect)rect context:(CGContextRef)context; +-(nonnull CGShadingRef)newAxialGradientInRect:(CGRect)rect; +-(nonnull CGShadingRef)newRadialGradientInRect:(CGRect)rect context:(nonnull CGContextRef)context; --(CPTGradientElement *)elementAtIndex:(NSUInteger)idx; +-(nullable CPTGradientElement *)elementAtIndex:(NSUInteger)idx NS_RETURNS_INNER_POINTER; -(NSUInteger)elementCount; -(CPTGradientElement)removeElementAtIndex:(NSUInteger)idx; @@ -31,12 +31,12 @@ -(void)removeAllElements; @end // C Functions for color blending -static void CPTLinearEvaluation(void *info, const CGFloat *in, CGFloat *out); -static void CPTChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out); -static void CPTInverseChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out); -static void CPTTransformRGB_HSV(CGFloat *components); -static void CPTTransformHSV_RGB(CGFloat *components); -static void CPTResolveHSV(CGFloat *color1, CGFloat *color2); +static void CPTLinearEvaluation(void *__nullable info, const CGFloat *__nonnull in, CGFloat *__nonnull out); +static void CPTChromaticEvaluation(void *__nullable info, const CGFloat *__nonnull in, CGFloat *__nonnull out); +static void CPTInverseChromaticEvaluation(void *__nullable info, const CGFloat *__nonnull in, CGFloat *__nonnull out); +static void CPTTransformRGB_HSV(CGFloat *__nonnull components); +static void CPTTransformHSV_RGB(CGFloat *__nonnull components); +static void CPTResolveHSV(CGFloat *__nonnull color1, CGFloat *__nonnull color2); /// @endcond @@ -58,7 +58,7 @@ @implementation CPTGradient /// @cond -/** @property CPTColorSpace *colorspace; +/** @property nonnull CPTColorSpace *colorspace; * @brief The colorspace for the gradient colors. **/ @synthesize colorspace; @@ -115,9 +115,9 @@ @implementation CPTGradient * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { [self commonInit]; self.blendingMode = CPTLinearBlendingMode; @@ -153,7 +153,7 @@ -(void)dealloc /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTGradient *copy = [[[self class] allocWithZone:zone] init]; @@ -180,56 +180,53 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { - if ( [coder allowsKeyedCoding] ) { - NSUInteger count = 0; - CPTGradientElement *currentElement = self.elementList; - while ( currentElement != NULL ) { - [coder encodeValueOfObjCType:@encode(CGFloat) at:&(currentElement->color.red)]; - [coder encodeValueOfObjCType:@encode(CGFloat) at:&(currentElement->color.green)]; - [coder encodeValueOfObjCType:@encode(CGFloat) at:&(currentElement->color.blue)]; - [coder encodeValueOfObjCType:@encode(CGFloat) at:&(currentElement->color.alpha)]; - [coder encodeValueOfObjCType:@encode(CGFloat) at:&(currentElement->position)]; + NSUInteger count = 0; - count++; - currentElement = currentElement->nextElement; - } - [coder encodeInteger:(NSInteger)count forKey:@"CPTGradient.elementCount"]; - [coder encodeInteger:self.blendingMode forKey:@"CPTGradient.blendingMode"]; - [coder encodeCGFloat:self.angle forKey:@"CPTGradient.angle"]; - [coder encodeInteger:self.gradientType forKey:@"CPTGradient.type"]; - [coder encodeCPTPoint:self.startAnchor forKey:@"CPTPlotSymbol.startAnchor"]; - [coder encodeCPTPoint:self.endAnchor forKey:@"CPTPlotSymbol.endAnchor"]; - } - else { - [NSException raise:NSInvalidArchiveOperationException format:@"Only supports NSKeyedArchiver coders"]; + CPTGradientElement *currentElement = self.elementList; + + while ( currentElement != NULL ) { + [coder encodeCGFloat:currentElement->color.red forKey:[NSString stringWithFormat:@"red%lu", (unsigned long)count]]; + [coder encodeCGFloat:currentElement->color.green forKey:[NSString stringWithFormat:@"green%lu", (unsigned long)count]]; + [coder encodeCGFloat:currentElement->color.blue forKey:[NSString stringWithFormat:@"blue%lu", (unsigned long)count]]; + [coder encodeCGFloat:currentElement->color.alpha forKey:[NSString stringWithFormat:@"alpha%lu", (unsigned long)count]]; + [coder encodeCGFloat:currentElement->position forKey:[NSString stringWithFormat:@"position%lu", (unsigned long)count]]; + + count++; + currentElement = currentElement->nextElement; } + + [coder encodeInteger:(NSInteger)count forKey:@"CPTGradient.elementCount"]; + [coder encodeInteger:self.blendingMode forKey:@"CPTGradient.blendingMode"]; + [coder encodeCGFloat:self.angle forKey:@"CPTGradient.angle"]; + [coder encodeInteger:self.gradientType forKey:@"CPTGradient.type"]; + [coder encodeCPTPoint:self.startAnchor forKey:@"CPTPlotSymbol.startAnchor"]; + [coder encodeCPTPoint:self.endAnchor forKey:@"CPTPlotSymbol.endAnchor"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { [self commonInit]; - gradientType = (CPTGradientType)[coder decodeIntegerForKey : @"CPTGradient.type"]; + gradientType = (CPTGradientType)[coder decodeIntegerForKey:@"CPTGradient.type"]; angle = [coder decodeCGFloatForKey:@"CPTGradient.angle"]; - self.blendingMode = (CPTGradientBlendingMode)[coder decodeIntegerForKey : @"CPTGradient.blendingMode"]; + self.blendingMode = (CPTGradientBlendingMode)[coder decodeIntegerForKey:@"CPTGradient.blendingMode"]; startAnchor = [coder decodeCPTPointForKey:@"CPTPlotSymbol.startAnchor"]; endAnchor = [coder decodeCPTPointForKey:@"CPTPlotSymbol.endAnchor"]; - NSUInteger count = (NSUInteger)[coder decodeIntegerForKey : @"CPTGradient.elementCount"]; + NSUInteger count = (NSUInteger)[coder decodeIntegerForKey:@"CPTGradient.elementCount"]; - while ( count != 0 ) { + for ( NSUInteger i = 0; i < count; i++ ) { CPTGradientElement newElement; - [coder decodeValueOfObjCType:@encode(CGFloat) at:&(newElement.color.red)]; - [coder decodeValueOfObjCType:@encode(CGFloat) at:&(newElement.color.green)]; - [coder decodeValueOfObjCType:@encode(CGFloat) at:&(newElement.color.blue)]; - [coder decodeValueOfObjCType:@encode(CGFloat) at:&(newElement.color.alpha)]; - [coder decodeValueOfObjCType:@encode(CGFloat) at:&(newElement.position)]; + newElement.color.red = [coder decodeCGFloatForKey:[NSString stringWithFormat:@"red%lu", (unsigned long)i]]; + newElement.color.green = [coder decodeCGFloatForKey:[NSString stringWithFormat:@"green%lu", (unsigned long)i]]; + newElement.color.blue = [coder decodeCGFloatForKey:[NSString stringWithFormat:@"blue%lu", (unsigned long)i]]; + newElement.color.alpha = [coder decodeCGFloatForKey:[NSString stringWithFormat:@"alpha%lu", (unsigned long)i]]; + newElement.position = [coder decodeCGFloatForKey:[NSString stringWithFormat:@"position%lu", (unsigned long)i]]; - count--; [self addElement:&newElement]; } } @@ -238,6 +235,18 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Factory Methods @@ -246,7 +255,7 @@ -(instancetype)initWithCoder:(NSCoder *)coder * @param end The ending color. * @return A new CPTGradient instance initialized with an axial linear gradient between the two given colors. **/ -+(instancetype)gradientWithBeginningColor:(CPTColor *)begin endingColor:(CPTColor *)end ++(nonnull instancetype)gradientWithBeginningColor:(nonnull CPTColor *)begin endingColor:(nonnull CPTColor *)end { return [self gradientWithBeginningColor:begin endingColor:end beginningPosition:CPTFloat(0.0) endingPosition:CPTFloat(1.0)]; } @@ -258,7 +267,7 @@ +(instancetype)gradientWithBeginningColor:(CPTColor *)begin endingColor:(CPTColo * @param endingPosition The ending position (@num{0} ≤ @par{endingPosition} ≤ @num{1}). * @return A new CPTGradient instance initialized with an axial linear gradient between the two given colors, at two given normalized positions. **/ -+(instancetype)gradientWithBeginningColor:(CPTColor *)begin endingColor:(CPTColor *)end beginningPosition:(CGFloat)beginningPosition endingPosition:(CGFloat)endingPosition ++(nonnull instancetype)gradientWithBeginningColor:(nonnull CPTColor *)begin endingColor:(nonnull CPTColor *)end beginningPosition:(CGFloat)beginningPosition endingPosition:(CGFloat)endingPosition { CPTGradient *newInstance = [[self alloc] init]; @@ -280,7 +289,7 @@ +(instancetype)gradientWithBeginningColor:(CPTColor *)begin endingColor:(CPTColo /** @brief Creates and returns a new CPTGradient instance initialized with the Aqua selected gradient. * @return A new CPTGradient instance initialized with the Aqua selected gradient. **/ -+(instancetype)aquaSelectedGradient ++(nonnull instancetype)aquaSelectedGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -324,7 +333,7 @@ +(instancetype)aquaSelectedGradient /** @brief Creates and returns a new CPTGradient instance initialized with the Aqua normal gradient. * @return A new CPTGradient instance initialized with the Aqua normal gradient. **/ -+(instancetype)aquaNormalGradient ++(nonnull instancetype)aquaNormalGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -360,7 +369,7 @@ +(instancetype)aquaNormalGradient /** @brief Creates and returns a new CPTGradient instance initialized with the Aqua pressed gradient. * @return A new CPTGradient instance initialized with the Aqua pressed gradient. **/ -+(instancetype)aquaPressedGradient ++(nonnull instancetype)aquaPressedGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -396,7 +405,7 @@ +(instancetype)aquaPressedGradient /** @brief Creates and returns a new CPTGradient instance initialized with the unified selected gradient. * @return A new CPTGradient instance initialized with the unified selected gradient. **/ -+(instancetype)unifiedSelectedGradient ++(nonnull instancetype)unifiedSelectedGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -420,7 +429,7 @@ +(instancetype)unifiedSelectedGradient /** @brief Creates and returns a new CPTGradient instance initialized with the unified normal gradient. * @return A new CPTGradient instance initialized with the unified normal gradient. **/ -+(instancetype)unifiedNormalGradient ++(nonnull instancetype)unifiedNormalGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -444,7 +453,7 @@ +(instancetype)unifiedNormalGradient /** @brief Creates and returns a new CPTGradient instance initialized with the unified pressed gradient. * @return A new CPTGradient instance initialized with the unified pressed gradient. **/ -+(instancetype)unifiedPressedGradient ++(nonnull instancetype)unifiedPressedGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -468,7 +477,7 @@ +(instancetype)unifiedPressedGradient /** @brief Creates and returns a new CPTGradient instance initialized with the unified dark gradient. * @return A new CPTGradient instance initialized with the unified dark gradient. **/ -+(instancetype)unifiedDarkGradient ++(nonnull instancetype)unifiedDarkGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -492,7 +501,7 @@ +(instancetype)unifiedDarkGradient /** @brief Creates and returns a new CPTGradient instance initialized with the source list selected gradient. * @return A new CPTGradient instance initialized with the source list selected gradient. **/ -+(instancetype)sourceListSelectedGradient ++(nonnull instancetype)sourceListSelectedGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -520,7 +529,7 @@ +(instancetype)sourceListSelectedGradient /** @brief Creates and returns a new CPTGradient instance initialized with the source list unselected gradient. * @return A new CPTGradient instance initialized with the source list unselected gradient. **/ -+(instancetype)sourceListUnselectedGradient ++(nonnull instancetype)sourceListUnselectedGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -548,7 +557,7 @@ +(instancetype)sourceListUnselectedGradient /** @brief Creates and returns a new CPTGradient instance initialized with a rainbow gradient. * @return A new CPTGradient instance initialized with a rainbow gradient. **/ -+(instancetype)rainbowGradient ++(nonnull instancetype)rainbowGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -578,7 +587,7 @@ +(instancetype)rainbowGradient /** @brief Creates and returns a new CPTGradient instance initialized with a hydrogen spectrum gradient. * @return A new CPTGradient instance initialized with a hydrogen spectrum gradient. **/ -+(instancetype)hydrogenSpectrumGradient ++(nonnull instancetype)hydrogenSpectrumGradient { CPTGradient *newInstance = [[self alloc] init]; @@ -706,16 +715,16 @@ -(CPTGradient *)gradientWithBlendingMode:(CPTGradientBlendingMode)mode * @param position The color stop position (@num{0} ≤ @par{position} ≤ @num{1}). * @return A copy of the current gradient with the new color stop. **/ --(CPTGradient *)addColorStop:(CPTColor *)color atPosition:(CGFloat)position +-(CPTGradient *)addColorStop:(nonnull CPTColor *)color atPosition:(CGFloat)position { CPTGradient *newGradient = [self copy]; CPTGradientElement newGradientElement; - //put the components of color into the newGradientElement - must make sure it is a RGB color (not Gray or CMYK) + // put the components of color into the newGradientElement - must make sure it is a RGB color (not Gray or CMYK) newGradientElement.color = CPTRGBAColorFromCGColor(color.cgColor); newGradientElement.position = position; - //Pass it off to addElement to take care of adding it to the elementList + // Pass it off to addElement to take care of adding it to the elementList [newGradient addElement:&newGradientElement]; return newGradient; @@ -730,14 +739,14 @@ -(CPTGradient *)removeColorStopAtPosition:(CGFloat)position CPTGradient *newGradient = [self copy]; CPTGradientElement removedElement = [newGradient removeElementAtPosition:position]; - if ( isnan(removedElement.position) ) { - [NSException raise:NSRangeException format:@"-[%@ removeColorStopAtPosition:]: no such colorStop at position (%g)", [self class], position]; + if ( isnan(removedElement.position)) { + [NSException raise:NSRangeException format:@"-[%@ removeColorStopAtPosition:]: no such colorStop at position (%g)", [self class], (double)position]; } return newGradient; } -/** @brief Copies the current gradient and removes the color stop at @par{index} from the list of color stops. +/** @brief Copies the current gradient and removes the color stop at @par{idx} from the list of color stops. * @param idx The color stop index. * @return A copy of the current gradient with the color stop removed. **/ @@ -746,7 +755,7 @@ -(CPTGradient *)removeColorStopAtIndex:(NSUInteger)idx CPTGradient *newGradient = [self copy]; CPTGradientElement removedElement = [newGradient removeElementAtIndex:idx]; - if ( isnan(removedElement.position) ) { + if ( isnan(removedElement.position)) { [NSException raise:NSRangeException format:@"-[%@ removeColorStopAtIndex:]: index (%lu) beyond bounds", [self class], (unsigned long)idx]; } @@ -756,19 +765,18 @@ -(CPTGradient *)removeColorStopAtIndex:(NSUInteger)idx #pragma mark - #pragma mark Information -/** @brief Gets the color at color stop @par{index} from the list of color stops. +/** @brief Gets the color at color stop @par{idx} from the list of color stops. * @param idx The color stop index. - * @return The color at color stop @par{index}. + * @return The color at color stop @par{idx}. **/ -(CGColorRef)newColorStopAtIndex:(NSUInteger)idx { CPTGradientElement *element = [self elementAtIndex:idx]; if ( element != NULL ) { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGFloat colorComponents[4] = { element->color.red, element->color.green, element->color.blue, element->color.alpha }; return CGColorCreate(self.colorspace.cgColorSpace, colorComponents); - #else return CGColorCreateGenericRGB(element->color.red, element->color.green, element->color.blue, element->color.alpha); #endif @@ -790,19 +798,19 @@ -(CGColorRef)newColorAtPosition:(CGFloat)position switch ( self.blendingMode ) { case CPTLinearBlendingMode: - CPTLinearEvaluation( (__bridge void *)(self), &position, components ); + CPTLinearEvaluation((__bridge void *)(self), &position, components); break; case CPTChromaticBlendingMode: - CPTChromaticEvaluation( (__bridge void *)(self), &position, components ); + CPTChromaticEvaluation((__bridge void *)(self), &position, components); break; case CPTInverseChromaticBlendingMode: - CPTInverseChromaticEvaluation( (__bridge void *)(self), &position, components ); + CPTInverseChromaticEvaluation((__bridge void *)(self), &position, components); break; } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGFloat colorComponents[4] = { components[0], components[1], components[2], components[3] }; gradientColor = CGColorCreate(self.colorspace.cgColorSpace, colorComponents); #else @@ -819,7 +827,7 @@ -(CGColorRef)newColorAtPosition:(CGFloat)position * @param rect The rectangle to draw into. * @param context The graphics context to draw into. **/ --(void)drawSwatchInRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawSwatchInRect:(CGRect)rect inContext:(nonnull CGContextRef)context { [self fillRect:rect inContext:context]; } @@ -828,7 +836,7 @@ -(void)drawSwatchInRect:(CGRect)rect inContext:(CGContextRef)context * @param rect The rectangle to draw into. * @param context The graphics context to draw into. **/ --(void)fillRect:(CGRect)rect inContext:(CGContextRef)context +-(void)fillRect:(CGRect)rect inContext:(nonnull CGContextRef)context { CGShadingRef myCGShading = NULL; @@ -855,9 +863,9 @@ -(void)fillRect:(CGRect)rect inContext:(CGContextRef)context /** @brief Draws the gradient into the given graphics context clipped to the current drawing path. * @param context The graphics context to draw into. **/ --(void)fillPathInContext:(CGContextRef)context +-(void)fillPathInContext:(nonnull CGContextRef)context { - if ( !CGContextIsPathEmpty(context) ) { + if ( !CGContextIsPathEmpty(context)) { CGShadingRef myCGShading = NULL; CGContextSaveGState(context); @@ -885,20 +893,24 @@ -(void)fillPathInContext:(CGContextRef)context #pragma mark - #pragma mark Opacity +/// @cond + -(BOOL)isOpaque { BOOL opaqueGradient = YES; CPTGradientElement *list = self.elementList; - while ( opaqueGradient && (list != NULL) ) { - opaqueGradient = opaqueGradient && ( list->color.alpha >= CPTFloat(1.0) ); + while ( opaqueGradient && (list != NULL)) { + opaqueGradient = opaqueGradient && (list->color.alpha >= CPTFloat(1.0)); list = list->nextElement; } return opaqueGradient; } +/// @endcond + #pragma mark - #pragma mark Gradient comparison @@ -910,7 +922,7 @@ -(BOOL)isOpaque * @param object The object to be compared with the receiver. * @return @YES if @par{object} is equal to the receiver, @NO otherwise. **/ --(BOOL)isEqual:(id)object +-(BOOL)isEqual:(nullable id)object { if ( self == object ) { return YES; @@ -990,7 +1002,7 @@ -(NSUInteger)hash return (NSUInteger)theHash; } else { - return self.blendingMode + self.gradientType; + return (NSUInteger)(self.blendingMode + self.gradientType); } } @@ -999,7 +1011,9 @@ -(NSUInteger)hash #pragma mark - #pragma mark Accessors --(void)setGradientFunction:(CGFunctionRef)newGradientFunction +/// @cond + +-(void)setGradientFunction:(nonnull CGFunctionRef)newGradientFunction { if ( newGradientFunction != gradientFunction ) { CGFunctionRelease(gradientFunction); @@ -1007,23 +1021,25 @@ -(void)setGradientFunction:(CGFunctionRef)newGradientFunction } } +/// @endcond + #pragma mark - #pragma mark Private Methods /// @cond --(CGShadingRef)newAxialGradientInRect:(CGRect)rect +-(nonnull CGShadingRef)newAxialGradientInRect:(CGRect)rect { // First Calculate where the beginning and ending points should be CGPoint startPoint, endPoint; - if ( self.angle == 0.0 ) { - startPoint = CPTPointMake( CGRectGetMinX(rect), CGRectGetMinY(rect) ); // right of rect - endPoint = CPTPointMake( CGRectGetMaxX(rect), CGRectGetMinY(rect) ); // left of rect + if ( self.angle == CPTFloat(0.0)) { + startPoint = CPTPointMake(CGRectGetMinX(rect), CGRectGetMinY(rect)); // right of rect + endPoint = CPTPointMake(CGRectGetMaxX(rect), CGRectGetMinY(rect)); // left of rect } - else if ( self.angle == 90.0 ) { - startPoint = CPTPointMake( CGRectGetMinX(rect), CGRectGetMinY(rect) ); // bottom of rect - endPoint = CPTPointMake( CGRectGetMinX(rect), CGRectGetMaxY(rect) ); // top of rect + else if ( self.angle == CPTFloat(90.0)) { + startPoint = CPTPointMake(CGRectGetMinX(rect), CGRectGetMinY(rect)); // bottom of rect + endPoint = CPTPointMake(CGRectGetMinX(rect), CGRectGetMaxY(rect)); // top of rect } else { // ok, we'll do the calculations now CGFloat x, y; @@ -1032,9 +1048,9 @@ -(CGShadingRef)newAxialGradientInRect:(CGRect)rect CGFloat length; CGFloat deltaX, deltaY; - CGFloat rAngle = self.angle * CPTFloat(M_PI / 180.0); //convert the angle to radians + CGFloat rAngle = self.angle * CPTFloat(M_PI / 180.0); // convert the angle to radians - if ( fabs( tan(rAngle) ) <= CPTFloat(1.0) ) { //for range [-45,45], [135,225] + if ( fabs(tan(rAngle)) <= CPTFloat(1.0)) { // for range [-45,45], [135,225] x = CGRectGetWidth(rect); y = CGRectGetHeight(rect); @@ -1042,12 +1058,12 @@ -(CGShadingRef)newAxialGradientInRect:(CGRect)rect cosA = cos(rAngle); tanA = tan(rAngle); - length = x / fabs(cosA) + ( y - x * fabs(tanA) ) * fabs(sinA); + length = x / fabs(cosA) + (y - x * fabs(tanA)) * fabs(sinA); deltaX = length * cosA / CPTFloat(2.0); deltaY = length * sinA / CPTFloat(2.0); } - else { //for range [45,135], [225,315] + else { // for range [45,135], [225,315] x = CGRectGetHeight(rect); y = CGRectGetWidth(rect); @@ -1057,7 +1073,7 @@ -(CGShadingRef)newAxialGradientInRect:(CGRect)rect cosA = cos(rAngle); tanA = tan(rAngle); - length = x / fabs(cosA) + ( y - x * fabs(tanA) ) * fabs(sinA); + length = x / fabs(cosA) + (y - x * fabs(tanA)) * fabs(sinA); deltaX = -length * sinA / CPTFloat(2.0); deltaY = length * cosA / CPTFloat(2.0); @@ -1072,7 +1088,7 @@ -(CGShadingRef)newAxialGradientInRect:(CGRect)rect return myCGShading; } --(CGShadingRef)newRadialGradientInRect:(CGRect)rect context:(CGContextRef)context +-(nonnull CGShadingRef)newRadialGradientInRect:(CGRect)rect context:(nonnull CGContextRef)context { CGPoint startPoint, endPoint; CGFloat startRadius, endRadius; @@ -1080,15 +1096,15 @@ -(CGShadingRef)newRadialGradientInRect:(CGRect)rect context:(CGContextRef)contex CGPoint theStartAnchor = self.startAnchor; - startPoint = CPTPointMake( fma( CGRectGetWidth(rect), theStartAnchor.x, CGRectGetMinX(rect) ), - fma( CGRectGetHeight(rect), theStartAnchor.y, CGRectGetMinY(rect) ) ); + startPoint = CPTPointMake(fma(CGRectGetWidth(rect), theStartAnchor.x, CGRectGetMinX(rect)), + fma(CGRectGetHeight(rect), theStartAnchor.y, CGRectGetMinY(rect))); CGPoint theEndAnchor = self.endAnchor; - endPoint = CPTPointMake( fma( CGRectGetWidth(rect), theEndAnchor.x, CGRectGetMinX(rect) ), - fma( CGRectGetHeight(rect), theEndAnchor.y, CGRectGetMinY(rect) ) ); + endPoint = CPTPointMake(fma(CGRectGetWidth(rect), theEndAnchor.x, CGRectGetMinX(rect)), + fma(CGRectGetHeight(rect), theEndAnchor.y, CGRectGetMinY(rect))); startRadius = CPTFloat(-1.0); - if ( CGRectGetHeight(rect) > CGRectGetWidth(rect) ) { + if ( CGRectGetHeight(rect) > CGRectGetWidth(rect)) { scaleX = CGRectGetWidth(rect) / CGRectGetHeight(rect); startPoint.x /= scaleX; endPoint.x /= scaleX; @@ -1135,19 +1151,23 @@ -(void)setBlendingMode:(CPTGradientBlendingMode)mode static const CGFloat input_value_range[2] = { 0, 1 }; // range for the evaluator input static const CGFloat output_value_ranges[8] = { 0, 1, 0, 1, 0, 1, 0, 1 }; // ranges for the evaluator output (4 returned values) - self.gradientFunction = CGFunctionCreate( (__bridge void *)(self), //the two transition colors - 1, input_value_range, //number of inputs (just fraction of progression) - 4, output_value_ranges, //number of outputs (4 - RGBa) - &evaluationCallbackInfo ); //info for using the evaluator function + CGFunctionRef cgFunction = CGFunctionCreate((__bridge void *)(self), // the two transition colors + 1, input_value_range, // number of inputs (just fraction of progression) + 4, output_value_ranges, // number of outputs (4 - RGBa) + &evaluationCallbackInfo); // info for using the evaluator function + + if ( cgFunction ) { + self.gradientFunction = cgFunction; + } } --(void)addElement:(CPTGradientElement *)newElement +-(void)addElement:(nonnull CPTGradientElement *)newElement { CPTGradientElement *curElement = self.elementList; - if ( (curElement == NULL) || (newElement->position < curElement->position) ) { + if ((curElement == NULL) || (newElement->position < curElement->position)) { CPTGradientElement *tmpNext = curElement; - CPTGradientElement *newElementList = malloc( sizeof(CPTGradientElement) ); + CPTGradientElement *newElementList = calloc(1, sizeof(CPTGradientElement)); if ( newElementList ) { *newElementList = *newElement; newElementList->nextElement = tmpNext; @@ -1156,13 +1176,13 @@ -(void)addElement:(CPTGradientElement *)newElement } else { while ( curElement->nextElement != NULL && - !( (curElement->position <= newElement->position) && - (newElement->position < curElement->nextElement->position) ) ) { + !((curElement->position <= newElement->position) && + (newElement->position < curElement->nextElement->position))) { curElement = curElement->nextElement; } CPTGradientElement *tmpNext = curElement->nextElement; - curElement->nextElement = malloc( sizeof(CPTGradientElement) ); + curElement->nextElement = calloc(1, sizeof(CPTGradientElement)); *(curElement->nextElement) = *newElement; curElement->nextElement->nextElement = tmpNext; } @@ -1183,7 +1203,7 @@ -(CPTGradientElement)removeElementAtIndex:(NSUInteger)idx return removedElement; } - NSUInteger count = 1; //we want to start one ahead + NSUInteger count = 1; // we want to start one ahead CPTGradientElement *currentElement = self.elementList; while ( currentElement->nextElement != NULL ) { if ( count == idx ) { @@ -1206,7 +1226,7 @@ -(CPTGradientElement)removeElementAtIndex:(NSUInteger)idx removedElement.color.green = CPTFloat(0.0); removedElement.color.blue = CPTFloat(0.0); removedElement.color.alpha = CPTFloat(0.0); - removedElement.position = NAN; + removedElement.position = CPTNAN; removedElement.nextElement = NULL; return removedElement; @@ -1247,7 +1267,7 @@ -(CPTGradientElement)removeElementAtPosition:(CGFloat)position removedElement.color.green = CPTFloat(0.0); removedElement.color.blue = CPTFloat(0.0); removedElement.color.alpha = CPTFloat(0.0); - removedElement.position = NAN; + removedElement.position = CPTNAN; removedElement.nextElement = NULL; return removedElement; @@ -1266,7 +1286,7 @@ -(void)removeAllElements self.elementList = NULL; } --(CPTGradientElement *)elementAtIndex:(NSUInteger)idx +-(nullable CPTGradientElement *)elementAtIndex:(NSUInteger)idx { NSUInteger count = 0; CPTGradientElement *currentElement = self.elementList; @@ -1303,12 +1323,12 @@ -(NSUInteger)elementCount /// @cond -void CPTLinearEvaluation(void *info, const CGFloat *in, CGFloat *out) +void CPTLinearEvaluation(void *__nullable info, const CGFloat *__nonnull in, CGFloat *__nonnull out) { CGFloat position = *in; CPTGradient *gradient = (__bridge CPTGradient *)info; - //This grabs the first two colors in the sequence + // This grabs the first two colors in the sequence CPTGradientElement *color1 = gradient.elementList; if ( color1 == NULL ) { @@ -1318,24 +1338,24 @@ void CPTLinearEvaluation(void *info, const CGFloat *in, CGFloat *out) CPTGradientElement *color2 = color1->nextElement; - //make sure first color and second color are on other sides of position + // make sure first color and second color are on other sides of position while ( color2 != NULL && color2->position < position ) { color1 = color2; color2 = color1->nextElement; } - //if we don't have another color then make next color the same color + // if we don't have another color then make next color the same color if ( color2 == NULL ) { color2 = color1; } - //----------FailSafe settings---------- - //color1->red = 1; color2->red = 0; - //color1->green = 1; color2->green = 0; - //color1->blue = 1; color2->blue = 0; - //color1->alpha = 1; color2->alpha = 1; - //color1->position = 0.5; - //color2->position = 0.5; - //------------------------------------- + // ----------FailSafe settings---------- + // color1->red = 1; color2->red = 0; + // color1->green = 1; color2->green = 0; + // color1->blue = 1; color2->blue = 0; + // color1->alpha = 1; color2->alpha = 1; + // color1->position = 0.5; + // color2->position = 0.5; + // ------------------------------------- if ( position <= color1->position ) { out[0] = color1->color.red; @@ -1350,7 +1370,7 @@ void CPTLinearEvaluation(void *info, const CGFloat *in, CGFloat *out) out[3] = color2->color.alpha; } else { - //adjust position so that it goes from 0 to 1 in the range from color 1 & 2's position + // adjust position so that it goes from 0 to 1 in the range from color 1 & 2's position position = (position - color1->position) / (color2->position - color1->position); out[0] = (color2->color.red - color1->color.red) * position + color1->color.red; @@ -1360,21 +1380,21 @@ void CPTLinearEvaluation(void *info, const CGFloat *in, CGFloat *out) } } -// Chromatic Evaluation - -// This blends colors by their Hue, Saturation, and Value(Brightness) right now I just -// transform the RGB values stored in the CPTGradientElements to HSB, in the future I may -// streamline it to avoid transforming in and out of HSB colorspace *for later* +// Chromatic Evaluation - +// This blends colors by their Hue, Saturation, and Value(Brightness) right now I just +// transform the RGB values stored in the CPTGradientElements to HSB, in the future I may +// streamline it to avoid transforming in and out of HSB colorspace *for later* // -// For the chromatic blend we shift the hue of color1 to meet the hue of color2. To do -// this we will add to the hue's angle (if we subtract we'll be doing the inverse -// chromatic...scroll down more for that). All we need to do is keep adding to the hue -// until we wrap around the color wheel and get to color2. -void CPTChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out) +// For the chromatic blend we shift the hue of color1 to meet the hue of color2. To do +// this we will add to the hue's angle (if we subtract we'll be doing the inverse +// chromatic...scroll down more for that). All we need to do is keep adding to the hue +// until we wrap around the color wheel and get to color2. +void CPTChromaticEvaluation(void *__nullable info, const CGFloat *__nonnull in, CGFloat *__nonnull out) { CGFloat position = *in; CPTGradient *gradient = (__bridge CPTGradient *)info; - //This grabs the first two colors in the sequence + // This grabs the first two colors in the sequence CPTGradientElement *color1 = gradient.elementList; if ( color1 == NULL ) { @@ -1429,7 +1449,7 @@ void CPTChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out) out[3] = c2[3]; } else { - //adjust position so that it goes from 0 to 1 in the range from color 1 & 2's position + // adjust position so that it goes from 0 to 1 in the range from color 1 & 2's position position = (position - color1->position) / (color2->position - color1->position); out[0] = (c2[0] - c1[0]) * position + c1[0]; @@ -1441,17 +1461,17 @@ void CPTChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out) CPTTransformHSV_RGB(out); } -// Inverse Chromatic Evaluation - -// Inverse Chromatic is about the same story as Chromatic Blend, but here the Hue -// is strictly decreasing, that is we need to get from color1 to color2 by decreasing -// the 'angle' (i.e. 90º -> 180º would be done by subtracting 270º and getting -180º... -// which is equivalent to 180º mod 360º -void CPTInverseChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out) +// Inverse Chromatic Evaluation - +// Inverse Chromatic is about the same story as Chromatic Blend, but here the Hue +// is strictly decreasing, that is we need to get from color1 to color2 by decreasing +// the 'angle' (i.e. 90º -> 180º would be done by subtracting 270º and getting -180º... +// which is equivalent to 180º mod 360º +void CPTInverseChromaticEvaluation(void *__nullable info, const CGFloat *__nonnull in, CGFloat *__nonnull out) { CGFloat position = *in; CPTGradient *gradient = (__bridge CPTGradient *)info; - //This grabs the first two colors in the sequence + // This grabs the first two colors in the sequence CPTGradientElement *color1 = gradient.elementList; if ( color1 == NULL ) { @@ -1464,7 +1484,7 @@ void CPTInverseChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out) CGFloat c1[4]; CGFloat c2[4]; - //make sure first color and second color are on other sides of position + // make sure first color and second color are on other sides of position while ( color2 != NULL && color2->position < position ) { color1 = color2; color2 = color1->nextElement; @@ -1489,8 +1509,8 @@ void CPTInverseChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out) CPTTransformRGB_HSV(c2); CPTResolveHSV(c1, c2); - if ( c1[0] < c2[0] ) { //if color1's hue is higher than color2's hue then - c1[0] += CPTFloat(360.0); // we need to move c2 one revolution back on the wheel + if ( c1[0] < c2[0] ) { // if color1's hue is higher than color2's hue then + c1[0] += CPTFloat(360.0); // we need to move c2 one revolution back on the wheel } if ( position <= color1->position ) { out[0] = c1[0]; @@ -1505,7 +1525,7 @@ void CPTInverseChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out) out[3] = c2[3]; } else { - //adjust position so that it goes from 0 to 1 in the range from color 1 & 2's position + // adjust position so that it goes from 0 to 1 in the range from color 1 & 2's position position = (position - color1->position) / (color2->position - color1->position); out[0] = (c2[0] - c1[0]) * position + c1[0]; @@ -1517,9 +1537,9 @@ void CPTInverseChromaticEvaluation(void *info, const CGFloat *in, CGFloat *out) CPTTransformHSV_RGB(out); } -void CPTTransformRGB_HSV(CGFloat *components) //H,S,B -> R,G,B +void CPTTransformRGB_HSV(CGFloat *__nonnull components) // H,S,B -> R,G,B { - CGFloat H = NAN, S, V; + CGFloat H = CPTNAN, S, V; CGFloat R = components[0]; CGFloat G = components[1]; CGFloat B = components[2]; @@ -1550,14 +1570,14 @@ void CPTTransformRGB_HSV(CGFloat *components) //H,S,B -> R,G,B components[2] = V; } -void CPTTransformHSV_RGB(CGFloat *components) //H,S,B -> R,G,B +void CPTTransformHSV_RGB(CGFloat *__nonnull components) // H,S,B -> R,G,B { CGFloat R = CPTFloat(0.0), G = CPTFloat(0.0), B = CPTFloat(0.0); - CGFloat H = fmod( components[0], CPTFloat(360.0) ); //map to [0,360) + CGFloat H = fmod(components[0], CPTFloat(360.0)); // map to [0,360) CGFloat S = components[1]; CGFloat V = components[2]; - int Hi = (int)lrint( floor( H / CPTFloat(60.0) ) ) % 6; + int Hi = (int)lrint(floor(H / CPTFloat(60.0))) % 6; CGFloat f = H / CPTFloat(60.0) - Hi; CGFloat p = V * (CPTFloat(1.0) - S); CGFloat q = V * (CPTFloat(1.0) - f * S); @@ -1609,15 +1629,15 @@ void CPTTransformHSV_RGB(CGFloat *components) //H,S,B -> R,G,B components[2] = B; } -void CPTResolveHSV(CGFloat *color1, CGFloat *color2) // H value may be undefined (i.e. grayscale color) -{ // we want to fill it with a sensible value - if ( isnan(color1[0]) && isnan(color2[0]) ) { +void CPTResolveHSV(CGFloat *__nonnull color1, CGFloat *__nonnull color2) // H value may be undefined (i.e. grayscale color) +{ // we want to fill it with a sensible value + if ( isnan(color1[0]) && isnan(color2[0])) { color1[0] = color2[0] = 0; } - else if ( isnan(color1[0]) ) { + else if ( isnan(color1[0])) { color1[0] = color2[0]; } - else if ( isnan(color2[0]) ) { + else if ( isnan(color2[0])) { color2[0] = color1[0]; } } @@ -1629,11 +1649,11 @@ void CPTResolveHSV(CGFloat *color1, CGFloat *color2) // H value may be undefined /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { const CGRect rect = CGRectMake(0.0, 0.0, 100.0, 100.0); - return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat scale, CGRect bounds) { + return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat __unused scale, CGRect bounds) { switch ( self.gradientType ) { case CPTGradientTypeAxial: CGContextAddRect(context, bounds); diff --git a/framework/Source/CPTGradientTests.m b/framework/Source/CPTGradientTests.m index 48052b5eb..12fb1d2e3 100644 --- a/framework/Source/CPTGradientTests.m +++ b/framework/Source/CPTGradientTests.m @@ -11,7 +11,7 @@ -(void)testKeyedArchivingRoundTrip { CPTGradient *gradient = [CPTGradient rainbowGradient]; - CPTGradient *newGradient = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:gradient]]; + CPTGradient *newGradient = [self archiveRoundTrip:gradient]; XCTAssertEqualObjects(gradient, newGradient, @"Gradients not equal"); } diff --git a/framework/Source/CPTGraph.h b/framework/Source/CPTGraph.h index 491c8e891..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; /// @} @@ -64,7 +74,7 @@ typedef NS_ENUM (NSInteger, CPTGraphLayerType) { /// @name Hosting View /// @{ -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTGraphHostingView *hostingView; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTGraphHostingView *hostingView; /// @} /// @name Title @@ -81,7 +91,7 @@ typedef NS_ENUM (NSInteger, CPTGraphLayerType) { @property (nonatomic, readwrite, strong, nullable) CPTAxisSet *axisSet; @property (nonatomic, readwrite, strong, nullable) CPTPlotAreaFrame *plotAreaFrame; @property (nonatomic, readonly, nullable) CPTPlotSpace *defaultPlotSpace; -@property (nonatomic, readwrite, strong, nullable) CPTNumberArray topDownLayerOrder; +@property (nonatomic, readwrite, strong, nullable) CPTNumberArray *topDownLayerOrder; /// @} /// @name Legend @@ -99,24 +109,24 @@ typedef NS_ENUM (NSInteger, CPTGraphLayerType) { /// @name Retrieving Plots /// @{ --(nonnull CPTPlotArray)allPlots; +-(nonnull CPTPlotArray *)allPlots; -(nullable CPTPlot *)plotAtIndex:(NSUInteger)idx; -(nullable CPTPlot *)plotWithIdentifier:(nullable id)identifier; /// @} /// @name Adding and Removing Plots /// @{ --(void)addPlot:(nullable CPTPlot *)plot; --(void)addPlot:(nullable CPTPlot *)plot toPlotSpace:(nullable CPTPlotSpace *)space; +-(void)addPlot:(nonnull CPTPlot *)plot; +-(void)addPlot:(nonnull CPTPlot *)plot toPlotSpace:(nullable CPTPlotSpace *)space; -(void)removePlot:(nullable CPTPlot *)plot; -(void)removePlotWithIdentifier:(nullable id)identifier; --(void)insertPlot:(nullable CPTPlot *)plot atIndex:(NSUInteger)idx; --(void)insertPlot:(nullable CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(nullable CPTPlotSpace *)space; +-(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx; +-(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(nullable CPTPlotSpace *)space; /// @} /// @name Retrieving Plot Spaces /// @{ --(nonnull CPTPlotSpaceArray)allPlotSpaces; +-(nonnull CPTPlotSpaceArray *)allPlotSpaces; -(nullable CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)idx; -(nullable CPTPlotSpace *)plotSpaceWithIdentifier:(nullable id)identifier; /// @} diff --git a/framework/Source/CPTGraph.m b/framework/Source/CPTGraph.m index c39022c06..9255efe02 100644 --- a/framework/Source/CPTGraph.m +++ b/framework/Source/CPTGraph.m @@ -17,23 +17,23 @@ /** @defgroup graphAnimation Graphs * @brief Graph properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif * @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() -@property (nonatomic, readwrite, strong, nonnull) CPTMutablePlotArray plots; -@property (nonatomic, readwrite, strong, nonnull) CPTMutablePlotSpaceArray plotSpaces; -@property (nonatomic, readwrite, strong) CPTLayerAnnotation *titleAnnotation; -@property (nonatomic, readwrite, strong) CPTLayerAnnotation *legendAnnotation; +@property (nonatomic, readwrite, strong, nonnull) CPTMutablePlotArray *plots; +@property (nonatomic, readwrite, strong, nonnull) CPTMutablePlotSpaceArray *plotSpaces; +@property (nonatomic, readwrite, strong, nullable) CPTLayerAnnotation *titleAnnotation; +@property (nonatomic, readwrite, strong, nullable) CPTLayerAnnotation *legendAnnotation; @property (nonatomic, readwrite, assign) BOOL inTitleUpdate; -(void)plotSpaceMappingDidChange:(nonnull NSNotification *)notif; @@ -66,54 +66,54 @@ -(CGPoint)contentAnchorForRectAnchor:(CPTRectAnchor)anchor; **/ @implementation CPTGraph -/** @property cpt_weak CPTGraphHostingView *hostingView +/** @property nullable CPTGraphHostingView *hostingView * @brief The hosting view that contains the graph. **/ @synthesize hostingView; -/** @property CPTAxisSet *axisSet +/** @property nullable CPTAxisSet *axisSet * @brief The axis set. **/ @dynamic axisSet; -/** @property CPTPlotAreaFrame *plotAreaFrame +/** @property nullable CPTPlotAreaFrame *plotAreaFrame * @brief The plot area frame. **/ @synthesize plotAreaFrame; /// @cond -/** @property CPTMutablePlotArray plots +/** @property nonnull CPTMutablePlotArray *plots * @brief An array of all plots associated with the graph. **/ @synthesize plots; -/** @property CPTMutablePlotSpaceArray plotSpaces +/** @property nonnull CPTMutablePlotSpaceArray *plotSpaces * @brief An array of all plot spaces associated with the graph. **/ @synthesize plotSpaces; /// @endcond -/** @property CPTPlotSpace *defaultPlotSpace +/** @property nullable CPTPlotSpace *defaultPlotSpace * @brief The default plot space. **/ @dynamic defaultPlotSpace; -/** @property CPTNumberArray topDownLayerOrder +/** @property nullable CPTNumberArray *topDownLayerOrder * @brief An array of graph layers to be drawn in an order other than the default. * @see CPTPlotArea @link CPTPlotArea::topDownLayerOrder topDownLayerOrder @endlink property. **/ @dynamic topDownLayerOrder; -/** @property NSString *title +/** @property nullable NSString *title * @brief The title string. * * Assigning a new value to this property also sets the value of the @ref attributedTitle property to @nil. **/ @synthesize title; -/** @property NSAttributedString *attributedTitle +/** @property nullable NSAttributedString *attributedTitle * @brief The styled title string. * * Assigning a new value to this property also sets the value of the @ref title property to the @@ -123,7 +123,7 @@ @implementation CPTGraph **/ @synthesize attributedTitle; -/** @property CPTTextStyle *titleTextStyle +/** @property nullable CPTTextStyle *titleTextStyle * @brief The text style of the title. * * Assigning a new value to this property also sets the value of the @ref attributedTitle property to @nil. @@ -142,7 +142,7 @@ @implementation CPTGraph **/ @synthesize titleDisplacement; -/** @property CPTLegend *legend +/** @property nullable CPTLegend *legend * @brief The graph legend. * Setting this property will automatically anchor the legend to the graph and position it * using the @ref legendAnchor and @ref legendDisplacement properties. This is a convenience property @@ -198,9 +198,9 @@ @implementation CPTGraph * @param newFrame The frame rectangle. * @return The initialized CPTGraph object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { hostingView = nil; plots = [[NSMutableArray alloc] init]; @@ -248,9 +248,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTGraph *theLayer = (CPTGraph *)layer; hostingView = theLayer->hostingView; @@ -284,7 +284,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -307,13 +307,16 @@ -(void)encodeWithCoder:(NSCoder *)coder // inTitleUpdate } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - hostingView = [coder decodeObjectForKey:@"CPTGraph.hostingView"]; - plotAreaFrame = [coder decodeObjectForKey:@"CPTGraph.plotAreaFrame"]; - - CPTPlotArray plotArray = [coder decodeObjectForKey:@"CPTGraph.plots"]; + if ((self = [super initWithCoder:coder])) { + hostingView = [coder decodeObjectOfClass:[CPTGraphHostingView class] + forKey:@"CPTGraph.hostingView"]; + plotAreaFrame = [coder decodeObjectOfClass:[CPTPlotAreaFrame class] + forKey:@"CPTGraph.plotAreaFrame"]; + + CPTPlotArray *plotArray = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTPlot class]]] + forKey:@"CPTGraph.plots"]; if ( plotArray ) { plots = [plotArray mutableCopy]; } @@ -321,24 +324,32 @@ -(instancetype)initWithCoder:(NSCoder *)coder plots = [[NSMutableArray alloc] init]; } - CPTPlotSpaceArray plotSpaceArray = [coder decodeObjectForKey:@"CPTGraph.plotSpaces"]; + plotSpaces = [[NSMutableArray alloc] init]; + + CPTPlotSpaceArray *plotSpaceArray = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTPlotSpace class]]] + forKey:@"CPTGraph.plotSpaces"]; if ( plotSpaceArray ) { - plotSpaces = [plotSpaceArray mutableCopy]; - } - else { - plotSpaces = [[NSMutableArray alloc] init]; + for ( CPTPlotSpace *space in plotSpaceArray ) { + [self addPlotSpace:space]; + } } - title = [[coder decodeObjectForKey:@"CPTGraph.title"] copy]; - attributedTitle = [[coder decodeObjectForKey:@"CPTGraph.attributedTitle"] copy]; - titleTextStyle = [[coder decodeObjectForKey:@"CPTGraph.titleTextStyle"] copy]; - titlePlotAreaFrameAnchor = (CPTRectAnchor)[coder decodeIntegerForKey : @"CPTGraph.titlePlotAreaFrameAnchor"]; + title = [[coder decodeObjectOfClass:[NSString class] + forKey:@"CPTGraph.title"] copy]; + attributedTitle = [[coder decodeObjectOfClass:[NSAttributedString class] + forKey:@"CPTGraph.attributedTitle"] copy]; + titleTextStyle = [[coder decodeObjectOfClass:[CPTTextStyle class] + forKey:@"CPTGraph.titleTextStyle"] copy]; + titlePlotAreaFrameAnchor = (CPTRectAnchor)[coder decodeIntegerForKey:@"CPTGraph.titlePlotAreaFrameAnchor"]; titleDisplacement = [coder decodeCPTPointForKey:@"CPTGraph.titleDisplacement"]; - titleAnnotation = [coder decodeObjectForKey:@"CPTGraph.titleAnnotation"]; - legend = [coder decodeObjectForKey:@"CPTGraph.legend"]; - legendAnnotation = [coder decodeObjectForKey:@"CPTGraph.legendAnnotation"]; - legendAnchor = (CPTRectAnchor)[coder decodeIntegerForKey : @"CPTGraph.legendAnchor"]; - legendDisplacement = [coder decodeCPTPointForKey:@"CPTGraph.legendDisplacement"]; + titleAnnotation = [coder decodeObjectOfClass:[CPTLayerAnnotation class] + forKey:@"CPTGraph.titleAnnotation"]; + legend = [coder decodeObjectOfClass:[CPTLegend class] + forKey:@"CPTGraph.legend"]; + legendAnnotation = [coder decodeObjectOfClass:[CPTLayerAnnotation class] + forKey:@"CPTGraph.legendAnnotation"]; + legendAnchor = (CPTRectAnchor)[coder decodeIntegerForKey:@"CPTGraph.legendAnchor"]; + legendDisplacement = [coder decodeCPTPointForKey:@"CPTGraph.legendDisplacement"]; inTitleUpdate = NO; } @@ -347,16 +358,64 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /// @cond --(void)layoutAndRenderInContext:(CGContextRef)context +-(void)layoutAndRenderInContext:(nonnull CGContextRef)context { [self reloadDataIfNeeded]; [self.axisSet.axes makeObjectsPerformSelector:@selector(relabel)]; - [super layoutAndRenderInContext:context]; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" +#if TARGET_OS_OSX + // Workaround since @available macro is not there + if ( [NSView instancesRespondToSelector:@selector(effectiveAppearance)] ) { + NSAppearance *oldAppearance = NSAppearance.currentAppearance; + NSView *view = (NSView *)self.hostingView; + NSAppearance.currentAppearance = view.effectiveAppearance; + [super layoutAndRenderInContext:context]; + NSAppearance.currentAppearance = oldAppearance; + } + else { + [super layoutAndRenderInContext:context]; + } +#else + if ( @available(iOS 13, *)) { + if ( [UITraitCollection instancesRespondToSelector:@selector(performAsCurrentTraitCollection:)] ) { + UITraitCollection *traitCollection = ((UIView *)self.hostingView).traitCollection; + if ( traitCollection ) { + [traitCollection performAsCurrentTraitCollection: ^{ + [super layoutAndRenderInContext:context]; + }]; + } + else { + [super layoutAndRenderInContext:context]; + } + } + else { + [super layoutAndRenderInContext:context]; + } + } + else { + [super layoutAndRenderInContext:context]; + } +#endif +#pragma clang diagnostic pop } /// @endcond @@ -366,7 +425,7 @@ -(void)layoutAndRenderInContext:(CGContextRef)context /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken = 0; @@ -409,7 +468,7 @@ -(void)reloadDataIfNeeded /** @brief All plots associated with the graph. * @return An array of all plots associated with the graph. **/ --(CPTPlotArray)allPlots +-(nonnull CPTPlotArray *)allPlots { return [NSArray arrayWithArray:self.plots]; } @@ -418,7 +477,7 @@ -(CPTPlotArray)allPlots * @param idx An index within the bounds of the plot array. * @return The plot at the given index. **/ --(CPTPlot *)plotAtIndex:(NSUInteger)idx +-(nullable CPTPlot *)plotAtIndex:(NSUInteger)idx { if ( idx < self.plots.count ) { return (self.plots)[idx]; @@ -432,10 +491,10 @@ -(CPTPlot *)plotAtIndex:(NSUInteger)idx * @param identifier A plot identifier. * @return The plot with the given identifier or @nil if it was not found. **/ --(CPTPlot *)plotWithIdentifier:(id)identifier +-(nullable CPTPlot *)plotWithIdentifier:(nullable id)identifier { for ( CPTPlot *plot in self.plots ) { - if ( [[plot identifier] isEqual:identifier] ) { + if ( [plot.identifier isEqual:identifier] ) { return plot; } } @@ -448,7 +507,7 @@ -(CPTPlot *)plotWithIdentifier:(id)identifier /** @brief Add a plot to the default plot space. * @param plot The plot. **/ --(void)addPlot:(CPTPlot *)plot +-(void)addPlot:(nonnull CPTPlot *)plot { [self addPlot:plot toPlotSpace:self.defaultPlotSpace]; } @@ -457,7 +516,7 @@ -(void)addPlot:(CPTPlot *)plot * @param plot The plot. * @param space The plot space. **/ --(void)addPlot:(CPTPlot *)plot toPlotSpace:(CPTPlotSpace *)space +-(void)addPlot:(nonnull CPTPlot *)plot toPlotSpace:(nullable CPTPlotSpace *)space { if ( plot ) { [self.plots addObject:plot]; @@ -470,16 +529,20 @@ -(void)addPlot:(CPTPlot *)plot toPlotSpace:(CPTPlotSpace *)space /** @brief Remove a plot from the graph. * @param plot The plot to remove. **/ --(void)removePlot:(CPTPlot *)plot +-(void)removePlot:(nullable CPTPlot *)plot { - if ( [self.plots containsObject:plot] ) { - plot.plotSpace = nil; - plot.graph = nil; - [self.plotAreaFrame.plotGroup removePlot:plot]; - [self.plots removeObject:plot]; - } - else { - [NSException raise:CPTException format:@"Tried to remove CPTPlot which did not exist."]; + if ( plot ) { + CPTPlot *thePlot = plot; + + if ( [self.plots containsObject:thePlot] ) { + thePlot.plotSpace = nil; + thePlot.graph = nil; + [self.plotAreaFrame.plotGroup removePlot:thePlot]; + [self.plots removeObject:thePlot]; + } + else { + [NSException raise:CPTException format:@"Tried to remove CPTPlot which did not exist."]; + } } } @@ -487,7 +550,7 @@ -(void)removePlot:(CPTPlot *)plot * @param plot The plot. * @param idx An index within the bounds of the plot array. **/ --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx +-(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx { [self insertPlot:plot atIndex:idx intoPlotSpace:self.defaultPlotSpace]; } @@ -497,7 +560,7 @@ -(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx * @param idx An index within the bounds of the plot array. * @param space The plot space. **/ --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(CPTPlotSpace *)space +-(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(nullable CPTPlotSpace *)space { if ( plot ) { [self.plots insertObject:plot atIndex:idx]; @@ -510,7 +573,7 @@ -(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx intoPlotSpace:(CPTPlot /** @brief Remove a plot from the graph. * @param identifier The identifier of the plot to remove. **/ --(void)removePlotWithIdentifier:(id)identifier +-(void)removePlotWithIdentifier:(nullable id)identifier { CPTPlot *plotToRemove = [self plotWithIdentifier:identifier]; @@ -525,7 +588,7 @@ -(void)removePlotWithIdentifier:(id)identifier #pragma mark - #pragma mark Retrieving Plot Spaces --(CPTPlotSpace *)defaultPlotSpace +-(nullable CPTPlotSpace *)defaultPlotSpace { return self.plotSpaces.count > 0 ? (self.plotSpaces)[0] : nil; } @@ -533,7 +596,7 @@ -(CPTPlotSpace *)defaultPlotSpace /** @brief All plot spaces associated with the graph. * @return An array of all plot spaces associated with the graph. **/ --(CPTPlotSpaceArray)allPlotSpaces +-(nonnull CPTPlotSpaceArray *)allPlotSpaces { return [NSArray arrayWithArray:self.plotSpaces]; } @@ -542,7 +605,7 @@ -(CPTPlotSpaceArray)allPlotSpaces * @param idx An index within the bounds of the plot space array. * @return The plot space at the given index. **/ --(CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)idx +-(nullable CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)idx { return self.plotSpaces.count > idx ? (self.plotSpaces)[idx] : nil; } @@ -551,10 +614,10 @@ -(CPTPlotSpace *)plotSpaceAtIndex:(NSUInteger)idx * @param identifier A plot space identifier. * @return The plot space with the given identifier or @nil if it was not found. **/ --(CPTPlotSpace *)plotSpaceWithIdentifier:(id)identifier +-(nullable CPTPlotSpace *)plotSpaceWithIdentifier:(nullable id)identifier { for ( CPTPlotSpace *plotSpace in self.plotSpaces ) { - if ( [[plotSpace identifier] isEqual:identifier] ) { + if ( [plotSpace.identifier isEqual:identifier] ) { return plotSpace; } } @@ -566,14 +629,21 @@ -(CPTPlotSpace *)plotSpaceWithIdentifier:(id)identifier /// @cond --(void)setPlotAreaFrame:(CPTPlotAreaFrame *)newArea +-(void)setPlotAreaFrame:(nullable CPTPlotAreaFrame *)newArea { if ( plotAreaFrame != newArea ) { plotAreaFrame.graph = nil; [plotAreaFrame removeFromSuperlayer]; + plotAreaFrame = newArea; - [self addSublayer:newArea]; - plotAreaFrame.graph = self; + + if ( newArea ) { + CPTPlotAreaFrame *theFrame = newArea; + + [self addSublayer:theFrame]; + theFrame.graph = self; + } + for ( CPTPlotSpace *space in self.plotSpaces ) { space.graph = self; } @@ -588,7 +658,7 @@ -(void)setPlotAreaFrame:(CPTPlotAreaFrame *)newArea /** @brief Add a plot space to the graph. * @param space The plot space. **/ --(void)addPlotSpace:(CPTPlotSpace *)space +-(void)addPlotSpace:(nonnull CPTPlotSpace *)space { NSParameterAssert(space); @@ -609,31 +679,35 @@ -(void)addPlotSpace:(CPTPlotSpace *)space /** @brief Remove a plot space from the graph. * @param plotSpace The plot space. **/ --(void)removePlotSpace:(CPTPlotSpace *)plotSpace +-(void)removePlotSpace:(nullable CPTPlotSpace *)plotSpace { - if ( [self.plotSpaces containsObject:plotSpace] ) { - [[NSNotificationCenter defaultCenter] removeObserver:self - name:CPTPlotSpaceCoordinateMappingDidChangeNotification - object:plotSpace]; - - // Remove space - plotSpace.graph = nil; - [self.plotSpaces removeObject:plotSpace]; - - // Update axes that referenced space - for ( CPTAxis *axis in self.axisSet.axes ) { - if ( axis.plotSpace == plotSpace ) { - axis.plotSpace = nil; + if ( plotSpace ) { + CPTPlotSpace *thePlotSpace = plotSpace; + + if ( [self.plotSpaces containsObject:thePlotSpace] ) { + [[NSNotificationCenter defaultCenter] removeObserver:self + name:CPTPlotSpaceCoordinateMappingDidChangeNotification + object:thePlotSpace]; + + // Remove space + thePlotSpace.graph = nil; + [self.plotSpaces removeObject:thePlotSpace]; + + // Update axes that referenced space + for ( CPTAxis *axis in self.axisSet.axes ) { + if ( axis.plotSpace == thePlotSpace ) { + axis.plotSpace = nil; + } } - } - [[NSNotificationCenter defaultCenter] postNotificationName:CPTGraphDidRemovePlotSpaceNotification - object:self - userInfo:@{ CPTGraphPlotSpaceNotificationKey: plotSpace } - ]; - } - else { - [NSException raise:CPTException format:@"Tried to remove CPTPlotSpace which did not exist."]; + [[NSNotificationCenter defaultCenter] postNotificationName:CPTGraphDidRemovePlotSpaceNotification + object:self + userInfo:@{ CPTGraphPlotSpaceNotificationKey: thePlotSpace } + ]; + } + else { + [NSException raise:CPTException format:@"Tried to remove CPTPlotSpace which did not exist."]; + } } } @@ -642,7 +716,7 @@ -(void)removePlotSpace:(CPTPlotSpace *)plotSpace /// @cond --(void)plotSpaceMappingDidChange:(NSNotification *)notif +-(void)plotSpaceMappingDidChange:(nonnull NSNotification *)notif { CPTPlotSpace *plotSpace = notif.object; BOOL backgroundBandsNeedRedraw = NO; @@ -674,12 +748,12 @@ -(void)plotSpaceMappingDidChange:(NSNotification *)notif /// @cond --(CPTAxisSet *)axisSet +-(nullable CPTAxisSet *)axisSet { return self.plotAreaFrame.axisSet; } --(void)setAxisSet:(CPTAxisSet *)newSet +-(void)setAxisSet:(nullable CPTAxisSet *)newSet { self.plotAreaFrame.axisSet = newSet; } @@ -692,7 +766,7 @@ -(void)setAxisSet:(CPTAxisSet *)newSet /** @brief Apply a theme to style the graph. * @param theme The theme object used to style the graph. **/ --(void)applyTheme:(CPTTheme *)theme +-(void)applyTheme:(nullable CPTTheme *)theme { [theme applyThemeToGraph:self]; } @@ -702,7 +776,7 @@ -(void)applyTheme:(CPTTheme *)theme /// @cond --(void)setLegend:(CPTLegend *)newLegend +-(void)setLegend:(nullable CPTLegend *)newLegend { if ( newLegend != legend ) { legend = newLegend; @@ -744,7 +818,7 @@ -(void)setLegendAnchor:(CPTRectAnchor)newLegendAnchor -(void)setLegendDisplacement:(CGPoint)newLegendDisplacement { - if ( !CGPointEqualToPoint(newLegendDisplacement, legendDisplacement) ) { + if ( !CGPointEqualToPoint(newLegendDisplacement, legendDisplacement)) { legendDisplacement = newLegendDisplacement; self.legendAnnotation.displacement = newLegendDisplacement; } @@ -805,7 +879,7 @@ -(CGPoint)contentAnchorForRectAnchor:(CPTRectAnchor)anchor -(void)setPaddingLeft:(CGFloat)newPadding { if ( newPadding != self.paddingLeft ) { - [super setPaddingLeft:newPadding]; + super.paddingLeft = newPadding; [self.axisSet.axes makeObjectsPerformSelector:@selector(setNeedsDisplay)]; } } @@ -813,7 +887,7 @@ -(void)setPaddingLeft:(CGFloat)newPadding -(void)setPaddingRight:(CGFloat)newPadding { if ( newPadding != self.paddingRight ) { - [super setPaddingRight:newPadding]; + super.paddingRight = newPadding; [self.axisSet.axes makeObjectsPerformSelector:@selector(setNeedsDisplay)]; } } @@ -821,7 +895,7 @@ -(void)setPaddingRight:(CGFloat)newPadding -(void)setPaddingTop:(CGFloat)newPadding { if ( newPadding != self.paddingTop ) { - [super setPaddingTop:newPadding]; + super.paddingTop = newPadding; [self.axisSet.axes makeObjectsPerformSelector:@selector(setNeedsDisplay)]; } } @@ -829,22 +903,22 @@ -(void)setPaddingTop:(CGFloat)newPadding -(void)setPaddingBottom:(CGFloat)newPadding { if ( newPadding != self.paddingBottom ) { - [super setPaddingBottom:newPadding]; + super.paddingBottom = newPadding; [self.axisSet.axes makeObjectsPerformSelector:@selector(setNeedsDisplay)]; } } --(CPTNumberArray)topDownLayerOrder +-(nullable CPTNumberArray *)topDownLayerOrder { return self.plotAreaFrame.plotArea.topDownLayerOrder; } --(void)setTopDownLayerOrder:(CPTNumberArray)newArray +-(void)setTopDownLayerOrder:(nullable CPTNumberArray *)newArray { self.plotAreaFrame.plotArea.topDownLayerOrder = newArray; } --(void)setTitle:(NSString *)newTitle +-(void)setTitle:(nullable NSString *)newTitle { if ( newTitle != title ) { title = [newTitle copy]; @@ -858,7 +932,7 @@ -(void)setTitle:(NSString *)newTitle if ( title ) { if ( theTitleAnnotation ) { - ( (CPTTextLayer *)theTitleAnnotation.contentLayer ).text = title; + ((CPTTextLayer *)theTitleAnnotation.contentLayer).text = title; } else { CPTPlotAreaFrame *frameLayer = self.plotAreaFrame; @@ -884,7 +958,7 @@ -(void)setTitle:(NSString *)newTitle } } --(void)setAttributedTitle:(NSAttributedString *)newTitle +-(void)setAttributedTitle:(nullable NSAttributedString *)newTitle { if ( newTitle != attributedTitle ) { attributedTitle = [newTitle copy]; @@ -900,7 +974,7 @@ -(void)setAttributedTitle:(NSAttributedString *)newTitle self.title = [attributedTitle.string copy]; if ( theTitleAnnotation ) { - ( (CPTTextLayer *)theTitleAnnotation.contentLayer ).attributedText = attributedTitle; + ((CPTTextLayer *)theTitleAnnotation.contentLayer).attributedText = attributedTitle; } else { CPTPlotAreaFrame *frameLayer = self.plotAreaFrame; @@ -931,7 +1005,7 @@ -(void)setAttributedTitle:(NSAttributedString *)newTitle } } --(void)setTitleTextStyle:(CPTTextStyle *)newStyle +-(void)setTitleTextStyle:(nullable CPTTextStyle *)newStyle { if ( newStyle != titleTextStyle ) { titleTextStyle = [newStyle copy]; @@ -951,7 +1025,7 @@ -(void)setTitleTextStyle:(CPTTextStyle *)newStyle -(void)setTitleDisplacement:(CGPoint)newDisplace { - if ( !CGPointEqualToPoint(newDisplace, titleDisplacement) ) { + if ( !CGPointEqualToPoint(newDisplace, titleDisplacement)) { titleDisplacement = newDisplace; self.titleAnnotation.displacement = newDisplace; @@ -999,7 +1073,7 @@ -(void)setTitlePlotAreaFrameAnchor:(CPTRectAnchor)newAnchor * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { // Plots for ( CPTPlot *plot in [self.plots reverseObjectEnumerator] ) { @@ -1060,7 +1134,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { BOOL handledEvent = NO; @@ -1091,7 +1165,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio // Plot spaces do not block events, because several spaces may need to receive // the same event sequence (e.g., dragging coordinate translation) for ( CPTPlotSpace *space in self.plotSpaces ) { - if ( !handledEvent || (handledEvent && space.isDragging) ) { + if ( !handledEvent || (handledEvent && space.isDragging)) { BOOL handled = [space pointingDeviceUpEvent:event atPoint:interactionPoint]; handledEvent |= handled; } @@ -1125,7 +1199,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { // Plots for ( CPTPlot *plot in [self.plots reverseObjectEnumerator] ) { @@ -1186,7 +1260,7 @@ -(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)inter * @param event The OS event. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event +-(BOOL)pointingDeviceCancelledEvent:(nonnull CPTNativeEvent *)event { // Plots for ( CPTPlot *plot in [self.plots reverseObjectEnumerator] ) { @@ -1225,7 +1299,7 @@ -(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event } } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else /** @@ -1247,7 +1321,7 @@ -(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event * @param toPoint The ending coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)scrollWheelEvent:(CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint +-(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint { // Plots for ( CPTPlot *plot in [self.plots reverseObjectEnumerator] ) { @@ -1285,6 +1359,7 @@ -(BOOL)scrollWheelEvent:(CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toP return [super scrollWheelEvent:event fromPoint:fromPoint toPoint:toPoint]; } } + #endif /// @} @@ -1298,7 +1373,7 @@ @implementation CPTGraph(AbstractFactoryMethods) /** @brief Creates a new plot space for the graph. * @return A new plot space. **/ --(CPTPlotSpace *)newPlotSpace +-(nullable CPTPlotSpace *)newPlotSpace { return nil; } @@ -1306,7 +1381,7 @@ -(CPTPlotSpace *)newPlotSpace /** @brief Creates a new axis set for the graph. * @return A new axis set. **/ --(CPTAxisSet *)newAxisSet +-(nullable CPTAxisSet *)newAxisSet { return nil; } diff --git a/framework/Source/CPTGridLineGroup.h b/framework/Source/CPTGridLineGroup.h index 5e28da35a..bca74c4cd 100644 --- a/framework/Source/CPTGridLineGroup.h +++ b/framework/Source/CPTGridLineGroup.h @@ -4,7 +4,7 @@ @interface CPTGridLineGroup : CPTLayer -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTPlotArea *plotArea; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTPlotArea *plotArea; @property (nonatomic, readwrite) BOOL major; @end diff --git a/framework/Source/CPTGridLineGroup.m b/framework/Source/CPTGridLineGroup.m index cc5f18c04..d68f67fc4 100644 --- a/framework/Source/CPTGridLineGroup.m +++ b/framework/Source/CPTGridLineGroup.m @@ -12,7 +12,7 @@ **/ @implementation CPTGridLineGroup -/** @property cpt_weak CPTPlotArea *plotArea +/** @property nullable CPTPlotArea *plotArea * @brief The plot area that this grid line group belongs to. **/ @synthesize plotArea; @@ -38,9 +38,9 @@ @implementation CPTGridLineGroup * @param newFrame The frame rectangle. * @return The initialized CPTGridLineGroup object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plotArea = nil; major = NO; @@ -53,9 +53,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTGridLineGroup *theLayer = (CPTGridLineGroup *)layer; plotArea = theLayer->plotArea; @@ -71,7 +71,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -79,23 +79,36 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeBool:self.major forKey:@"CPTGridLineGroup.major"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - plotArea = [coder decodeObjectForKey:@"CPTGridLineGroup.plotArea"]; - major = [coder decodeBoolForKey:@"CPTGridLineGroup.major"]; + if ((self = [super initWithCoder:coder])) { + plotArea = [coder decodeObjectOfClass:[CPTPlotArea class] + forKey:@"CPTGridLineGroup.plotArea"]; + major = [coder decodeBoolForKey:@"CPTGridLineGroup.major"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -116,7 +129,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context /// @cond --(void)setPlotArea:(CPTPlotArea *)newPlotArea +-(void)setPlotArea:(nullable CPTPlotArea *)newPlotArea { if ( newPlotArea != plotArea ) { plotArea = newPlotArea; diff --git a/framework/Source/CPTGridLines.h b/framework/Source/CPTGridLines.h index 80650a0b5..f5ee267a7 100644 --- a/framework/Source/CPTGridLines.h +++ b/framework/Source/CPTGridLines.h @@ -4,7 +4,7 @@ @interface CPTGridLines : CPTLayer -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTAxis *axis; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTAxis *axis; @property (nonatomic, readwrite) BOOL major; @end diff --git a/framework/Source/CPTGridLines.m b/framework/Source/CPTGridLines.m index f96777129..6c0992e6b 100644 --- a/framework/Source/CPTGridLines.m +++ b/framework/Source/CPTGridLines.m @@ -7,7 +7,7 @@ **/ @implementation CPTGridLines -/** @property cpt_weak CPTAxis *axis +/** @property nullable CPTAxis *axis * @brief The axis. **/ @synthesize axis; @@ -33,9 +33,9 @@ @implementation CPTGridLines * @param newFrame The frame rectangle. * @return The initialized CPTGridLines object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { axis = nil; major = NO; @@ -48,9 +48,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTGridLines *theLayer = (CPTGridLines *)layer; axis = theLayer->axis; @@ -66,7 +66,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -74,10 +74,11 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeBool:self.major forKey:@"CPTGridLines.major"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - axis = [coder decodeObjectForKey:@"CPTGridLines.axis"]; + if ((self = [super initWithCoder:coder])) { + axis = [coder decodeObjectOfClass:[CPTAxis class] + forKey:@"CPTGridLines.axis"]; major = [coder decodeBoolForKey:@"CPTGridLines.major"]; } return self; @@ -85,12 +86,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -107,7 +120,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context /// @cond --(void)setAxis:(CPTAxis *)newAxis +-(void)setAxis:(nullable CPTAxis *)newAxis { if ( newAxis != axis ) { axis = newAxis; diff --git a/framework/Source/CPTImage.h b/framework/Source/CPTImage.h index 23e509fef..2708be9a5 100644 --- a/framework/Source/CPTImage.h +++ b/framework/Source/CPTImage.h @@ -1,7 +1,7 @@ #import "CPTDefinitions.h" #import "CPTPlatformSpecificDefines.h" -@interface CPTImage : NSObject +@interface CPTImage : NSObject @property (nonatomic, readwrite, copy, nullable) CPTNativeImage *nativeImage; @property (nonatomic, readwrite, assign, nullable) CGImageRef image; @@ -27,7 +27,7 @@ -(nonnull instancetype)initWithContentsOfFile:(nonnull NSString *)path; -(nonnull instancetype)initWithCGImage:(nullable CGImageRef)anImage scale:(CGFloat)newScale NS_DESIGNATED_INITIALIZER; -(nonnull instancetype)initWithCGImage:(nullable CGImageRef)anImage; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} /// @name Drawing diff --git a/framework/Source/CPTImage.m b/framework/Source/CPTImage.m index c955dc999..baebbc284 100644 --- a/framework/Source/CPTImage.m +++ b/framework/Source/CPTImage.m @@ -1,5 +1,6 @@ #import "CPTImage.h" +#import "CPTPlatformSpecificDefines.h" #import "CPTUtilities.h" #import "NSCoderExtensions.h" @@ -18,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; @@ -28,7 +29,7 @@ @interface CPTImage() @property (nonatomic, readwrite, assign) CPTImageSlices slices; -(void)makeImageSlices; --(void)drawImage:(CGImageRef)theImage inContext:(CGContextRef)context rect:(CGRect)rect scaleRatio:(CGFloat)scaleRatio; +-(void)drawImage:(nonnull CGImageRef)theImage inContext:(nonnull CGContextRef)context rect:(CGRect)rect scaleRatio:(CGFloat)scaleRatio; @end @@ -47,12 +48,12 @@ -(void)drawImage:(CGImageRef)theImage inContext:(CGContextRef)context rect:(CGRe @implementation CPTImage -/** @property CPTNativeImage *nativeImage +/** @property nullable CPTNativeImage *nativeImage * @brief A platform-native representation of the image. **/ @synthesize nativeImage; -/** @property CGImageRef image +/** @property nullable CGImageRef image * @brief The image drawn into a @ref CGImageRef. **/ @synthesize image; @@ -118,7 +119,7 @@ @implementation CPTImage * @param path The full or partial path to the image file. * @return A CPTImage instance initialized from the file at the given path. **/ --(instancetype)initWithContentsOfFile:(NSString *)path +-(nonnull instancetype)initWithContentsOfFile:(nonnull NSString *)path { return [self initWithNativeImage:[[CPTNativeImage alloc] initWithContentsOfFile:path]]; } @@ -131,11 +132,11 @@ -(instancetype)initWithContentsOfFile:(NSString *)path * @param newScale The image scale. Must be greater than zero. * @return A CPTImage instance initialized with the provided @ref CGImageRef. **/ --(instancetype)initWithCGImage:(CGImageRef)anImage scale:(CGFloat)newScale +-(nonnull instancetype)initWithCGImage:(nullable CGImageRef)anImage scale:(CGFloat)newScale { - NSParameterAssert(newScale > 0.0); + NSParameterAssert(newScale > CPTFloat(0.0)); - if ( (self = [super init]) ) { + if ((self = [super init])) { CGImageRetain(anImage); nativeImage = nil; image = anImage; @@ -152,7 +153,7 @@ -(instancetype)initWithCGImage:(CGImageRef)anImage scale:(CGFloat)newScale * @param anImage The image to wrap. * @return A CPTImage instance initialized with the provided @ref CGImageRef. **/ --(instancetype)initWithCGImage:(CGImageRef)anImage +-(nonnull instancetype)initWithCGImage:(nullable CGImageRef)anImage { return [self initWithCGImage:anImage scale:CPTFloat(1.0)]; } @@ -163,7 +164,7 @@ -(instancetype)initWithCGImage:(CGImageRef)anImage /** @brief Initializes a newly allocated CPTImage object with a @NULL image. * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { return [self initWithCGImage:NULL]; } @@ -188,7 +189,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeObject:self.nativeImage forKey:@"CPTImage.nativeImage"]; [coder encodeCGImage:self.image forKey:@"CPTImage.image"]; @@ -212,10 +213,11 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - nativeImage = [[coder decodeObjectForKey:@"CPTImage.nativeImage"] copy]; + if ((self = [super init])) { + nativeImage = [[coder decodeObjectOfClass:[CPTNativeImage class] + forKey:@"CPTImage.nativeImage"] copy]; image = [coder newCGImageDecodeForKey:@"CPTImage.image"]; scale = [coder decodeCGFloatForKey:@"CPTImage.scale"]; tiled = [coder decodeBoolForKey:@"CPTImage.tiled"]; @@ -230,12 +232,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark NSCopying Methods /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTImage *copy = [[[self class] allocWithZone:zone] init]; @@ -268,7 +282,7 @@ -(id)copyWithZone:(NSZone *)zone * @param name The name of the image to load. * @return A new CPTImage instance initialized with the named image. **/ -+(instancetype)imageNamed:(NSString *)name ++(nonnull instancetype)imageNamed:(nonnull NSString *)name { return [self imageWithNativeImage:[CPTNativeImage imageNamed:name]]; } @@ -278,7 +292,7 @@ +(instancetype)imageNamed:(NSString *)name * @param anImage The platform-native image. * @return A new CPTImage instance initialized with the provided image. **/ -+(instancetype)imageWithNativeImage:(CPTNativeImage *)anImage ++(nonnull instancetype)imageWithNativeImage:(nullable CPTNativeImage *)anImage { return [[self alloc] initWithNativeImage:anImage]; } @@ -288,7 +302,7 @@ +(instancetype)imageWithNativeImage:(CPTNativeImage *)anImage * @param path The full or partial path to the image file. * @return A new CPTImage instance initialized from the file at the given path. **/ -+(instancetype)imageWithContentsOfFile:(NSString *)path ++(nonnull instancetype)imageWithContentsOfFile:(nonnull NSString *)path { return [[self alloc] initWithContentsOfFile:path]; } @@ -298,7 +312,7 @@ +(instancetype)imageWithContentsOfFile:(NSString *)path * @param newScale The image scale. * @return A new CPTImage instance initialized with the provided @ref CGImageRef. **/ -+(instancetype)imageWithCGImage:(CGImageRef)anImage scale:(CGFloat)newScale ++(nonnull instancetype)imageWithCGImage:(nullable CGImageRef)anImage scale:(CGFloat)newScale { return [[self alloc] initWithCGImage:anImage scale:newScale]; } @@ -307,7 +321,7 @@ +(instancetype)imageWithCGImage:(CGImageRef)anImage scale:(CGFloat)newScale * @param anImage The image to wrap. * @return A new CPTImage instance initialized with the provided @ref CGImageRef. **/ -+(instancetype)imageWithCGImage:(CGImageRef)anImage ++(nonnull instancetype)imageWithCGImage:(nullable CGImageRef)anImage { return [self imageWithCGImage:anImage scale:CPTFloat(1.0)]; } @@ -321,7 +335,7 @@ +(instancetype)imageWithCGImage:(CGImageRef)anImage * @param path The file system path of the file. * @return A new CPTImage instance initialized with the contents of the PNG file. **/ -+(instancetype)imageForPNGFile:(NSString *)path ++(nonnull instancetype)imageForPNGFile:(nonnull NSString *)path { return [[self alloc] initForPNGFile:path]; } @@ -337,7 +351,7 @@ +(instancetype)imageForPNGFile:(NSString *)path * @param object The object to be compared with the receiver. * @return @YES if @par{object} is equal to the receiver, @NO otherwise. **/ --(BOOL)isEqual:(id)object +-(BOOL)isEqual:(nullable id)object { if ( self == object ) { return YES; @@ -357,35 +371,35 @@ -(BOOL)isEqual:(id)object CGColorSpaceRef otherColorSpace = CGImageGetColorSpace(otherCGImage); if ( equalImages ) { - equalImages = ( CGImageGetWidth(selfCGImage) == CGImageGetWidth(otherCGImage) ); + equalImages = (CGImageGetWidth(selfCGImage) == CGImageGetWidth(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetHeight(selfCGImage) == CGImageGetHeight(otherCGImage) ); + equalImages = (CGImageGetHeight(selfCGImage) == CGImageGetHeight(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetBitsPerComponent(selfCGImage) == CGImageGetBitsPerComponent(otherCGImage) ); + equalImages = (CGImageGetBitsPerComponent(selfCGImage) == CGImageGetBitsPerComponent(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetBitsPerPixel(selfCGImage) == CGImageGetBitsPerPixel(otherCGImage) ); + equalImages = (CGImageGetBitsPerPixel(selfCGImage) == CGImageGetBitsPerPixel(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetBytesPerRow(selfCGImage) == CGImageGetBytesPerRow(otherCGImage) ); + equalImages = (CGImageGetBytesPerRow(selfCGImage) == CGImageGetBytesPerRow(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetBitmapInfo(selfCGImage) == CGImageGetBitmapInfo(otherCGImage) ); + equalImages = (CGImageGetBitmapInfo(selfCGImage) == CGImageGetBitmapInfo(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetShouldInterpolate(selfCGImage) == CGImageGetShouldInterpolate(otherCGImage) ); + equalImages = (CGImageGetShouldInterpolate(selfCGImage) == CGImageGetShouldInterpolate(otherCGImage)); } if ( equalImages ) { - equalImages = ( CGImageGetRenderingIntent(selfCGImage) == CGImageGetRenderingIntent(otherCGImage) ); + equalImages = (CGImageGetRenderingIntent(selfCGImage) == CGImageGetRenderingIntent(otherCGImage)); } // decode array @@ -409,15 +423,15 @@ -(BOOL)isEqual:(id)object equalImages = NO; } } - else if ( (selfDecodeArray && !otherDecodeArray) || (!selfDecodeArray && otherDecodeArray) ) { + else if ((selfDecodeArray && !otherDecodeArray) || (!selfDecodeArray && otherDecodeArray)) { equalImages = NO; } } // color space if ( equalImages ) { - equalImages = ( CGColorSpaceGetModel(selfColorSpace) == CGColorSpaceGetModel(otherColorSpace) ) && - ( CGColorSpaceGetNumberOfComponents(selfColorSpace) == CGColorSpaceGetNumberOfComponents(otherColorSpace) ); + equalImages = (CGColorSpaceGetModel(selfColorSpace) == CGColorSpaceGetModel(otherColorSpace)) && + (CGColorSpaceGetNumberOfComponents(selfColorSpace) == CGColorSpaceGetNumberOfComponents(otherColorSpace)); } // data provider @@ -428,7 +442,7 @@ -(BOOL)isEqual:(id)object CFDataRef otherProviderData = CGDataProviderCopyData(otherProvider); if ( selfProviderData && otherProviderData ) { - equalImages = [(__bridge NSData *)selfProviderData isEqualToData : (__bridge NSData *)otherProviderData]; + equalImages = [(__bridge NSData *) selfProviderData isEqualToData:(__bridge NSData *)otherProviderData]; } else { equalImages = (selfProviderData == otherProviderData); @@ -458,13 +472,13 @@ -(NSUInteger)hash // Equal objects must hash the same. CGImageRef selfCGImage = self.image; - return ( CGImageGetWidth(selfCGImage) * CGImageGetHeight(selfCGImage) ) + + return (CGImageGetWidth(selfCGImage) * CGImageGetHeight(selfCGImage)) + CGImageGetBitsPerComponent(selfCGImage) + CGImageGetBitsPerPixel(selfCGImage) + CGImageGetBytesPerRow(selfCGImage) + CGImageGetBitmapInfo(selfCGImage) + CGImageGetShouldInterpolate(selfCGImage) + - CGImageGetRenderingIntent(selfCGImage) * (NSUInteger)self.scale; + (NSUInteger)(CGImageGetRenderingIntent(selfCGImage) * self.scale); } /// @endcond @@ -486,7 +500,7 @@ -(BOOL)isOpaque /// @cond --(void)setImage:(CGImageRef)newImage +-(void)setImage:(nullable CGImageRef)newImage { if ( newImage != image ) { CGImageRetain(newImage); @@ -495,7 +509,7 @@ -(void)setImage:(CGImageRef)newImage } } --(void)setNativeImage:(CPTNativeImage *)newImage +-(void)setNativeImage:(nullable CPTNativeImage *)newImage { if ( newImage != nativeImage ) { nativeImage = [newImage copy]; @@ -504,15 +518,15 @@ -(void)setNativeImage:(CPTNativeImage *)newImage } } --(CPTNativeImage *)nativeImage +-(nullable CPTNativeImage *)nativeImage { if ( !nativeImage ) { CGImageRef imageRef = self.image; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGFloat theScale = self.scale; - if ( imageRef && ( theScale > CPTFloat(0.0) ) ) { + if ( imageRef && (theScale > CPTFloat(0.0))) { nativeImage = [UIImage imageWithCGImage:imageRef scale:theScale orientation:UIImageOrientationUp]; @@ -522,7 +536,7 @@ -(CPTNativeImage *)nativeImage nativeImage = [[NSImage alloc] initWithCGImage:imageRef size:NSZeroSize]; } else { - CGSize imageSize = CGSizeMake( CGImageGetWidth(imageRef), CGImageGetHeight(imageRef) ); + CGSize imageSize = CGSizeMake(CGImageGetWidth(imageRef), CGImageGetHeight(imageRef)); NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:NULL pixelsWide:(NSInteger)imageSize.width @@ -536,7 +550,7 @@ -(CPTNativeImage *)nativeImage bitsPerPixel:32]; NSGraphicsContext *bitmapContext = [NSGraphicsContext graphicsContextWithBitmapImageRep:imageRep]; - CGContextRef context = (CGContextRef)[bitmapContext graphicsPort]; + CGContextRef context = (CGContextRef)bitmapContext.graphicsPort; CGContextDrawImage(context, CPTRectMake(0.0, 0.0, imageSize.width, imageSize.height), imageRef); @@ -551,7 +565,7 @@ -(CPTNativeImage *)nativeImage -(void)setScale:(CGFloat)newScale { - NSParameterAssert(newScale > 0.0); + NSParameterAssert(newScale > CPTFloat(0.0)); if ( newScale != scale ) { scale = newScale; @@ -560,10 +574,10 @@ -(void)setScale:(CGFloat)newScale -(void)setEdgeInsets:(CPTEdgeInsets)newEdgeInsets { - if ( !CPTEdgeInsetsEqualToEdgeInsets(edgeInsets, newEdgeInsets) ) { + if ( !CPTEdgeInsetsEqualToEdgeInsets(edgeInsets, newEdgeInsets)) { edgeInsets = newEdgeInsets; - CPTImageSlices imageSlices; + CPTImageSlices imageSlices = {}; for ( NSUInteger i = 0; i < 9; i++ ) { imageSlices.slice[i] = NULL; @@ -578,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; + } } } @@ -607,54 +624,63 @@ -(void)makeImageSlices CGSize centerSize = CGSizeMake(width - capLeft - capRight, height - capTop - capBottom); - CPTImageSlices imageSlices; + CPTImageSlices imageSlices = {}; for ( NSUInteger i = 0; i < 9; i++ ) { imageSlices.slice[i] = NULL; } // top row - if ( capTop > CPTFloat(0.0) ) { - if ( capLeft > CPTFloat(0.0) ) { - imageSlices.slice[CPTSliceTopLeft] = CGImageCreateWithImageInRect( theImage, CPTRectMake(0.0, 0.0, capLeft, capTop) ); + if ( capTop > CPTFloat(0.0)) { + if ( capLeft > CPTFloat(0.0)) { + 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) ); + if ( centerSize.width > CPTFloat(0.0)) { + 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) ); + if ( capRight > CPTFloat(0.0)) { + 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) ); + if ( centerSize.height > CPTFloat(0.0)) { + if ( capLeft > CPTFloat(0.0)) { + 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) ); + if ( centerSize.width > CPTFloat(0.0)) { + 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) ); + if ( capRight > CPTFloat(0.0)) { + 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) ); + if ( capBottom > CPTFloat(0.0)) { + if ( capLeft > CPTFloat(0.0)) { + 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) ); + if ( centerSize.width > CPTFloat(0.0)) { + 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) ); + if ( capRight > CPTFloat(0.0)) { + CGImageRef sliceImage = CGImageCreateWithImageInRect(theImage, CPTRectMake(width - capRight, height - capBottom, capRight, capBottom)); + imageSlices.slice[CPTSliceBottomRight] = sliceImage; } } @@ -664,9 +690,9 @@ -(void)makeImageSlices } } --(void)drawImage:(CGImageRef)theImage inContext:(CGContextRef)context rect:(CGRect)rect scaleRatio:(CGFloat)scaleRatio +-(void)drawImage:(nonnull CGImageRef)theImage inContext:(nonnull CGContextRef)context rect:(CGRect)rect scaleRatio:(CGFloat)scaleRatio { - if ( theImage && ( rect.size.width > CPTFloat(0.0) ) && ( rect.size.height > CPTFloat(0.0) ) ) { + if ( theImage && (rect.size.width > CPTFloat(0.0)) && (rect.size.height > CPTFloat(0.0))) { CGFloat imageScale = self.scale; CGContextSaveGState(context); @@ -701,7 +727,7 @@ -(void)drawImage:(CGImageRef)theImage inContext:(CGContextRef)context rect:(CGRe * @param rect The rectangle to draw into. * @param context The graphics context to draw into. **/ --(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context { CGImageRef theImage = self.image; @@ -709,26 +735,23 @@ -(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context CGFloat lastScale = self.lastDrawnScale; CGFloat contextScale = CPTFloat(1.0); - if ( rect.size.height != CPTFloat(0.0) ) { + if ( rect.size.height != CPTFloat(0.0)) { CGRect deviceRect = CGContextConvertRectToDeviceSpace(context, rect); contextScale = deviceRect.size.height / rect.size.height; } // generate a Core Graphics image if needed - if ( !theImage || (contextScale != lastScale) ) { + if ( !theImage || (contextScale != lastScale)) { CPTNativeImage *theNativeImage = self.nativeImage; if ( theNativeImage ) { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE theImage = theNativeImage.CGImage; self.scale = theNativeImage.scale; #else - NSSize imageSize = theNativeImage.size; - CGFloat sizeScale = CPTFloat(theNativeImage.representations.count + 1) - contextScale; - imageSize.width /= sizeScale; - imageSize.height /= sizeScale; - + NSSize imageSize = theNativeImage.size; NSRect drawingRect = NSMakeRect(0.0, 0.0, imageSize.width, imageSize.height); + theImage = [theNativeImage CGImageForProposedRect:&drawingRect context:[NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO] hints:nil]; @@ -738,13 +761,17 @@ -(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context } } + if ( !theImage ) { + return; + } + // draw the image CGFloat imageScale = self.scale; CGFloat scaleRatio = contextScale / imageScale; CPTEdgeInsets insets = self.edgeInsets; - if ( CPTEdgeInsetsEqualToEdgeInsets(insets, CPTEdgeInsetsZero) ) { + if ( CPTEdgeInsetsEqualToEdgeInsets(insets, CPTEdgeInsetsZero)) { [self drawImage:theImage inContext:context rect:rect scaleRatio:scaleRatio]; } else { @@ -759,7 +786,7 @@ -(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context } // create new slices if needed - if ( !hasSlices || (contextScale != lastScale) ) { + if ( !hasSlices || (contextScale != lastScale)) { [self makeImageSlices]; imageSlices = self.slices; } @@ -823,7 +850,7 @@ -(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { return self.nativeImage; } diff --git a/framework/Source/CPTImageTests.m b/framework/Source/CPTImageTests.m index d17af8461..b106c54f2 100644 --- a/framework/Source/CPTImageTests.m +++ b/framework/Source/CPTImageTests.m @@ -14,7 +14,7 @@ -(void)testKeyedArchivingRoundTrip size_t bytesPerRow = (4 * width + 15) & ~15ul; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); #else CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); @@ -30,7 +30,7 @@ -(void)testKeyedArchivingRoundTrip CGColorSpaceRelease(colorSpace); CGImageRelease(cgImage); - CPTImage *newImage = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:image]]; + CPTImage *newImage = [self archiveRoundTrip:image]; XCTAssertEqualObjects(image, newImage, @"Images not equal"); } diff --git a/framework/Source/CPTLayer.h b/framework/Source/CPTLayer.h index 434d7f2e2..4cca2d8b4 100644 --- a/framework/Source/CPTLayer.h +++ b/framework/Source/CPTLayer.h @@ -5,43 +5,86 @@ /// @file @class CPTGraph; +@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); /// @} +/** + * @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. **/ -typedef NSArray *CPTSublayerArray; +typedef NSArray CPTSublayerArray; /** * @brief A mutable array of CALayer objects. **/ -typedef NSMutableArray *CPTMutableSublayerArray; +typedef NSMutableArray CPTMutableSublayerArray; /** * @brief A set of CALayer objects. **/ -typedef NSSet *CPTSublayerSet; +typedef NSSet CPTSublayerSet; /** * @brief A mutable set of CALayer objects. **/ -typedef NSMutableSet *CPTMutableSublayerSet; +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 +@interface CPTLayer : CALayer /// @name Graph /// @{ -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTGraph *graph; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTGraph *graph; /// @} /// @name Padding @@ -76,18 +119,19 @@ typedef NSMutableSet *CPTMutableSublayerSet; /// @name Layout /// @{ -@property (nonatomic, readonly, nullable) CPTSublayerSet sublayersExcludedFromAutomaticLayout; +@property (nonatomic, readonly, nullable) CPTSublayerSet *sublayersExcludedFromAutomaticLayout; /// @} /// @name Initialization /// @{ -(nonnull instancetype)initWithFrame:(CGRect)newFrame NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; -(nonnull instancetype)initWithLayer:(nonnull id)layer NS_DESIGNATED_INITIALIZER; /// @} /// @name Drawing /// @{ +-(void)setNeedsDisplayAllLayers; -(void)renderAsVectorInContext:(nonnull CGContextRef)context; -(void)recursivelyRenderInContext:(nonnull CGContextRef)context; -(void)layoutAndRenderInContext:(nonnull CGContextRef)context; diff --git a/framework/Source/CPTLayer.m b/framework/Source/CPTLayer.m index 56a67032e..eef476e9a 100644 --- a/framework/Source/CPTLayer.m +++ b/framework/Source/CPTLayer.m @@ -6,17 +6,16 @@ #import "CPTPlatformSpecificFunctions.h" #import "CPTShadow.h" #import "CPTUtilities.h" -#import "CorePlotProbes.h" #import "NSCoderExtensions.h" #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. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif **/ @@ -51,7 +50,7 @@ -(nonnull NSString *)subLayersAtIndex:(NSUInteger)idx; **/ @implementation CPTLayer -/** @property cpt_weak CPTGraph *graph +/** @property nullable CPTGraph *graph * @brief The graph for the layer. **/ @synthesize graph; @@ -96,17 +95,17 @@ @implementation CPTLayer **/ @dynamic shadowMargin; -/** @property CGPathRef outerBorderPath +/** @property nullable CGPathRef outerBorderPath * @brief A drawing path that encompasses the outer boundary of the layer border. **/ @synthesize outerBorderPath; -/** @property CGPathRef innerBorderPath +/** @property nullable CGPathRef innerBorderPath * @brief A drawing path that encompasses the inner boundary of the layer border. **/ @synthesize innerBorderPath; -/** @property CGPathRef maskingPath +/** @property nullable CGPathRef maskingPath * @brief A drawing path that encompasses the layer content including any borders. Set to @NULL when no masking is desired. * * This path defines the outline of the layer and is used to mask all drawing. Set to @NULL when no masking is desired. @@ -114,7 +113,7 @@ @implementation CPTLayer **/ @dynamic maskingPath; -/** @property CGPathRef sublayerMaskingPath +/** @property nullable CGPathRef sublayerMaskingPath * @brief A drawing path that encompasses the layer content excluding any borders. Set to @NULL when no masking is desired. * * This path defines the outline of the part of the layer where sublayers should draw and is used to mask all sublayer drawing. @@ -123,7 +122,7 @@ @implementation CPTLayer **/ @dynamic sublayerMaskingPath; -/** @property CPTSublayerSet sublayersExcludedFromAutomaticLayout +/** @property nullable CPTSublayerSet *sublayersExcludedFromAutomaticLayout * @brief A set of sublayers that should be excluded from the automatic sublayer layout. **/ @dynamic sublayersExcludedFromAutomaticLayout; @@ -133,7 +132,7 @@ @implementation CPTLayer **/ @synthesize useFastRendering; -/** @property id identifier +/** @property nullable id identifier * @brief An object used to identify the layer in collections. **/ @synthesize identifier; @@ -165,9 +164,9 @@ @implementation CPTLayer * @param newFrame The frame rectangle. * @return The initialized object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super init]) ) { + if ((self = [super init])) { paddingLeft = CPTFloat(0.0); paddingTop = CPTFloat(0.0); paddingRight = CPTFloat(0.0); @@ -195,7 +194,7 @@ -(instancetype)initWithFrame:(CGRect)newFrame /** @brief Initializes a newly allocated CPTLayer object with an empty frame rectangle. * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { return [self initWithFrame:CGRectZero]; } @@ -206,9 +205,9 @@ -(instancetype)init * @param layer The layer from which custom fields should be copied. * @return A layer instance with any custom instance variables copied from @par{layer}. */ --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTLayer *theLayer = (CPTLayer *)layer; paddingLeft = theLayer->paddingLeft; @@ -242,7 +241,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -267,17 +266,20 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { paddingLeft = [coder decodeCGFloatForKey:@"CPTLayer.paddingLeft"]; paddingTop = [coder decodeCGFloatForKey:@"CPTLayer.paddingTop"]; paddingRight = [coder decodeCGFloatForKey:@"CPTLayer.paddingRight"]; paddingBottom = [coder decodeCGFloatForKey:@"CPTLayer.paddingBottom"]; masksToBorder = [coder decodeBoolForKey:@"CPTLayer.masksToBorder"]; - shadow = [[coder decodeObjectForKey:@"CPTLayer.shadow"] copy]; - graph = [coder decodeObjectForKey:@"CPTLayer.graph"]; - identifier = [[coder decodeObjectForKey:@"CPTLayer.identifier"] copy]; + shadow = [[coder decodeObjectOfClass:[CPTShadow class] + forKey:@"CPTLayer.shadow"] copy]; + graph = [coder decodeObjectOfClass:[CPTGraph class] + forKey:@"CPTLayer.graph"]; + identifier = [[coder decodeObjectOfClass:[NSObject class] + forKey:@"CPTLayer.identifier"] copy]; renderingRecursively = NO; outerBorderPath = NULL; @@ -286,12 +288,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Animation /// @cond --(id)actionForKey:(NSString *)aKey +-(id)actionForKey:(nonnull NSString *__unused)aKey { return nil; } @@ -309,11 +323,46 @@ -(void)display return; } else { - [super display]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" +#if TARGET_OS_OSX + // Workaround since @available macro is not there + + if ( [NSView instancesRespondToSelector:@selector(effectiveAppearance)] ) { + NSAppearance *oldAppearance = NSAppearance.currentAppearance; + NSAppearance.currentAppearance = ((NSView *)self.graph.hostingView).effectiveAppearance; + [super display]; + NSAppearance.currentAppearance = oldAppearance; + } + else { + [super display]; + } +#else + if ( @available(iOS 13, *)) { + if ( [UITraitCollection instancesRespondToSelector:@selector(performAsCurrentTraitCollection:)] ) { + UITraitCollection *traitCollection = ((UIView *)self.graph.hostingView).traitCollection; + if ( traitCollection ) { + [traitCollection performAsCurrentTraitCollection: ^{ + [super display]; + }]; + } + else { + [super display]; + } + } + else { + [super display]; + } + } + else { + [super display]; + } +#endif +#pragma clang diagnostic pop } } --(void)drawInContext:(CGContextRef)context +-(void)drawInContext:(nonnull CGContextRef)context { if ( context ) { self.useFastRendering = YES; @@ -327,6 +376,23 @@ -(void)drawInContext:(CGContextRef)context /// @endcond +/** + * @brief Recursively marks this layer and all sublayers as needing to be redrawn. + **/ +-(void)setNeedsDisplayAllLayers +{ + [self setNeedsDisplay]; + + for ( CPTLayer *subLayer in self.sublayers ) { + if ( [subLayer respondsToSelector:@selector(setNeedsDisplayAllLayers)] ) { + [subLayer setNeedsDisplayAllLayers]; + } + else { + [subLayer setNeedsDisplay]; + } + } +} + /** @brief Draws layer content into the provided graphics context. * * This method replaces the CALayer @link CALayer::drawInContext: -drawInContext: @endlink method @@ -336,7 +402,7 @@ -(void)drawInContext:(CGContextRef)context * * @param context The graphics context to draw into. **/ --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { // This is where subclasses do their drawing if ( self.renderingRecursively ) { @@ -348,7 +414,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context /** @brief Draws layer content and the content of all sublayers into the provided graphics context. * @param context The graphics context to draw into. **/ --(void)recursivelyRenderInContext:(CGContextRef)context +-(void)recursivelyRenderInContext:(nonnull CGContextRef)context { if ( !self.hidden ) { // render self @@ -367,7 +433,7 @@ -(void)recursivelyRenderInContext:(CGContextRef)context self.renderingRecursively = NO; // render sublayers - CPTSublayerArray sublayersCopy = [self.sublayers copy]; + CPTSublayerArray *sublayersCopy = [self.sublayers copy]; for ( CALayer *currentSublayer in sublayersCopy ) { CGContextSaveGState(context); @@ -379,7 +445,7 @@ -(void)recursivelyRenderInContext:(CGContextRef)context currentSublayerFrameOrigin.y - currentSublayerBounds.origin.y); [self applyTransform:self.sublayerTransform toContext:context]; if ( [currentSublayer isKindOfClass:[CPTLayer class]] ) { - [(CPTLayer *)currentSublayer recursivelyRenderInContext : context]; + [(CPTLayer *) currentSublayer recursivelyRenderInContext:context]; } else { if ( self.masksToBounds ) { @@ -396,17 +462,17 @@ -(void)recursivelyRenderInContext:(CGContextRef)context /// @cond --(void)applyTransform:(CATransform3D)transform3D toContext:(CGContextRef)context +-(void)applyTransform:(CATransform3D)transform3D toContext:(nonnull CGContextRef)context { - if ( !CATransform3DIsIdentity(transform3D) ) { - if ( CATransform3DIsAffine(transform3D) ) { + if ( !CATransform3DIsIdentity(transform3D)) { + if ( CATransform3DIsAffine(transform3D)) { CGRect selfBounds = self.bounds; CGPoint anchorPoint = self.anchorPoint; CGPoint anchorOffset = CPTPointMake(anchorOffset.x = selfBounds.origin.x + anchorPoint.x * selfBounds.size.width, anchorOffset.y = selfBounds.origin.y + anchorPoint.y * selfBounds.size.height); CGAffineTransform affineTransform = CGAffineTransformMakeTranslation(-anchorOffset.x, -anchorOffset.y); - affineTransform = CGAffineTransformConcat( affineTransform, CATransform3DGetAffineTransform(transform3D) ); + affineTransform = CGAffineTransformConcat(affineTransform, CATransform3DGetAffineTransform(transform3D)); affineTransform = CGAffineTransformTranslate(affineTransform, anchorOffset.x, anchorOffset.y); CGRect transformedBounds = CGRectApplyAffineTransform(selfBounds, affineTransform); @@ -422,7 +488,7 @@ -(void)applyTransform:(CATransform3D)transform3D toContext:(CGContextRef)context /** @brief Updates the layer layout if needed and then draws layer content and the content of all sublayers into the provided graphics context. * @param context The graphics context to draw into. */ --(void)layoutAndRenderInContext:(CGContextRef)context +-(void)layoutAndRenderInContext:(nonnull CGContextRef)context { [self layoutIfNeeded]; [self recursivelyRenderInContext:context]; @@ -431,10 +497,10 @@ -(void)layoutAndRenderInContext:(CGContextRef)context /** @brief Draws layer content and the content of all sublayers into a PDF document. * @return PDF representation of the layer content. **/ --(NSData *)dataForPDFRepresentationOfLayer +-(nonnull NSData *)dataForPDFRepresentationOfLayer { NSMutableData *pdfData = [[NSMutableData alloc] init]; - CGDataConsumerRef dataConsumer = CGDataConsumerCreateWithCFData( (__bridge CFMutableDataRef)pdfData ); + CGDataConsumerRef dataConsumer = CGDataConsumerCreateWithCFData((__bridge CFMutableDataRef)pdfData); const CGRect mediaBox = CPTRectMake(0.0, 0.0, self.bounds.size.width, self.bounds.size.height); CGContextRef pdfContext = CGPDFContextCreate(dataConsumer, &mediaBox, NULL); @@ -460,32 +526,33 @@ -(NSData *)dataForPDFRepresentationOfLayer /// @name User Interaction /// @{ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)interactionPoint { return NO; } --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)interactionPoint { return NO; } --(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *__unused)event atPoint:(CGPoint __unused)interactionPoint { return NO; } --(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event +-(BOOL)pointingDeviceCancelledEvent:(nonnull CPTNativeEvent *__unused)event { return NO; } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else --(BOOL)scrollWheelEvent:(CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint +-(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *__unused)event fromPoint:(CGPoint __unused)fromPoint toPoint:(CGPoint __unused)toPoint { return NO; } + #endif /// @} @@ -506,38 +573,38 @@ -(void)pixelAlign CGPoint newPosition; - if ( CGSizeEqualToSize(boundsSize, frameSize) ) { // rotated 0° or 180° + if ( CGSizeEqualToSize(boundsSize, frameSize)) { // rotated 0° or 180° CGPoint anchor = self.anchorPoint; CGPoint newAnchor = CGPointMake(boundsSize.width * anchor.x, boundsSize.height * anchor.y); - if ( scale == CPTFloat(1.0) ) { - newPosition.x = ceil( currentPosition.x - newAnchor.x - CPTFloat(0.5) ) + newAnchor.x; - newPosition.y = ceil( currentPosition.y - newAnchor.y - CPTFloat(0.5) ) + newAnchor.y; + if ( scale == CPTFloat(1.0)) { + newPosition.x = ceil(currentPosition.x - newAnchor.x - CPTFloat(0.5)) + newAnchor.x; + newPosition.y = ceil(currentPosition.y - newAnchor.y - CPTFloat(0.5)) + newAnchor.y; } else { - newPosition.x = ceil( (currentPosition.x - newAnchor.x) * scale - CPTFloat(0.5) ) / scale + newAnchor.x; - newPosition.y = ceil( (currentPosition.y - newAnchor.y) * scale - CPTFloat(0.5) ) / scale + newAnchor.y; + newPosition.x = ceil((currentPosition.x - newAnchor.x) * scale - CPTFloat(0.5)) / scale + newAnchor.x; + newPosition.y = ceil((currentPosition.y - newAnchor.y) * scale - CPTFloat(0.5)) / scale + newAnchor.y; } } - else if ( (boundsSize.width == frameSize.height) && (boundsSize.height == frameSize.width) ) { // rotated 90° or 270° + else if ((boundsSize.width == frameSize.height) && (boundsSize.height == frameSize.width)) { // rotated 90° or 270° CGPoint anchor = self.anchorPoint; CGPoint newAnchor = CGPointMake(boundsSize.height * anchor.y, boundsSize.width * anchor.x); - if ( scale == CPTFloat(1.0) ) { - newPosition.x = ceil( currentPosition.x - newAnchor.x - CPTFloat(0.5) ) + newAnchor.x; - newPosition.y = ceil( currentPosition.y - newAnchor.y - CPTFloat(0.5) ) + newAnchor.y; + if ( scale == CPTFloat(1.0)) { + newPosition.x = ceil(currentPosition.x - newAnchor.x - CPTFloat(0.5)) + newAnchor.x; + newPosition.y = ceil(currentPosition.y - newAnchor.y - CPTFloat(0.5)) + newAnchor.y; } else { - newPosition.x = ceil( (currentPosition.x - newAnchor.x) * scale - CPTFloat(0.5) ) / scale + newAnchor.x; - newPosition.y = ceil( (currentPosition.y - newAnchor.y) * scale - CPTFloat(0.5) ) / scale + newAnchor.y; + newPosition.x = ceil((currentPosition.x - newAnchor.x) * scale - CPTFloat(0.5)) / scale + newAnchor.x; + newPosition.y = ceil((currentPosition.y - newAnchor.y) * scale - CPTFloat(0.5)) / scale + newAnchor.y; } } else { - if ( scale == CPTFloat(1.0) ) { + if ( scale == CPTFloat(1.0)) { newPosition.x = round(currentPosition.x); newPosition.y = round(currentPosition.y); } @@ -594,7 +661,7 @@ -(CGSize)shadowMargin CGSize shadowOffset = myShadow.shadowOffset; CGFloat shadowRadius = myShadow.shadowBlurRadius; - margin = CGSizeMake( ceil( ABS(shadowOffset.width) + ABS(shadowRadius) ), ceil( ABS(shadowOffset.height) + ABS(shadowRadius) ) ); + margin = CGSizeMake(ceil(ABS(shadowOffset.width) + ABS(shadowRadius)), ceil(ABS(shadowOffset.height) + ABS(shadowRadius))); } return margin; @@ -615,7 +682,7 @@ -(void)layoutSublayers { CGRect selfBounds = self.bounds; - CPTSublayerArray mySublayers = self.sublayers; + CPTSublayerArray *mySublayers = self.sublayers; if ( mySublayers.count > 0 ) { CGFloat leftPadding, topPadding, rightPadding, bottomPadding; @@ -624,18 +691,18 @@ -(void)layoutSublayers CGSize subLayerSize = selfBounds.size; subLayerSize.width -= leftPadding + rightPadding; - subLayerSize.width = MAX( subLayerSize.width, CPTFloat(0.0) ); + subLayerSize.width = MAX(subLayerSize.width, CPTFloat(0.0)); subLayerSize.width = round(subLayerSize.width); subLayerSize.height -= topPadding + bottomPadding; - subLayerSize.height = MAX( subLayerSize.height, CPTFloat(0.0) ); + subLayerSize.height = MAX(subLayerSize.height, CPTFloat(0.0)); subLayerSize.height = round(subLayerSize.height); CGRect subLayerFrame; - subLayerFrame.origin = CGPointMake( round(leftPadding), round(bottomPadding) ); + subLayerFrame.origin = CGPointMake(round(leftPadding), round(bottomPadding)); subLayerFrame.size = subLayerSize; - CPTSublayerSet excludedSublayers = [self sublayersExcludedFromAutomaticLayout]; - Class layerClass = [CPTLayer class]; + CPTSublayerSet *excludedSublayers = self.sublayersExcludedFromAutomaticLayout; + Class layerClass = [CPTLayer class]; for ( CALayer *subLayer in mySublayers ) { if ( [subLayer isKindOfClass:layerClass] && ![excludedSublayers containsObject:subLayer] ) { subLayer.frame = subLayerFrame; @@ -646,18 +713,22 @@ -(void)layoutSublayers /// @} --(CPTSublayerSet)sublayersExcludedFromAutomaticLayout +/// @cond + +-(nullable CPTSublayerSet *)sublayersExcludedFromAutomaticLayout { return nil; } +/// @endcond + /** @brief Returns the margins that should be left between the bounds of the receiver and all sublayers. * @param left The left margin. * @param top The top margin. * @param right The right margin. * @param bottom The bottom margin. **/ --(void)sublayerMarginLeft:(CGFloat *)left top:(CGFloat *)top right:(CGFloat *)right bottom:(CGFloat *)bottom +-(void)sublayerMarginLeft:(nonnull CGFloat *)left top:(nonnull CGFloat *)top right:(nonnull CGFloat *)right bottom:(nonnull CGFloat *)bottom { *left = self.paddingLeft; *top = self.paddingTop; @@ -670,61 +741,61 @@ -(void)sublayerMarginLeft:(CGFloat *)left top:(CGFloat *)top right:(CGFloat *)ri /// @cond --(void)setSublayers:(CPTSublayerArray)sublayers +-(void)setSublayers:(nullable CPTSublayerArray *)sublayers { - [super setSublayers:sublayers]; + super.sublayers = sublayers; Class layerClass = [CPTLayer class]; CGFloat scale = self.contentsScale; for ( CALayer *layer in sublayers ) { if ( [layer isKindOfClass:layerClass] ) { - ( (CPTLayer *)layer ).contentsScale = scale; + ((CPTLayer *)layer).contentsScale = scale; } } } --(void)addSublayer:(CALayer *)layer +-(void)addSublayer:(nonnull CALayer *)layer { [super addSublayer:layer]; if ( [layer isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer ).contentsScale = self.contentsScale; + ((CPTLayer *)layer).contentsScale = self.contentsScale; } } --(void)insertSublayer:(CALayer *)layer atIndex:(unsigned)idx +-(void)insertSublayer:(nonnull CALayer *)layer atIndex:(unsigned)idx { [super insertSublayer:layer atIndex:idx]; if ( [layer isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer ).contentsScale = self.contentsScale; + ((CPTLayer *)layer).contentsScale = self.contentsScale; } } --(void)insertSublayer:(CALayer *)layer below:(CALayer *)sibling +-(void)insertSublayer:(nonnull CALayer *)layer below:(nullable CALayer *)sibling { [super insertSublayer:layer below:sibling]; if ( [layer isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer ).contentsScale = self.contentsScale; + ((CPTLayer *)layer).contentsScale = self.contentsScale; } } --(void)insertSublayer:(CALayer *)layer above:(CALayer *)sibling +-(void)insertSublayer:(nonnull CALayer *)layer above:(nullable CALayer *)sibling { [super insertSublayer:layer above:sibling]; if ( [layer isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer ).contentsScale = self.contentsScale; + ((CPTLayer *)layer).contentsScale = self.contentsScale; } } --(void)replaceSublayer:(CALayer *)layer with:(CALayer *)layer2 +-(void)replaceSublayer:(nonnull CALayer *)layer with:(nonnull CALayer *)layer2 { [super replaceSublayer:layer with:layer2]; if ( [layer2 isKindOfClass:[CPTLayer class]] ) { - ( (CPTLayer *)layer2 ).contentsScale = self.contentsScale; + ((CPTLayer *)layer2).contentsScale = self.contentsScale; } } @@ -733,8 +804,10 @@ -(void)replaceSublayer:(CALayer *)layer with:(CALayer *)layer2 #pragma mark - #pragma mark Masking +/// @cond + // default path is the rounded rect layer bounds --(CGPathRef)maskingPath +-(nullable CGPathRef)maskingPath { if ( self.masksToBounds ) { CGPathRef path = self.outerBorderPath; @@ -753,11 +826,13 @@ -(CGPathRef)maskingPath } } --(CGPathRef)sublayerMaskingPath +-(nullable CGPathRef)sublayerMaskingPath { return self.innerBorderPath; } +/// @endcond + /** @brief Recursively sets the clipping path of the given graphics context to the sublayer masking paths of its superlayers. * * The clipping path is built by recursively climbing the layer tree and combining the sublayer masks from @@ -767,7 +842,7 @@ -(CGPathRef)sublayerMaskingPath * @param sublayer The sublayer that called this method. * @param offset The cumulative position offset between the receiver and the first layer in the recursive calling chain. **/ --(void)applySublayerMaskToContext:(CGContextRef)context forSublayer:(CPTLayer *)sublayer withOffset:(CGPoint)offset +-(void)applySublayerMaskToContext:(nonnull CGContextRef)context forSublayer:(nonnull CPTLayer *)sublayer withOffset:(CGPoint)offset { CGPoint sublayerBoundsOrigin = sublayer.bounds.origin; CGPoint layerOffset = offset; @@ -779,11 +854,11 @@ -(void)applySublayerMaskToContext:(CGContextRef)context forSublayer:(CPTLayer *) } CGAffineTransform sublayerTransform = CATransform3DGetAffineTransform(sublayer.transform); - CGContextConcatCTM( context, CGAffineTransformInvert(sublayerTransform) ); + CGContextConcatCTM(context, CGAffineTransformInvert(sublayerTransform)); CALayer *superlayer = self.superlayer; if ( [superlayer isKindOfClass:[CPTLayer class]] ) { - [(CPTLayer *)superlayer applySublayerMaskToContext : context forSublayer : self withOffset : layerOffset]; + [(CPTLayer *) superlayer applySublayerMaskToContext:context forSublayer:self withOffset:layerOffset]; } CGPathRef maskPath = self.sublayerMaskingPath; @@ -804,7 +879,7 @@ -(void)applySublayerMaskToContext:(CGContextRef)context forSublayer:(CPTLayer *) * * @param context The graphics context to clip. **/ --(void)applyMaskToContext:(CGContextRef)context +-(void)applyMaskToContext:(nonnull CGContextRef)context { CPTLayer *mySuperlayer = (CPTLayer *)self.superlayer; @@ -852,23 +927,13 @@ -(void)setNeedsDisplay -(void)setPosition:(CGPoint)newPosition { - [super setPosition:newPosition]; - if ( COREPLOT_LAYER_POSITION_CHANGE_ENABLED() ) { - CGRect currentFrame = self.frame; - if ( !CGRectEqualToRect( currentFrame, CGRectIntegral(self.frame) ) ) { - COREPLOT_LAYER_POSITION_CHANGE( (const char *)class_getName([self class]), - (int)lrint( ceil(currentFrame.origin.x * 1000.0) ), - (int)lrint( ceil(currentFrame.origin.y * 1000.0) ), - (int)lrint( ceil(currentFrame.size.width * 1000.0) ), - (int)lrint( ceil(currentFrame.size.height * 1000.0) ) ); - } - } + super.position = newPosition; } -(void)setHidden:(BOOL)newHidden { if ( newHidden != self.hidden ) { - [super setHidden:newHidden]; + super.hidden = newHidden; if ( !newHidden ) { [self setNeedsDisplay]; } @@ -877,7 +942,7 @@ -(void)setHidden:(BOOL)newHidden -(void)setContentsScale:(CGFloat)newContentsScale { - NSParameterAssert(newContentsScale > 0.0); + NSParameterAssert(newContentsScale > CPTFloat(0.0)); if ( self.contentsScale != newContentsScale ) { if ( [CALayer instancesRespondToSelector:@selector(setContentsScale:)] ) { @@ -905,7 +970,7 @@ -(CGFloat)contentsScale return scale; } --(void)setShadow:(CPTShadow *)newShadow +-(void)setShadow:(nullable CPTShadow *)newShadow { if ( newShadow != shadow ) { shadow = [newShadow copy]; @@ -914,7 +979,7 @@ -(void)setShadow:(CPTShadow *)newShadow } } --(void)setOuterBorderPath:(CGPathRef)newPath +-(void)setOuterBorderPath:(nullable CGPathRef)newPath { if ( newPath != outerBorderPath ) { CGPathRelease(outerBorderPath); @@ -922,7 +987,7 @@ -(void)setOuterBorderPath:(CGPathRef)newPath } } --(void)setInnerBorderPath:(CGPathRef)newPath +-(void)setInnerBorderPath:(nullable CGPathRef)newPath { if ( newPath != innerBorderPath ) { CGPathRelease(innerBorderPath); @@ -949,7 +1014,7 @@ -(CGRect)bounds -(void)setBounds:(CGRect)newBounds { - if ( !CGRectEqualToRect(self.bounds, newBounds) ) { + if ( !CGRectEqualToRect(self.bounds, newBounds)) { if ( self.shadow ) { CGSize sizeOffset = self.shadowMargin; @@ -959,7 +1024,7 @@ -(void)setBounds:(CGRect)newBounds newBounds.size.height += sizeOffset.height * CPTFloat(2.0); } - [super setBounds:newBounds]; + super.bounds = newBounds; self.outerBorderPath = NULL; self.innerBorderPath = NULL; @@ -976,14 +1041,14 @@ -(CGPoint)anchorPoint if ( self.shadow ) { CGSize sizeOffset = self.shadowMargin; CGRect selfBounds = self.bounds; - CGSize adjustedSize = CGSizeMake( selfBounds.size.width + sizeOffset.width * CPTFloat(2.0), - selfBounds.size.height + sizeOffset.height * CPTFloat(2.0) ); + CGSize adjustedSize = CGSizeMake(selfBounds.size.width + sizeOffset.width * CPTFloat(2.0), + selfBounds.size.height + sizeOffset.height * CPTFloat(2.0)); - if ( selfBounds.size.width > CPTFloat(0.0) ) { - adjustedAnchor.x = ( adjustedAnchor.x - CPTFloat(0.5) ) * (adjustedSize.width / selfBounds.size.width) + CPTFloat(0.5); + if ( selfBounds.size.width > CPTFloat(0.0)) { + adjustedAnchor.x = (adjustedAnchor.x - CPTFloat(0.5)) * (adjustedSize.width / selfBounds.size.width) + CPTFloat(0.5); } - if ( selfBounds.size.height > CPTFloat(0.0) ) { - adjustedAnchor.y = ( adjustedAnchor.y - CPTFloat(0.5) ) * (adjustedSize.height / selfBounds.size.height) + CPTFloat(0.5); + if ( selfBounds.size.height > CPTFloat(0.0)) { + adjustedAnchor.y = (adjustedAnchor.y - CPTFloat(0.5)) * (adjustedSize.height / selfBounds.size.height) + CPTFloat(0.5); } } @@ -995,18 +1060,18 @@ -(void)setAnchorPoint:(CGPoint)newAnchorPoint if ( self.shadow ) { CGSize sizeOffset = self.shadowMargin; CGRect selfBounds = self.bounds; - CGSize adjustedSize = CGSizeMake( selfBounds.size.width + sizeOffset.width * CPTFloat(2.0), - selfBounds.size.height + sizeOffset.height * CPTFloat(2.0) ); + CGSize adjustedSize = CGSizeMake(selfBounds.size.width + sizeOffset.width * CPTFloat(2.0), + selfBounds.size.height + sizeOffset.height * CPTFloat(2.0)); - if ( adjustedSize.width > CPTFloat(0.0) ) { - newAnchorPoint.x = ( newAnchorPoint.x - CPTFloat(0.5) ) * (selfBounds.size.width / adjustedSize.width) + CPTFloat(0.5); + if ( adjustedSize.width > CPTFloat(0.0)) { + newAnchorPoint.x = (newAnchorPoint.x - CPTFloat(0.5)) * (selfBounds.size.width / adjustedSize.width) + CPTFloat(0.5); } - if ( adjustedSize.height > CPTFloat(0.0) ) { - newAnchorPoint.y = ( newAnchorPoint.y - CPTFloat(0.5) ) * (selfBounds.size.height / adjustedSize.height) + CPTFloat(0.5); + if ( adjustedSize.height > CPTFloat(0.0)) { + newAnchorPoint.y = (newAnchorPoint.y - CPTFloat(0.5)) * (selfBounds.size.height / adjustedSize.height) + CPTFloat(0.5); } } - [super setAnchorPoint:newAnchorPoint]; + super.anchorPoint = newAnchorPoint; } -(void)setCornerRadius:(CGFloat)newRadius @@ -1028,9 +1093,9 @@ -(void)setCornerRadius:(CGFloat)newRadius /// @cond --(NSString *)description +-(nullable NSString *)description { - return [NSString stringWithFormat:@"<%@ bounds: %@>", [super description], CPTStringFromRect(self.bounds)]; + return [NSString stringWithFormat:@"<%@ bounds: %@>", super.description, CPTStringFromRect(self.bounds)]; } /// @endcond @@ -1045,14 +1110,14 @@ -(void)logLayers /// @cond --(NSString *)subLayersAtIndex:(NSUInteger)idx +-(nonnull NSString *)subLayersAtIndex:(NSUInteger)idx { NSMutableString *result = [NSMutableString string]; for ( NSUInteger i = 0; i < idx; i++ ) { [result appendString:@". "]; } - [result appendString:[self description]]; + [result appendString:self.description]; for ( CPTLayer *sublayer in self.sublayers ) { [result appendString:@"\n"]; @@ -1061,7 +1126,7 @@ -(NSString *)subLayersAtIndex:(NSUInteger)idx [result appendString:[sublayer subLayersAtIndex:idx + 1]]; } else { - [result appendString:[sublayer description]]; + [result appendString:sublayer.description]; } } @@ -1075,7 +1140,7 @@ -(NSString *)subLayersAtIndex:(NSUInteger)idx /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { return [self imageOfLayer]; } diff --git a/framework/Source/CPTLayerAnnotation.h b/framework/Source/CPTLayerAnnotation.h index 4a1b45bbd..23e1afeea 100644 --- a/framework/Source/CPTLayerAnnotation.h +++ b/framework/Source/CPTLayerAnnotation.h @@ -5,10 +5,15 @@ @interface CPTLayerAnnotation : CPTAnnotation -@property (nonatomic, readonly, nullable) cpt_weak CPTLayer *anchorLayer; +@property (nonatomic, readonly, cpt_weak_property, nullable) CPTLayer *anchorLayer; @property (nonatomic, readwrite, assign) CPTRectAnchor rectAnchor; +@property (nonatomic, readwrite, strong, nullable) CPTConstraints *xConstraints; +@property (nonatomic, readwrite, strong, nullable) CPTConstraints *yConstraints; +/// @name Initialization +/// @{ -(nonnull instancetype)initWithAnchorLayer:(nonnull CPTLayer *)anchorLayer NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +/// @} @end diff --git a/framework/Source/CPTLayerAnnotation.m b/framework/Source/CPTLayerAnnotation.m index 063ba8f3d..69c68d6da 100644 --- a/framework/Source/CPTLayerAnnotation.m +++ b/framework/Source/CPTLayerAnnotation.m @@ -7,9 +7,6 @@ /// @cond @interface CPTLayerAnnotation() -@property (nonatomic, readwrite, strong, nullable) CPTConstraints *xConstraints; -@property (nonatomic, readwrite, strong, nullable) CPTConstraints *yConstraints; - -(void)setConstraints; @end @@ -26,7 +23,7 @@ -(void)setConstraints; **/ @implementation CPTLayerAnnotation -/** @property cpt_weak CPTLayer *anchorLayer +/** @property nullable CPTLayer *anchorLayer * @brief The reference layer. **/ @synthesize anchorLayer; @@ -36,7 +33,14 @@ @implementation CPTLayerAnnotation **/ @synthesize rectAnchor; +/** @property CPTConstraints *xConstraints + * @brief The constraints used to position the content layer relative to the reference layer in the x-direction. Setting the @ref rectAnchor resets the constraints. + **/ @synthesize xConstraints; + +/** @property CPTConstraints *yConstraints + * @brief The constraints used to position the content layer relative to the reference layer in the y-direction. Setting the @ref rectAnchor resets the constraints. + **/ @synthesize yConstraints; #pragma mark - @@ -53,11 +57,11 @@ @implementation CPTLayerAnnotation * @param newAnchorLayer The reference layer. Must be non-@nil. * @return The initialized CPTLayerAnnotation object. **/ --(instancetype)initWithAnchorLayer:(CPTLayer *)newAnchorLayer +-(nonnull instancetype)initWithAnchorLayer:(nonnull CPTLayer *)newAnchorLayer { NSParameterAssert(newAnchorLayer); - if ( (self = [super init]) ) { + if ((self = [super init])) { anchorLayer = newAnchorLayer; rectAnchor = CPTRectAnchorTop; xConstraints = nil; @@ -77,7 +81,7 @@ -(instancetype)initWithAnchorLayer:(CPTLayer *)newAnchorLayer /// @cond // anchorLayer is required --(instancetype)init +-(nonnull instancetype)init { [NSException raise:CPTException format:@"%@ must be initialized with an anchor layer.", NSStringFromClass([self class])]; return [self initWithAnchorLayer:[CPTLayer layer]]; @@ -96,7 +100,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -112,13 +116,25 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - anchorLayer = [coder decodeObjectForKey:@"CPTLayerAnnotation.anchorLayer"]; - xConstraints = [coder decodeObjectForKey:@"CPTLayerAnnotation.xConstraints"]; - yConstraints = [coder decodeObjectForKey:@"CPTLayerAnnotation.yConstraints"]; - rectAnchor = (CPTRectAnchor)[coder decodeIntegerForKey : @"CPTLayerAnnotation.rectAnchor"]; + if ((self = [super initWithCoder:coder])) { + CPTLayer *anchor = [coder decodeObjectOfClass:[CPTLayer class] + forKey:@"CPTLayerAnnotation.anchorLayer"]; + xConstraints = [coder decodeObjectOfClass:[CPTConstraints class] + forKey:@"CPTLayerAnnotation.xConstraints"]; + yConstraints = [coder decodeObjectOfClass:[CPTConstraints class] + forKey:@"CPTLayerAnnotation.yConstraints"]; + rectAnchor = (CPTRectAnchor)[coder decodeIntegerForKey:@"CPTLayerAnnotation.rectAnchor"]; + + if ( anchor ) { + anchorLayer = anchor; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(positionContentLayer) + name:CPTLayerBoundsDidChangeNotification + object:anchor]; + } } return self; } @@ -152,7 +168,7 @@ -(void)positionContentLayer content.anchorPoint = self.contentAnchorPoint; content.position = newPosition; - content.transform = CATransform3DMakeRotation( self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) ); + content.transform = CATransform3DMakeRotation(self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0)); [content pixelAlign]; } } @@ -160,6 +176,18 @@ -(void)positionContentLayer /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Constraints @@ -234,6 +262,21 @@ -(void)setRectAnchor:(CPTRectAnchor)newAnchor if ( newAnchor != rectAnchor ) { rectAnchor = newAnchor; [self setConstraints]; + } +} + +-(void)setXConstraints:(CPTConstraints *)newConstraints +{ + if ( newConstraints != xConstraints ) { + xConstraints = newConstraints; + [self positionContentLayer]; + } +} + +-(void)setYConstraints:(CPTConstraints *)newConstraints +{ + if ( newConstraints != yConstraints ) { + yConstraints = newConstraints; [self positionContentLayer]; } } diff --git a/framework/Source/CPTLayerTests.h b/framework/Source/CPTLayerTests.h index 3f507fdd2..fa9b9ba33 100644 --- a/framework/Source/CPTLayerTests.h +++ b/framework/Source/CPTLayerTests.h @@ -6,7 +6,7 @@ @interface CPTLayerTests : CPTTestCase -@property (nonatomic, readwrite, strong) CPTLayer *layer; -@property (nonatomic, readwrite, strong) CPTNumberArray positions; +@property (nonatomic, readwrite, strong, nonnull) CPTLayer *layer; +@property (nonatomic, readwrite, strong, nonnull) CPTNumberArray *positions; @end diff --git a/framework/Source/CPTLayerTests.m b/framework/Source/CPTLayerTests.m index 78337db38..d94be1dc5 100644 --- a/framework/Source/CPTLayerTests.m +++ b/framework/Source/CPTLayerTests.m @@ -4,11 +4,11 @@ #import "CPTUtilities.h" #import "NSNumberExtensions.h" -static const double precision = 1.0e-6; +static const CGFloat precision = CPTFloat(1.0e-6); @interface CPTLayerTests() --(void)testPositionsWithScale:(CGFloat)scale anchorPoint:(CGPoint)anchor expected:(CPTNumberArray)expected; +-(void)testPositionsWithScale:(CGFloat)scale anchorPoint:(CGPoint)anchor expected:(CPTNumberArray *)expected; @end @@ -40,7 +40,7 @@ -(void)tearDown -(void)testPixelAlign1xLeft { - CPTNumberArray expected = @[@10.0, @10.0, @11.0, @11.0, @11.0, @11.0]; + CPTNumberArray *expected = @[@10.0, @10.0, @11.0, @11.0, @11.0, @11.0]; [self testPositionsWithScale:CPTFloat(1.0) anchorPoint:CGPointZero @@ -49,7 +49,7 @@ -(void)testPixelAlign1xLeft -(void)testPixelAlign1xLeftMiddle { - CPTNumberArray expected = @[@10.75, @10.75, @10.75, @10.75, @10.75, @10.75]; + CPTNumberArray *expected = @[@10.75, @10.75, @10.75, @10.75, @10.75, @10.75]; [self testPositionsWithScale:CPTFloat(1.0) anchorPoint:CPTPointMake(0.25, 0.25) @@ -58,7 +58,7 @@ -(void)testPixelAlign1xLeftMiddle -(void)testPixelAlign1xMiddle { - CPTNumberArray expected = @[@10.5, @10.5, @10.5, @10.5, @10.5, @11.5]; + CPTNumberArray *expected = @[@10.5, @10.5, @10.5, @10.5, @10.5, @11.5]; [self testPositionsWithScale:CPTFloat(1.0) anchorPoint:CPTPointMake(0.5, 0.5) @@ -67,7 +67,7 @@ -(void)testPixelAlign1xMiddle -(void)testPixelAlign1xRightMiddle { - CPTNumberArray expected = @[@10.25, @10.25, @10.25, @11.25, @11.25, @11.25]; + CPTNumberArray *expected = @[@10.25, @10.25, @10.25, @11.25, @11.25, @11.25]; [self testPositionsWithScale:CPTFloat(1.0) anchorPoint:CPTPointMake(0.75, 0.75) @@ -76,7 +76,7 @@ -(void)testPixelAlign1xRightMiddle -(void)testPixelAlign1xRight { - CPTNumberArray expected = @[@10.0, @10.0, @11.0, @11.0, @11.0, @11.0]; + CPTNumberArray *expected = @[@10.0, @10.0, @11.0, @11.0, @11.0, @11.0]; [self testPositionsWithScale:CPTFloat(1.0) anchorPoint:CPTPointMake(1.0, 1.0) @@ -87,7 +87,7 @@ -(void)testPixelAlign1xRight -(void)testPixelAlign2xLeft { - CPTNumberArray expected = @[@10.5, @10.5, @10.5, @11.0, @11.0, @11.0]; + CPTNumberArray *expected = @[@10.5, @10.5, @10.5, @11.0, @11.0, @11.0]; [self testPositionsWithScale:CPTFloat(2.0) anchorPoint:CGPointZero @@ -96,7 +96,7 @@ -(void)testPixelAlign2xLeft -(void)testPixelAlign2xLeftMiddle { - CPTNumberArray expected = @[@10.25, @10.25, @10.75, @10.75, @10.75, @11.25]; + CPTNumberArray *expected = @[@10.25, @10.25, @10.75, @10.75, @10.75, @11.25]; [self testPositionsWithScale:CPTFloat(2.0) anchorPoint:CPTPointMake(0.25, 0.25) @@ -105,7 +105,7 @@ -(void)testPixelAlign2xLeftMiddle -(void)testPixelAlign2xMiddle { - CPTNumberArray expected = @[@10.5, @10.5, @10.5, @11.0, @11.0, @11.0]; + CPTNumberArray *expected = @[@10.5, @10.5, @10.5, @11.0, @11.0, @11.0]; [self testPositionsWithScale:CPTFloat(2.0) anchorPoint:CPTPointMake(0.5, 0.5) @@ -114,7 +114,7 @@ -(void)testPixelAlign2xMiddle -(void)testPixelAlign2xRightMiddle { - CPTNumberArray expected = @[@10.25, @10.25, @10.75, @10.75, @10.75, @11.25]; + CPTNumberArray *expected = @[@10.25, @10.25, @10.75, @10.75, @10.75, @11.25]; [self testPositionsWithScale:CPTFloat(2.0) anchorPoint:CPTPointMake(0.75, 0.75) @@ -123,7 +123,7 @@ -(void)testPixelAlign2xRightMiddle -(void)testPixelAlign2xRight { - CPTNumberArray expected = @[@10.5, @10.5, @10.5, @11.0, @11.0, @11.0]; + CPTNumberArray *expected = @[@10.5, @10.5, @10.5, @11.0, @11.0, @11.0]; [self testPositionsWithScale:CPTFloat(2.0) anchorPoint:CPTPointMake(1.0, 1.0) @@ -132,7 +132,7 @@ -(void)testPixelAlign2xRight #pragma mark - Utility methods --(void)testPositionsWithScale:(CGFloat)scale anchorPoint:(CGPoint)anchor expected:(CPTNumberArray)expectedValues +-(void)testPositionsWithScale:(CGFloat)scale anchorPoint:(CGPoint)anchor expected:(CPTNumberArray *)expectedValues { NSUInteger positionCount = self.positions.count; @@ -142,20 +142,20 @@ -(void)testPositionsWithScale:(CGFloat)scale anchorPoint:(CGPoint)anchor expecte self.layer.anchorPoint = anchor; for ( NSUInteger i = 0; i < positionCount; i++ ) { - CGFloat position = ( (NSNumber *)( (self.positions)[i] ) ).cgFloatValue; + CGFloat position = ((NSNumber *)((self.positions)[i])).cgFloatValue; CGPoint layerPosition = CGPointMake(position, position); self.layer.position = layerPosition; [self.layer pixelAlign]; CGPoint alignedPoint = self.layer.position; - CGFloat expected = ( (NSNumber *)(expectedValues[i]) ).cgFloatValue; + 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/CPTLegend.h b/framework/Source/CPTLegend.h index dcb319f7a..d865a3e21 100644 --- a/framework/Source/CPTLegend.h +++ b/framework/Source/CPTLegend.h @@ -8,30 +8,47 @@ @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); /// @} +/** + * @brief Enumeration of legend layout options. + **/ +typedef NS_ENUM (NSInteger, CPTLegendSwatchLayout) { + CPTLegendSwatchLayoutLeft, ///< Lay out the swatch to the left side of the title. + CPTLegendSwatchLayoutRight, ///< Lay out the swatch to the right side of the title. + CPTLegendSwatchLayoutTop, ///< Lay out the swatch above the title. + CPTLegendSwatchLayoutBottom ///< Lay out the swatch below the title. +}; + +#pragma mark - + /** * @brief Legend delegate. **/ -@protocol CPTLegendDelegate +@protocol CPTLegendDelegate @optional @@ -190,30 +207,31 @@ extern NSString *__nonnull const CPTLegendNeedsReloadEntriesForPlotNotification; @property (nonatomic, readwrite, assign) NSUInteger numberOfColumns; @property (nonatomic, readwrite, assign) BOOL equalRows; @property (nonatomic, readwrite, assign) BOOL equalColumns; -@property (nonatomic, readwrite, copy, nullable) CPTNumberArray rowHeights; -@property (nonatomic, readonly, nullable) CPTNumberArray rowHeightsThatFit; -@property (nonatomic, readwrite, copy, nullable) CPTNumberArray columnWidths; -@property (nonatomic, readonly, nullable) CPTNumberArray columnWidthsThatFit; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *rowHeights; +@property (nonatomic, readonly, nullable) CPTNumberArray *rowHeightsThatFit; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *columnWidths; +@property (nonatomic, readonly, nullable) CPTNumberArray *columnWidthsThatFit; @property (nonatomic, readwrite, assign) CGFloat columnMargin; @property (nonatomic, readwrite, assign) CGFloat rowMargin; @property (nonatomic, readwrite, assign) CGFloat titleOffset; +@property (nonatomic, readwrite, assign) CPTLegendSwatchLayout swatchLayout; /// @} /// @name Factory Methods /// @{ -+(nonnull instancetype)legendWithPlots:(nullable CPTPlotArray)newPlots; ++(nonnull instancetype)legendWithPlots:(nullable CPTPlotArray *)newPlots; +(nonnull instancetype)legendWithGraph:(nullable __kindof CPTGraph *)graph; /// @} /// @name Initialization /// @{ --(nonnull instancetype)initWithPlots:(nullable CPTPlotArray)newPlots; +-(nonnull instancetype)initWithPlots:(nullable CPTPlotArray *)newPlots; -(nonnull instancetype)initWithGraph:(nullable __kindof CPTGraph *)graph; /// @} /// @name Plots /// @{ --(nonnull CPTPlotArray)allPlots; +-(nonnull CPTPlotArray *)allPlots; -(nullable CPTPlot *)plotAtIndex:(NSUInteger)idx; -(nullable CPTPlot *)plotWithIdentifier:(nullable id)identifier; diff --git a/framework/Source/CPTLegend.m b/framework/Source/CPTLegend.m index 8a2502681..c5fcb69c4 100644 --- a/framework/Source/CPTLegend.m +++ b/framework/Source/CPTLegend.m @@ -15,33 +15,33 @@ /** @defgroup legendAnimation Legends * @brief Legend properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif * @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() -@property (nonatomic, readwrite, strong) CPTMutablePlotArray plots; -@property (nonatomic, readwrite, strong) CPTMutableLegendEntryArray legendEntries; -@property (nonatomic, readwrite, strong) CPTNumberArray rowHeightsThatFit; -@property (nonatomic, readwrite, strong) CPTNumberArray columnWidthsThatFit; +@property (nonatomic, readwrite, strong, nonnull) CPTMutablePlotArray *plots; +@property (nonatomic, readwrite, strong, nonnull) CPTMutableLegendEntryArray *legendEntries; +@property (nonatomic, readwrite, strong, nullable) CPTNumberArray *rowHeightsThatFit; +@property (nonatomic, readwrite, strong, nullable) CPTNumberArray *columnWidthsThatFit; @property (nonatomic, readwrite, assign) BOOL layoutChanged; -@property (nonatomic, readwrite, cpt_weak_property) cpt_weak CPTLegendEntry *pointingDeviceDownEntry; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTLegendEntry *pointingDeviceDownEntry; -(void)recalculateLayout; --(void)removeLegendEntriesForPlot:(CPTPlot *)plot; +-(void)removeLegendEntriesForPlot:(nonnull CPTPlot *)plot; --(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(NSUInteger *)row col:(NSUInteger *)col; +-(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(nonnull NSUInteger *)row col:(nonnull NSUInteger *)col; --(void)legendNeedsRedraw:(NSNotification *)notif; --(void)legendNeedsLayout:(NSNotification *)notif; --(void)legendNeedsReloadEntries:(NSNotification *)notif; +-(void)legendNeedsRedraw:(nonnull NSNotification *)notif; +-(void)legendNeedsLayout:(nonnull NSNotification *)notif; +-(void)legendNeedsReloadEntries:(nonnull NSNotification *)notif; @end @@ -66,7 +66,7 @@ -(void)legendNeedsReloadEntries:(NSNotification *)notif; **/ @implementation CPTLegend -/** @property CPTTextStyle *textStyle +/** @property nullable CPTTextStyle *textStyle * @brief The text style used to draw all legend entry titles. **/ @synthesize textStyle; @@ -77,7 +77,7 @@ @implementation CPTLegend **/ @synthesize swatchSize; -/** @property CPTLineStyle *swatchBorderLineStyle +/** @property nullable CPTLineStyle *swatchBorderLineStyle * @brief The line style for the border drawn around each swatch. * If @nil (the default), no border is drawn. **/ @@ -89,13 +89,13 @@ @implementation CPTLegend **/ @synthesize swatchCornerRadius; -/** @property CPTFill *swatchFill +/** @property nullable CPTFill *swatchFill * @brief The background fill drawn behind each swatch. * If @nil (the default), no fill is drawn. **/ @synthesize swatchFill; -/** @property CPTLineStyle *entryBorderLineStyle +/** @property nullable CPTLineStyle *entryBorderLineStyle * @brief The line style for the border drawn around each legend entry. * If @nil (the default), no border is drawn. **/ @@ -107,7 +107,7 @@ @implementation CPTLegend **/ @synthesize entryCornerRadius; -/** @property CPTFill *entryFill +/** @property nullable CPTFill *entryFill * @brief The background fill drawn behind each legend entry. * If @nil (the default), no fill is drawn. **/ @@ -160,7 +160,7 @@ @implementation CPTLegend **/ @synthesize equalColumns; -/** @property CPTNumberArray rowHeights +/** @property nullable CPTNumberArray *rowHeights * @brief The desired height of each row of legend entries, including the swatch and title. * Each element in this array should be an NSNumber representing the height of the corresponding row in device units. * Rows are numbered from top to bottom starting from zero (@num{0}). If @nil, all rows will be sized automatically. @@ -169,14 +169,14 @@ @implementation CPTLegend **/ @synthesize rowHeights; -/** @property CPTNumberArray rowHeightsThatFit +/** @property nullable CPTNumberArray *rowHeightsThatFit * @brief The computed best-fit height of each row of legend entries, including the swatch and title. * Each element in this array is an NSNumber representing the height of the corresponding row in device units. * Rows are numbered from top to bottom starting from zero (@num{0}). **/ @synthesize rowHeightsThatFit; -/** @property CPTNumberArray columnWidths +/** @property nullable CPTNumberArray *columnWidths * @brief The desired width of each column of legend entries, including the swatch, title, and title offset. * Each element in this array should be an NSNumber representing the width of the corresponding column in device units. * Columns are numbered from left to right starting from zero (@num{0}). If @nil, all columns will be sized automatically. @@ -185,7 +185,7 @@ @implementation CPTLegend **/ @synthesize columnWidths; -/** @property CPTNumberArray columnWidthsThatFit +/** @property nullable CPTNumberArray *columnWidthsThatFit * @brief The computed best-fit width of each column of legend entries, including the swatch, title, and title offset. * Each element in this array is an NSNumber representing the width of the corresponding column in device units. * Columns are numbered from left to right starting from zero (@num{0}). @@ -207,12 +207,19 @@ @implementation CPTLegend **/ @synthesize titleOffset; -/** @property CPTMutablePlotArray plots +/** @property CPTLegendSwatchLayout swatchLayout + * @brief Where to draw the legend swatch relative to the title. Default is #CPTLegendSwatchLayoutLeft. + **/ +@synthesize swatchLayout; + +/** @internal + * @property nonnull CPTMutablePlotArray *plots * @brief An array of all plots associated with the legend. **/ @synthesize plots; -/** @property CPTMutableLegendEntryArray legendEntries +/** @internal + * @property nonnull CPTMutableLegendEntryArray *legendEntries * @brief An array of all legend entries. **/ @synthesize legendEntries; @@ -223,7 +230,7 @@ @implementation CPTLegend @synthesize layoutChanged; /** @internal - * @property cpt_weak CPTLegendEntry *pointingDeviceDownEntry + * @property nullable CPTLegendEntry *pointingDeviceDownEntry * @brief The legend entry that was selected on the pointing device down event. **/ @synthesize pointingDeviceDownEntry; @@ -235,7 +242,7 @@ @implementation CPTLegend * @param newPlots An array of plots. * @return A new CPTLegend instance. **/ -+(instancetype)legendWithPlots:(CPTPlotArray)newPlots ++(nonnull instancetype)legendWithPlots:(nullable CPTPlotArray *)newPlots { return [[self alloc] initWithPlots:newPlots]; } @@ -244,7 +251,7 @@ +(instancetype)legendWithPlots:(CPTPlotArray)newPlots * @param graph The graph. * @return A new CPTLegend instance. **/ -+(instancetype)legendWithGraph:(CPTGraph *)graph ++(nonnull instancetype)legendWithGraph:(nullable __kindof CPTGraph *)graph { return [[self alloc] initWithGraph:graph]; } @@ -282,6 +289,7 @@ +(instancetype)legendWithGraph:(CPTGraph *)graph * - @ref columnMargin = @num{10.0} * - @ref rowMargin = @num{5.0} * - @ref titleOffset = @num{5.0} + * - @ref swatchLayout = #CPTLegendSwatchLayoutLeft * - @ref paddingLeft = @num{5.0} * - @ref paddingTop = @num{5.0} * - @ref paddingRight = @num{5.0} @@ -291,9 +299,9 @@ +(instancetype)legendWithGraph:(CPTGraph *)graph * @param newFrame The frame rectangle. * @return The initialized CPTLegend object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plots = [[NSMutableArray alloc] init]; legendEntries = [[NSMutableArray alloc] init]; layoutChanged = YES; @@ -320,6 +328,7 @@ -(instancetype)initWithFrame:(CGRect)newFrame columnMargin = CPTFloat(10.0); rowMargin = CPTFloat(5.0); titleOffset = CPTFloat(5.0); + swatchLayout = CPTLegendSwatchLayoutLeft; pointingDeviceDownEntry = nil; @@ -339,9 +348,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame * @param newPlots An array of plots. * @return The initialized CPTLegend object. **/ --(instancetype)initWithPlots:(CPTPlotArray)newPlots +-(nonnull instancetype)initWithPlots:(nullable CPTPlotArray *)newPlots { - if ( (self = [self initWithFrame:CGRectZero]) ) { + if ((self = [self initWithFrame:CGRectZero])) { for ( CPTPlot *plot in newPlots ) { [self addPlot:plot]; } @@ -353,9 +362,9 @@ -(instancetype)initWithPlots:(CPTPlotArray)newPlots * @param graph A graph. * @return The initialized CPTLegend object. **/ --(instancetype)initWithGraph:(CPTGraph *)graph +-(nonnull instancetype)initWithGraph:(nullable __kindof CPTGraph *)graph { - if ( (self = [self initWithFrame:CGRectZero]) ) { + if ((self = [self initWithFrame:CGRectZero])) { for ( CPTPlot *plot in [graph allPlots] ) { [self addPlot:plot]; } @@ -365,9 +374,9 @@ -(instancetype)initWithGraph:(CPTGraph *)graph /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTLegend *theLayer = (CPTLegend *)layer; plots = theLayer->plots; @@ -396,6 +405,7 @@ -(instancetype)initWithLayer:(id)layer columnMargin = theLayer->columnMargin; rowMargin = theLayer->rowMargin; titleOffset = theLayer->titleOffset; + swatchLayout = theLayer->swatchLayout; pointingDeviceDownEntry = theLayer->pointingDeviceDownEntry; } @@ -414,7 +424,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -444,40 +454,67 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeCGFloat:self.columnMargin forKey:@"CPTLegend.columnMargin"]; [coder encodeCGFloat:self.rowMargin forKey:@"CPTLegend.rowMargin"]; [coder encodeCGFloat:self.titleOffset forKey:@"CPTLegend.titleOffset"]; + [coder encodeInteger:(NSInteger)self.swatchLayout forKey:@"CPTLegend.swatchLayout"]; // No need to archive these properties: // pointingDeviceDownEntry } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - plots = [[coder decodeObjectForKey:@"CPTLegend.plots"] mutableCopy]; - legendEntries = [[coder decodeObjectForKey:@"CPTLegend.legendEntries"] mutableCopy]; - layoutChanged = [coder decodeBoolForKey:@"CPTLegend.layoutChanged"]; - textStyle = [[coder decodeObjectForKey:@"CPTLegend.textStyle"] copy]; + if ((self = [super initWithCoder:coder])) { + NSArray *plotArray = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTPlot class]]] + forKey:@"CPTLegend.plots"]; + if ( plotArray ) { + plots = [plotArray mutableCopy]; + } + else { + plots = [[NSMutableArray alloc] init]; + } + + NSArray *entries = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTLegendEntry class]]] + forKey:@"CPTLegend.legendEntries"]; + if ( entries ) { + legendEntries = [entries mutableCopy]; + } + else { + legendEntries = [[NSMutableArray alloc] init]; + } + + layoutChanged = [coder decodeBoolForKey:@"CPTLegend.layoutChanged"]; + textStyle = [[coder decodeObjectOfClass:[CPTTextStyle class] + forKey:@"CPTLegend.textStyle"] copy]; swatchSize = [coder decodeCPTSizeForKey:@"CPTLegend.swatchSize"]; - swatchBorderLineStyle = [[coder decodeObjectForKey:@"CPTLegend.swatchBorderLineStyle"] copy]; - swatchCornerRadius = [coder decodeCGFloatForKey:@"CPTLegend.swatchCornerRadius"]; - swatchFill = [[coder decodeObjectForKey:@"CPTLegend.swatchFill"] copy]; - entryBorderLineStyle = [[coder decodeObjectForKey:@"CPTLegend.entryBorderLineStyle"] copy]; - entryCornerRadius = [coder decodeCGFloatForKey:@"CPTLegend.entryCornerRadius"]; - entryFill = [[coder decodeObjectForKey:@"CPTLegend.entryFill"] copy]; - entryPaddingLeft = [coder decodeCGFloatForKey:@"CPTLegend.entryPaddingLeft"]; - entryPaddingTop = [coder decodeCGFloatForKey:@"CPTLegend.entryPaddingTop"]; - entryPaddingRight = [coder decodeCGFloatForKey:@"CPTLegend.entryPaddingRight"]; - entryPaddingBottom = [coder decodeCGFloatForKey:@"CPTLegend.entryPaddingBottom"]; - numberOfRows = (NSUInteger)[coder decodeIntegerForKey : @"CPTLegend.numberOfRows"]; - numberOfColumns = (NSUInteger)[coder decodeIntegerForKey : @"CPTLegend.numberOfColumns"]; - equalRows = [coder decodeBoolForKey:@"CPTLegend.equalRows"]; - equalColumns = [coder decodeBoolForKey:@"CPTLegend.equalColumns"]; - rowHeights = [[coder decodeObjectForKey:@"CPTLegend.rowHeights"] copy]; - rowHeightsThatFit = [coder decodeObjectForKey:@"CPTLegend.rowHeightsThatFit"]; - columnWidths = [[coder decodeObjectForKey:@"CPTLegend.columnWidths"] copy]; - columnWidthsThatFit = [coder decodeObjectForKey:@"CPTLegend.columnWidthsThatFit"]; - columnMargin = [coder decodeCGFloatForKey:@"CPTLegend.columnMargin"]; - rowMargin = [coder decodeCGFloatForKey:@"CPTLegend.rowMargin"]; - titleOffset = [coder decodeCGFloatForKey:@"CPTLegend.titleOffset"]; + swatchBorderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTLegend.swatchBorderLineStyle"] copy]; + swatchCornerRadius = [coder decodeCGFloatForKey:@"CPTLegend.swatchCornerRadius"]; + swatchFill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTLegend.swatchFill"] copy]; + entryBorderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTLegend.entryBorderLineStyle"] copy]; + entryCornerRadius = [coder decodeCGFloatForKey:@"CPTLegend.entryCornerRadius"]; + entryFill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTLegend.entryFill"] copy]; + entryPaddingLeft = [coder decodeCGFloatForKey:@"CPTLegend.entryPaddingLeft"]; + entryPaddingTop = [coder decodeCGFloatForKey:@"CPTLegend.entryPaddingTop"]; + entryPaddingRight = [coder decodeCGFloatForKey:@"CPTLegend.entryPaddingRight"]; + entryPaddingBottom = [coder decodeCGFloatForKey:@"CPTLegend.entryPaddingBottom"]; + numberOfRows = (NSUInteger)[coder decodeIntegerForKey:@"CPTLegend.numberOfRows"]; + numberOfColumns = (NSUInteger)[coder decodeIntegerForKey:@"CPTLegend.numberOfColumns"]; + equalRows = [coder decodeBoolForKey:@"CPTLegend.equalRows"]; + equalColumns = [coder decodeBoolForKey:@"CPTLegend.equalColumns"]; + rowHeights = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTLegend.rowHeights"] copy]; + rowHeightsThatFit = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTLegend.rowHeightsThatFit"]; + columnWidths = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTLegend.columnWidths"] copy]; + columnWidthsThatFit = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTLegend.columnWidthsThatFit"]; + columnMargin = [coder decodeCGFloatForKey:@"CPTLegend.columnMargin"]; + rowMargin = [coder decodeCGFloatForKey:@"CPTLegend.rowMargin"]; + titleOffset = [coder decodeCGFloatForKey:@"CPTLegend.titleOffset"]; + swatchLayout = (CPTLegendSwatchLayout)[coder decodeIntegerForKey:@"CPTLegend.swatchLayout"]; pointingDeviceDownEntry = nil; } @@ -486,12 +523,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -503,11 +552,25 @@ -(void)renderAsVectorInContext:(CGContextRef)context return; } + BOOL isHorizontalLayout; + + switch ( self.swatchLayout ) { + case CPTLegendSwatchLayoutLeft: + case CPTLegendSwatchLayoutRight: + isHorizontalLayout = YES; + break; + + case CPTLegendSwatchLayoutTop: + case CPTLegendSwatchLayoutBottom: + isHorizontalLayout = NO; + break; + } + // calculate column positions - CPTNumberArray computedColumnWidths = self.columnWidthsThatFit; - NSUInteger columnCount = computedColumnWidths.count; - CGFloat *actualColumnWidths = malloc(sizeof(CGFloat) * columnCount); - CGFloat *columnPositions = malloc(sizeof(CGFloat) * columnCount); + CPTNumberArray *computedColumnWidths = self.columnWidthsThatFit; + NSUInteger columnCount = computedColumnWidths.count; + CGFloat *actualColumnWidths = calloc(columnCount, sizeof(CGFloat)); + CGFloat *columnPositions = calloc(columnCount, sizeof(CGFloat)); columnPositions[0] = self.paddingLeft; CGFloat theOffset = self.titleOffset; CGSize theSwatchSize = self.swatchSize; @@ -523,15 +586,15 @@ -(void)renderAsVectorInContext:(CGContextRef)context CGFloat width = [colWidth cgFloatValue]; actualColumnWidths[col] = width; if ( col < columnCount - 1 ) { - columnPositions[col + 1] = columnPositions[col] + padLeft + width + padRight + theOffset + theSwatchSize.width + theColumnMargin; + columnPositions[col + 1] = columnPositions[col] + padLeft + width + padRight + (isHorizontalLayout ? theOffset + theSwatchSize.width : CPTFloat(0.0)) + theColumnMargin; } } // calculate row positions - CPTNumberArray computedRowHeights = self.rowHeightsThatFit; - NSUInteger rowCount = computedRowHeights.count; - CGFloat *actualRowHeights = malloc(sizeof(CGFloat) * rowCount); - CGFloat *rowPositions = malloc(sizeof(CGFloat) * rowCount); + CPTNumberArray *computedRowHeights = self.rowHeightsThatFit; + NSUInteger rowCount = computedRowHeights.count; + CGFloat *actualRowHeights = calloc(rowCount, sizeof(CGFloat)); + CGFloat *rowPositions = calloc(rowCount, sizeof(CGFloat)); rowPositions[rowCount - 1] = self.paddingBottom; CGFloat theRowMargin = self.rowMargin; CGFloat lastRowHeight = 0.0; @@ -542,7 +605,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context CGFloat height = [rowHeight cgFloatValue]; actualRowHeights[row] = height; if ( row < rowCount - 1 ) { - rowPositions[row] = rowPositions[row + 1] + padBottom + lastRowHeight + padTop + theRowMargin; + rowPositions[row] = rowPositions[row + 1] + padBottom + lastRowHeight + padTop + (isHorizontalLayout ? CPTFloat(0.0) : theOffset + theSwatchSize.height) + theRowMargin; } lastRowHeight = height; } @@ -564,17 +627,28 @@ -(void)renderAsVectorInContext:(CGContextRef)context NSUInteger row = legendEntry.row; NSUInteger col = legendEntry.column; - if ( ( (desiredRowCount == 0) || (row < desiredRowCount) ) && - ( (desiredColumnCount == 0) || (col < desiredColumnCount) ) ) { + if (((desiredRowCount == 0) || (row < desiredRowCount)) && + ((desiredColumnCount == 0) || (col < desiredColumnCount))) { NSUInteger entryIndex = legendEntry.index; CPTPlot *entryPlot = legendEntry.plot; CGFloat left = columnPositions[col]; CGFloat rowPosition = rowPositions[row]; - CGRect entryRect = CPTRectMake(left, - rowPosition, - padLeft + theSwatchSize.width + theOffset + actualColumnWidths[col] + CPTFloat(1.0) + padRight, - padBottom + actualRowHeights[row] + padTop); + + CGRect entryRect; + + if ( isHorizontalLayout ) { + entryRect = CPTRectMake(left, + rowPosition, + padLeft + theSwatchSize.width + theOffset + actualColumnWidths[col] + CPTFloat(1.0) + padRight, + padBottom + actualRowHeights[row] + padTop); + } + else { + entryRect = CPTRectMake(left, + rowPosition, + padLeft + MAX(theSwatchSize.width, actualColumnWidths[col]) + CPTFloat(1.0) + padRight, + padBottom + theSwatchSize.height + theOffset + actualRowHeights[row] + padTop); + } // draw background CPTFill *theFill = nil; @@ -604,19 +678,57 @@ -(void)renderAsVectorInContext:(CGContextRef)context [theLineStyle strokePathInContext:context]; } + // lay out swatch and title + CGFloat swatchLeft, swatchBottom; + CGFloat titleLeft, titleBottom; + + switch ( self.swatchLayout ) { + case CPTLegendSwatchLayoutLeft: + swatchLeft = CGRectGetMinX(entryRect) + padLeft; + swatchBottom = CGRectGetMinY(entryRect) + (entryRect.size.height - theSwatchSize.height) * CPTFloat(0.5); + + titleLeft = swatchLeft + theSwatchSize.width + theOffset; + titleBottom = CGRectGetMinY(entryRect) + padBottom; + break; + + case CPTLegendSwatchLayoutRight: + swatchLeft = CGRectGetMaxX(entryRect) - padRight - theSwatchSize.width; + swatchBottom = CGRectGetMinY(entryRect) + (entryRect.size.height - theSwatchSize.height) * CPTFloat(0.5); + + titleLeft = CGRectGetMinX(entryRect) + padLeft; + titleBottom = CGRectGetMinY(entryRect) + padBottom; + break; + + case CPTLegendSwatchLayoutTop: + swatchLeft = CGRectGetMidX(entryRect) - theSwatchSize.width * CPTFloat(0.5); + swatchBottom = CGRectGetMaxY(entryRect) - padTop - theSwatchSize.height; + + titleLeft = CGRectGetMidX(entryRect) - actualColumnWidths[col] * CPTFloat(0.5); + titleBottom = CGRectGetMinY(entryRect) + padBottom; + break; + + case CPTLegendSwatchLayoutBottom: + swatchLeft = CGRectGetMidX(entryRect) - theSwatchSize.width * CPTFloat(0.5); + swatchBottom = CGRectGetMinY(entryRect) + padBottom; + + titleLeft = CGRectGetMidX(entryRect) - actualColumnWidths[col] * CPTFloat(0.5); + titleBottom = swatchBottom + theOffset + theSwatchSize.height; + break; + } + // draw swatch - left += padLeft; - CGRect swatchRect = CPTRectMake(left, - rowPosition + (entryRect.size.height - theSwatchSize.height) * CPTFloat(0.5), + CGRect swatchRect = CPTRectMake(swatchLeft, + swatchBottom, theSwatchSize.width, theSwatchSize.height); + BOOL legendShouldDrawSwatch = YES; if ( delegateCanDraw ) { legendShouldDrawSwatch = [theDelegate legend:self - shouldDrawSwatchAtIndex:entryIndex - forPlot:entryPlot - inRect:swatchRect - inContext:context]; + shouldDrawSwatchAtIndex:entryIndex + forPlot:entryPlot + inRect:swatchRect + inContext:context]; } if ( legendShouldDrawSwatch ) { [entryPlot drawSwatchForLegend:self @@ -626,9 +738,12 @@ -(void)renderAsVectorInContext:(CGContextRef)context } // draw title - left += theSwatchSize.width + theOffset; + CGRect titleRect = CPTRectMake(titleLeft, + titleBottom, + actualColumnWidths[col] + CPTFloat(1.0), + actualRowHeights[row]); - [legendEntry drawTitleInRect:CPTAlignRectToUserSpace( context, CPTRectMake(left, rowPosition + padBottom, actualColumnWidths[col] + CPTFloat(1.0), actualRowHeights[row]) ) + [legendEntry drawTitleInRect:CPTAlignRectToUserSpace(context, titleRect) inContext:context scale:self.contentsScale]; } @@ -647,7 +762,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken = 0; @@ -692,6 +807,20 @@ -(void)recalculateLayout return; } + BOOL isHorizontalLayout; + + switch ( self.swatchLayout ) { + case CPTLegendSwatchLayoutLeft: + case CPTLegendSwatchLayoutRight: + isHorizontalLayout = YES; + break; + + case CPTLegendSwatchLayoutTop: + case CPTLegendSwatchLayoutBottom: + isHorizontalLayout = NO; + break; + } + // compute the number of rows and columns needed to hold the legend entries NSUInteger rowCount = self.numberOfRows; NSUInteger columnCount = self.numberOfColumns; @@ -699,8 +828,8 @@ -(void)recalculateLayout NSUInteger desiredColumnCount = columnCount; NSUInteger legendEntryCount = self.legendEntries.count; - if ( (rowCount == 0) && (columnCount == 0) ) { - rowCount = (NSUInteger)lrint( sqrt( (double)legendEntryCount ) ); + if ((rowCount == 0) && (columnCount == 0)) { + rowCount = (NSUInteger)lrint(sqrt((double)legendEntryCount)); columnCount = rowCount; if ( rowCount * columnCount < legendEntryCount ) { columnCount++; @@ -709,13 +838,13 @@ -(void)recalculateLayout rowCount++; } } - else if ( (rowCount == 0) && (columnCount > 0) ) { + else if ((rowCount == 0) && (columnCount > 0)) { rowCount = legendEntryCount / columnCount; if ( legendEntryCount % columnCount ) { rowCount++; } } - else if ( (rowCount > 0) && (columnCount == 0) ) { + else if ((rowCount > 0) && (columnCount == 0)) { columnCount = legendEntryCount / rowCount; if ( legendEntryCount % rowCount ) { columnCount++; @@ -723,38 +852,44 @@ -(void)recalculateLayout } // compute row heights and column widths - NSUInteger row = 0; - NSUInteger col = 0; - CGFloat *maxTitleHeight = calloc( rowCount, sizeof(CGFloat) ); - CGFloat *maxTitleWidth = calloc( columnCount, sizeof(CGFloat) ); - CGSize theSwatchSize = self.swatchSize; - CPTNumberArray desiredRowHeights = self.rowHeights; - CPTNumberArray desiredColumnWidths = self.columnWidths; - Class numberClass = [NSNumber class]; + NSUInteger row = 0; + NSUInteger col = 0; + CGFloat *maxTitleHeight = calloc(rowCount, sizeof(CGFloat)); + CGFloat *maxTitleWidth = calloc(columnCount, sizeof(CGFloat)); + CGSize theSwatchSize = self.swatchSize; + CPTNumberArray *desiredRowHeights = self.rowHeights; + CPTNumberArray *desiredColumnWidths = self.columnWidths; + Class numberClass = [NSNumber class]; for ( CPTLegendEntry *legendEntry in self.legendEntries ) { legendEntry.row = row; legendEntry.column = col; CGSize titleSize = legendEntry.titleSize; - if ( (desiredRowCount == 0) || (row < desiredRowCount) ) { - maxTitleHeight[row] = MAX(MAX(maxTitleHeight[row], titleSize.height), theSwatchSize.height); + if ((desiredRowCount == 0) || (row < desiredRowCount)) { + maxTitleHeight[row] = MAX(maxTitleHeight[row], titleSize.height); + if ( isHorizontalLayout ) { + maxTitleHeight[row] = MAX(maxTitleHeight[row], theSwatchSize.height); + } if ( row < desiredRowHeights.count ) { id desiredRowHeight = desiredRowHeights[row]; if ( [desiredRowHeight isKindOfClass:numberClass] ) { - maxTitleHeight[row] = MAX(maxTitleHeight[row], [(NSNumber *)desiredRowHeight cgFloatValue]); + maxTitleHeight[row] = MAX(maxTitleHeight[row], [(NSNumber *) desiredRowHeight cgFloatValue]); } } } - if ( (desiredColumnCount == 0) || (col < desiredColumnCount) ) { - maxTitleWidth[col] = MAX(MAX(maxTitleWidth[col], titleSize.width), theSwatchSize.width); + if ((desiredColumnCount == 0) || (col < desiredColumnCount)) { + maxTitleWidth[col] = MAX(maxTitleWidth[col], titleSize.width); + if ( !isHorizontalLayout ) { + maxTitleWidth[col] = MAX(maxTitleWidth[col], theSwatchSize.width); + } if ( col < desiredColumnWidths.count ) { id desiredColumnWidth = desiredColumnWidths[col]; if ( [desiredColumnWidth isKindOfClass:numberClass] ) { - maxTitleWidth[col] = MAX(maxTitleWidth[col], [(NSNumber *)desiredColumnWidth cgFloatValue]); + maxTitleWidth[col] = MAX(maxTitleWidth[col], [(NSNumber *) desiredColumnWidth cgFloatValue]); } } } @@ -770,13 +905,13 @@ -(void)recalculateLayout } // save row heights and column widths - CPTMutableNumberArray maxRowHeights = [[NSMutableArray alloc] initWithCapacity:rowCount]; + CPTMutableNumberArray *maxRowHeights = [[NSMutableArray alloc] initWithCapacity:rowCount]; for ( NSUInteger i = 0; i < rowCount; i++ ) { [maxRowHeights addObject:@(maxTitleHeight[i])]; } self.rowHeightsThatFit = maxRowHeights; - CPTMutableNumberArray maxColumnWidths = [[NSMutableArray alloc] initWithCapacity:columnCount]; + CPTMutableNumberArray *maxColumnWidths = [[NSMutableArray alloc] initWithCapacity:columnCount]; for ( NSUInteger i = 0; i < columnCount; i++ ) { [maxColumnWidths addObject:@(maxTitleWidth[i])]; } @@ -802,7 +937,10 @@ -(void)recalculateLayout } } if ( columnCount > 0 ) { - legendSize.width += ( (theSwatchSize.width + self.titleOffset + self.entryPaddingLeft + self.entryPaddingRight) * columnCount ) + ( self.columnMargin * (columnCount - 1) ); + legendSize.width += ((self.entryPaddingLeft + self.entryPaddingRight) * columnCount) + (self.columnMargin * (columnCount - 1)); + if ( isHorizontalLayout ) { + legendSize.width += (theSwatchSize.width + self.titleOffset) * columnCount; + } } NSUInteger rows = row; @@ -813,10 +951,13 @@ -(void)recalculateLayout legendSize.height += [height cgFloatValue]; } if ( rows > 0 ) { - legendSize.height += ( (self.entryPaddingBottom + self.entryPaddingTop) * rowCount ) + ( self.rowMargin * (rows - 1) ); + legendSize.height += ((self.entryPaddingBottom + self.entryPaddingTop) * rowCount) + (self.rowMargin * (rows - 1)); + if ( !isHorizontalLayout ) { + legendSize.height += (theSwatchSize.height + self.titleOffset) * rowCount; + } } - self.bounds = CPTRectMake( 0.0, 0.0, ceil(legendSize.width), ceil(legendSize.height) ); + self.bounds = CPTRectMake(0.0, 0.0, ceil(legendSize.width), ceil(legendSize.height)); [self pixelAlign]; self.layoutChanged = NO; @@ -830,7 +971,7 @@ -(void)recalculateLayout /** @brief All plots associated with the legend. * @return An array of all plots associated with the legend. **/ --(CPTPlotArray)allPlots +-(nonnull CPTPlotArray *)allPlots { return [NSArray arrayWithArray:self.plots]; } @@ -839,7 +980,7 @@ -(CPTPlotArray)allPlots * @param idx An index within the bounds of the plot array. * @return The plot at the given index. **/ --(CPTPlot *)plotAtIndex:(NSUInteger)idx +-(nullable CPTPlot *)plotAtIndex:(NSUInteger)idx { if ( idx < self.plots.count ) { return (self.plots)[idx]; @@ -853,10 +994,10 @@ -(CPTPlot *)plotAtIndex:(NSUInteger)idx * @param identifier A plot identifier. * @return The plot with the given identifier or nil if it was not found. **/ --(CPTPlot *)plotWithIdentifier:(id)identifier +-(nullable CPTPlot *)plotWithIdentifier:(nullable id)identifier { for ( CPTPlot *plot in self.plots ) { - if ( [[plot identifier] isEqual:identifier] ) { + if ( [plot.identifier isEqual:identifier] ) { return plot; } } @@ -869,15 +1010,15 @@ -(CPTPlot *)plotWithIdentifier:(id)identifier /** @brief Add a plot to the legend. * @param plot The plot. **/ --(void)addPlot:(CPTPlot *)plot +-(void)addPlot:(nonnull CPTPlot *)plot { if ( [plot isKindOfClass:[CPTPlot class]] ) { [self.plots addObject:plot]; self.layoutChanged = YES; - CPTMutableLegendEntryArray theLegendEntries = self.legendEntries; - CPTTextStyle *theTextStyle = self.textStyle; - NSUInteger numberOfLegendEntries = [plot numberOfLegendEntries]; + CPTMutableLegendEntryArray *theLegendEntries = self.legendEntries; + CPTTextStyle *theTextStyle = self.textStyle; + NSUInteger numberOfLegendEntries = [plot numberOfLegendEntries]; for ( NSUInteger i = 0; i < numberOfLegendEntries; i++ ) { NSString *newTitle = [plot titleForLegendEntryAtIndex:i]; if ( newTitle ) { @@ -898,14 +1039,14 @@ -(void)addPlot:(CPTPlot *)plot * @param plot The plot. * @param idx An index within the bounds of the plot array. **/ --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx +-(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx { if ( [plot isKindOfClass:[CPTPlot class]] ) { - CPTMutablePlotArray thePlots = self.plots; + CPTMutablePlotArray *thePlots = self.plots; NSAssert(idx <= thePlots.count, @"index greater than the number of plots"); - CPTMutableLegendEntryArray theLegendEntries = self.legendEntries; - NSUInteger legendEntryIndex = 0; + CPTMutableLegendEntryArray *theLegendEntries = self.legendEntries; + NSUInteger legendEntryIndex = 0; if ( idx == thePlots.count ) { legendEntryIndex = theLegendEntries.count; } @@ -943,7 +1084,7 @@ -(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx /** @brief Remove a plot from the legend. * @param plot The plot to remove. **/ --(void)removePlot:(CPTPlot *)plot +-(void)removePlot:(nonnull CPTPlot *)plot { if ( [self.plots containsObject:plot] ) { [self.plots removeObjectIdenticalTo:plot]; @@ -961,7 +1102,7 @@ -(void)removePlot:(CPTPlot *)plot /** @brief Remove a plot from the legend. * @param identifier The identifier of the plot to remove. **/ --(void)removePlotWithIdentifier:(id)identifier +-(void)removePlotWithIdentifier:(nullable id)identifier { CPTPlot *plotToRemove = [self plotWithIdentifier:identifier]; @@ -981,10 +1122,10 @@ -(void)removePlotWithIdentifier:(id)identifier * @brief Remove all legend entries for the given plot from the legend. * @param plot The plot. **/ --(void)removeLegendEntriesForPlot:(CPTPlot *)plot +-(void)removeLegendEntriesForPlot:(nonnull CPTPlot *)plot { - CPTMutableLegendEntryArray theLegendEntries = self.legendEntries; - CPTMutableLegendEntryArray entriesToRemove = [[NSMutableArray alloc] init]; + CPTMutableLegendEntryArray *theLegendEntries = self.legendEntries; + CPTMutableLegendEntryArray *entriesToRemove = [[NSMutableArray alloc] init]; for ( CPTLegendEntry *legendEntry in theLegendEntries ) { if ( legendEntry.plot == plot ) { @@ -1001,22 +1142,22 @@ -(void)removeLegendEntriesForPlot:(CPTPlot *)plot /// @cond --(void)legendNeedsRedraw:(NSNotification *)notif +-(void)legendNeedsRedraw:(nonnull NSNotification *__unused)notif { [self setNeedsDisplay]; } --(void)legendNeedsLayout:(NSNotification *)notif +-(void)legendNeedsLayout:(nonnull NSNotification *__unused)notif { self.layoutChanged = YES; [self setNeedsDisplay]; } --(void)legendNeedsReloadEntries:(NSNotification *)notif +-(void)legendNeedsReloadEntries:(nonnull NSNotification *)notif { CPTPlot *thePlot = (CPTPlot *)notif.object; - CPTMutableLegendEntryArray theLegendEntries = self.legendEntries; + CPTMutableLegendEntryArray *theLegendEntries = self.legendEntries; NSUInteger legendEntryIndex = 0; @@ -1051,7 +1192,7 @@ -(void)legendNeedsReloadEntries:(NSNotification *)notif /// @cond --(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(NSUInteger *)row col:(NSUInteger *)col +-(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(nonnull NSUInteger *)row col:(nonnull NSUInteger *)col { // Convert the interaction point to the local coordinate system CPTGraph *theGraph = self.graph; @@ -1089,7 +1230,7 @@ -(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(NSUInteger for ( NSNumber *height in self.rowHeightsThatFit ) { CGFloat rowHeight = height.cgFloatValue + padVertical; - if ( (interactionPoint.y <= position) && (interactionPoint.y >= position - rowHeight) ) { + if ((interactionPoint.y <= position) && (interactionPoint.y >= position - rowHeight)) { *row = i; break; } @@ -1105,7 +1246,7 @@ -(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(NSUInteger for ( NSNumber *width in self.columnWidthsThatFit ) { CGFloat colWidth = width.cgFloatValue + swatchWidth + padHorizontal; - if ( (interactionPoint.x >= position) && (interactionPoint.x <= position + colWidth) ) { + if ((interactionPoint.x >= position) && (interactionPoint.x <= position + colWidth)) { *col = i; break; } @@ -1137,13 +1278,13 @@ -(void)legendEntryForInteractionPoint:(CGPoint)interactionPoint row:(NSUInteger * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { - if ( self.hidden || (self.plots.count == 0) ) { + if ( self.hidden || (self.plots.count == 0)) { 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:)] || @@ -1153,9 +1294,9 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact [self legendEntryForInteractionPoint:interactionPoint row:&row col:&col]; // Notify the delegate if we found a hit - if ( (row != NSNotFound) && (col != NSNotFound) ) { + if ((row != NSNotFound) && (col != NSNotFound)) { for ( CPTLegendEntry *legendEntry in self.legendEntries ) { - if ( (legendEntry.row == row) && (legendEntry.column == col) ) { + if ((legendEntry.row == row) && (legendEntry.column == col)) { self.pointingDeviceDownEntry = legendEntry; CPTPlot *legendPlot = legendEntry.plot; @@ -1204,17 +1345,17 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTLegendEntry *selectedDownEntry = self.pointingDeviceDownEntry; self.pointingDeviceDownEntry = nil; - if ( self.hidden || (self.plots.count == 0) ) { + if ( self.hidden || (self.plots.count == 0)) { 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:)] || @@ -1224,9 +1365,9 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio [self legendEntryForInteractionPoint:interactionPoint row:&row col:&col]; // Notify the delegate if we found a hit - if ( (row != NSNotFound) && (col != NSNotFound) ) { + if ((row != NSNotFound) && (col != NSNotFound)) { for ( CPTLegendEntry *legendEntry in self.legendEntries ) { - if ( (legendEntry.row == row) && (legendEntry.column == col) ) { + if ((legendEntry.row == row) && (legendEntry.column == col)) { BOOL handled = NO; CPTPlot *entryPlot = legendEntry.plot; @@ -1270,9 +1411,9 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio /// @cond --(NSString *)description +-(nullable NSString *)description { - return [NSString stringWithFormat:@"<%@ for plots %@>", [super description], self.plots]; + return [NSString stringWithFormat:@"<%@ for plots %@>", super.description, self.plots]; } /// @endcond @@ -1282,7 +1423,7 @@ -(NSString *)description /// @cond --(void)setTextStyle:(CPTTextStyle *)newTextStyle +-(void)setTextStyle:(nullable CPTTextStyle *)newTextStyle { if ( newTextStyle != textStyle ) { textStyle = [newTextStyle copy]; @@ -1293,7 +1434,7 @@ -(void)setTextStyle:(CPTTextStyle *)newTextStyle -(void)setSwatchSize:(CGSize)newSwatchSize { - if ( !CGSizeEqualToSize(newSwatchSize, swatchSize) ) { + if ( !CGSizeEqualToSize(newSwatchSize, swatchSize)) { swatchSize = newSwatchSize; self.layoutChanged = YES; } @@ -1303,10 +1444,10 @@ -(CGSize)swatchSize { CGSize theSwatchSize = swatchSize; - if ( CGSizeEqualToSize(theSwatchSize, CGSizeZero) ) { + if ( CGSizeEqualToSize(theSwatchSize, CGSizeZero)) { CPTTextStyle *theTextStyle = self.textStyle; CGFloat fontSize = theTextStyle.fontSize; - if ( fontSize > 0.0 ) { + if ( fontSize > CPTFloat(0.0)) { fontSize *= CPTFloat(1.5); fontSize = round(fontSize); theSwatchSize = CPTSizeMake(fontSize, fontSize); @@ -1318,7 +1459,7 @@ -(CGSize)swatchSize return theSwatchSize; } --(void)setSwatchBorderLineStyle:(CPTLineStyle *)newSwatchBorderLineStyle +-(void)setSwatchBorderLineStyle:(nullable CPTLineStyle *)newSwatchBorderLineStyle { if ( newSwatchBorderLineStyle != swatchBorderLineStyle ) { swatchBorderLineStyle = [newSwatchBorderLineStyle copy]; @@ -1334,7 +1475,7 @@ -(void)setSwatchCornerRadius:(CGFloat)newSwatchCornerRadius } } --(void)setSwatchFill:(CPTFill *)newSwatchFill +-(void)setSwatchFill:(nullable CPTFill *)newSwatchFill { if ( newSwatchFill != swatchFill ) { swatchFill = [newSwatchFill copy]; @@ -1342,7 +1483,7 @@ -(void)setSwatchFill:(CPTFill *)newSwatchFill } } --(void)setEntryBorderLineStyle:(CPTLineStyle *)newEntryBorderLineStyle +-(void)setEntryBorderLineStyle:(nullable CPTLineStyle *)newEntryBorderLineStyle { if ( newEntryBorderLineStyle != entryBorderLineStyle ) { entryBorderLineStyle = [newEntryBorderLineStyle copy]; @@ -1358,7 +1499,7 @@ -(void)setEntryCornerRadius:(CGFloat)newEntryCornerRadius } } --(void)setEntryFill:(CPTFill *)newEntryFill +-(void)setEntryFill:(nullable CPTFill *)newEntryFill { if ( newEntryFill != entryFill ) { entryFill = [newEntryFill copy]; @@ -1430,7 +1571,7 @@ -(void)setEqualColumns:(BOOL)newEqualColumns } } --(void)setRowHeights:(CPTNumberArray)newRowHeights +-(void)setRowHeights:(nullable CPTNumberArray *)newRowHeights { if ( newRowHeights != rowHeights ) { rowHeights = [newRowHeights copy]; @@ -1438,7 +1579,7 @@ -(void)setRowHeights:(CPTNumberArray)newRowHeights } } --(void)setColumnWidths:(CPTNumberArray)newColumnWidths +-(void)setColumnWidths:(nullable CPTNumberArray *)newColumnWidths { if ( newColumnWidths != columnWidths ) { columnWidths = [newColumnWidths copy]; @@ -1470,6 +1611,14 @@ -(void)setTitleOffset:(CGFloat)newTitleOffset } } +-(void)setSwatchLayout:(CPTLegendSwatchLayout)newSwatchLayout +{ + if ( newSwatchLayout != swatchLayout ) { + swatchLayout = newSwatchLayout; + self.layoutChanged = YES; + } +} + -(void)setLayoutChanged:(BOOL)newLayoutChanged { if ( newLayoutChanged != layoutChanged ) { @@ -1485,7 +1634,7 @@ -(void)setLayoutChanged:(BOOL)newLayoutChanged -(void)setPaddingLeft:(CGFloat)newPadding { if ( newPadding != self.paddingLeft ) { - [super setPaddingLeft:newPadding]; + super.paddingLeft = newPadding; self.layoutChanged = YES; } } @@ -1493,7 +1642,7 @@ -(void)setPaddingLeft:(CGFloat)newPadding -(void)setPaddingTop:(CGFloat)newPadding { if ( newPadding != self.paddingTop ) { - [super setPaddingTop:newPadding]; + super.paddingTop = newPadding; self.layoutChanged = YES; } } @@ -1501,7 +1650,7 @@ -(void)setPaddingTop:(CGFloat)newPadding -(void)setPaddingRight:(CGFloat)newPadding { if ( newPadding != self.paddingRight ) { - [super setPaddingRight:newPadding]; + super.paddingRight = newPadding; self.layoutChanged = YES; } } @@ -1509,17 +1658,17 @@ -(void)setPaddingRight:(CGFloat)newPadding -(void)setPaddingBottom:(CGFloat)newPadding { if ( newPadding != self.paddingBottom ) { - [super setPaddingBottom:newPadding]; - self.layoutChanged = YES; + super.paddingBottom = newPadding; + self.layoutChanged = YES; } } --(void)setBorderLineStyle:(CPTLineStyle *)newLineStyle +-(void)setBorderLineStyle:(nullable CPTLineStyle *)newLineStyle { CPTLineStyle *oldLineStyle = self.borderLineStyle; if ( newLineStyle != oldLineStyle ) { - [super setBorderLineStyle:newLineStyle]; + super.borderLineStyle = newLineStyle; if ( newLineStyle.lineWidth != oldLineStyle.lineWidth ) { self.layoutChanged = YES; @@ -1527,7 +1676,7 @@ -(void)setBorderLineStyle:(CPTLineStyle *)newLineStyle } } --(CPTNumberArray)rowHeightsThatFit +-(nullable CPTNumberArray *)rowHeightsThatFit { if ( !rowHeightsThatFit ) { [self recalculateLayout]; @@ -1535,7 +1684,7 @@ -(CPTNumberArray)rowHeightsThatFit return rowHeightsThatFit; } --(CPTNumberArray)columnWidthsThatFit +-(nullable CPTNumberArray *)columnWidthsThatFit { if ( !columnWidthsThatFit ) { [self recalculateLayout]; diff --git a/framework/Source/CPTLegendEntry.h b/framework/Source/CPTLegendEntry.h index f9fbe5d90..ce7af2388 100644 --- a/framework/Source/CPTLegendEntry.h +++ b/framework/Source/CPTLegendEntry.h @@ -9,18 +9,18 @@ /** * @brief An array of CPTLegendEntry objects. **/ -typedef NSArray *CPTLegendEntryArray; +typedef NSArray CPTLegendEntryArray; /** * @brief A mutable array of CPTLegendEntry objects. **/ -typedef NSMutableArray *CPTMutableLegendEntryArray; +typedef NSMutableArray CPTMutableLegendEntryArray; -@interface CPTLegendEntry : NSObject +@interface CPTLegendEntry : NSObject /// @name Plot Info /// @{ -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTPlot *plot; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTPlot *plot; @property (nonatomic, readwrite, assign) NSUInteger index; /// @} diff --git a/framework/Source/CPTLegendEntry.m b/framework/Source/CPTLegendEntry.m index 380a885a8..02f5bc365 100644 --- a/framework/Source/CPTLegendEntry.m +++ b/framework/Source/CPTLegendEntry.m @@ -9,8 +9,8 @@ /// @cond @interface CPTLegendEntry() -@property (nonatomic, readonly) NSString *title; -@property (nonatomic, readonly) NSAttributedString *attributedTitle; +@property (nonatomic, readonly, nullable) NSString *title; +@property (nonatomic, readonly, nullable) NSAttributedString *attributedTitle; @end @@ -23,7 +23,7 @@ @interface CPTLegendEntry() **/ @implementation CPTLegendEntry -/** @property cpt_weak CPTPlot *plot +/** @property nullable CPTPlot *plot * @brief The plot associated with this legend entry. **/ @synthesize plot; @@ -45,14 +45,19 @@ @implementation CPTLegendEntry /// @cond -/** @property NSString *title +/** @property nullable NSString *title * @brief The legend entry title. **/ @dynamic title; +/** @property nullable NSAttributedString *attributedTitle + * @brief The legend entry attributed title. + **/ +@dynamic attributedTitle; + /// @endcond -/** @property CPTTextStyle *textStyle +/** @property nullable CPTTextStyle *textStyle * @brief The text style used to draw the legend entry title. **/ @synthesize textStyle; @@ -79,9 +84,9 @@ @implementation CPTLegendEntry * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { plot = nil; index = 0; row = 0; @@ -98,7 +103,7 @@ -(instancetype)init /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeConditionalObject:self.plot forKey:@"CPTLegendEntry.plot"]; [coder encodeInteger:(NSInteger)self.index forKey:@"CPTLegendEntry.index"]; @@ -107,20 +112,34 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeObject:self.textStyle forKey:@"CPTLegendEntry.textStyle"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - plot = [coder decodeObjectForKey:@"CPTLegendEntry.plot"]; - index = (NSUInteger)[coder decodeIntegerForKey : @"CPTLegendEntry.index"]; - row = (NSUInteger)[coder decodeIntegerForKey : @"CPTLegendEntry.row"]; - column = (NSUInteger)[coder decodeIntegerForKey : @"CPTLegendEntry.column"]; - textStyle = [coder decodeObjectForKey:@"CPTLegendEntry.textStyle"]; + if ((self = [super init])) { + plot = [coder decodeObjectOfClass:[CPTPlot class] + forKey:@"CPTLegendEntry.plot"]; + index = (NSUInteger)[coder decodeIntegerForKey:@"CPTLegendEntry.index"]; + row = (NSUInteger)[coder decodeIntegerForKey:@"CPTLegendEntry.row"]; + column = (NSUInteger)[coder decodeIntegerForKey:@"CPTLegendEntry.column"]; + textStyle = [coder decodeObjectOfClass:[CPTTextStyle class] + forKey:@"CPTLegendEntry.textStyle"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing @@ -129,20 +148,20 @@ -(instancetype)initWithCoder:(NSCoder *)coder * @param context The graphics context to draw into. * @param scale The drawing scale factor. Must be greater than zero (@num{0}). **/ --(void)drawTitleInRect:(CGRect)rect inContext:(CGContextRef)context scale:(CGFloat)scale +-(void)drawTitleInRect:(CGRect)rect inContext:(nonnull CGContextRef)context scale:(CGFloat)scale { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGContextSaveGState(context); CGContextTranslateCTM(context, CPTFloat(0.0), rect.origin.y); - CGContextScaleCTM( context, CPTFloat(1.0), CPTFloat(-1.0) ); - CGContextTranslateCTM( context, CPTFloat(0.0), -CGRectGetMaxY(rect) ); + CGContextScaleCTM(context, CPTFloat(1.0), CPTFloat(-1.0)); + CGContextTranslateCTM(context, CPTFloat(0.0), -CGRectGetMaxY(rect)); #endif // center the title vertically CGRect textRect = rect; CGSize theTitleSize = self.titleSize; if ( theTitleSize.height < textRect.size.height ) { CGFloat offset = (textRect.size.height - theTitleSize.height) / CPTFloat(2.0); - if ( scale == 1.0 ) { + if ( scale == CPTFloat(1.0)) { offset = round(offset); } else { @@ -154,7 +173,7 @@ -(void)drawTitleInRect:(CGRect)rect inContext:(CGContextRef)context scale:(CGFlo NSAttributedString *styledTitle = self.attributedTitle; - if ( (styledTitle.length > 0) && [styledTitle respondsToSelector:@selector(drawInRect:)] ) { + if ((styledTitle.length > 0) && [styledTitle respondsToSelector:@selector(drawInRect:)] ) { [styledTitle drawInRect:textRect inContext:context]; } @@ -170,7 +189,7 @@ -(void)drawTitleInRect:(CGRect)rect inContext:(CGContextRef)context scale:(CGFlo inContext:context]; } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGContextRestoreGState(context); #endif } @@ -180,14 +199,14 @@ -(void)drawTitleInRect:(CGRect)rect inContext:(CGContextRef)context scale:(CGFlo /// @cond --(NSString *)title +-(nullable NSString *)title { CPTPlot *thePlot = self.plot; return [thePlot titleForLegendEntryAtIndex:self.index]; } --(NSAttributedString *)attributedTitle +-(nullable NSAttributedString *)attributedTitle { CPTPlot *thePlot = self.plot; @@ -200,12 +219,8 @@ -(CGSize)titleSize NSAttributedString *styledTitle = self.attributedTitle; - if ( (styledTitle.length > 0) && [styledTitle respondsToSelector:@selector(size)] ) { -#if TARGET_IPHONE_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/CPTLimitBand.h b/framework/Source/CPTLimitBand.h index dcda555e5..e4c7700a3 100644 --- a/framework/Source/CPTLimitBand.h +++ b/framework/Source/CPTLimitBand.h @@ -7,14 +7,14 @@ /** * @brief An array of limit bands. **/ -typedef NSArray *CPTLimitBandArray; +typedef NSArray CPTLimitBandArray; /** * @brief A mutable array of limit bands. **/ -typedef NSMutableArray *CPTMutableLimitBandArray; +typedef NSMutableArray CPTMutableLimitBandArray; -@interface CPTLimitBand : NSObject +@interface CPTLimitBand : NSObject @property (nonatomic, readwrite, strong, nullable) CPTPlotRange *range; @property (nonatomic, readwrite, strong, nullable) CPTFill *fill; @@ -27,7 +27,7 @@ typedef NSMutableArray *CPTMutableLimitBandArray; /// @name Initialization /// @{ -(nonnull instancetype)initWithRange:(nullable CPTPlotRange *)newRange fill:(nullable CPTFill *)newFill NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} @end diff --git a/framework/Source/CPTLimitBand.m b/framework/Source/CPTLimitBand.m index 5e4a17017..2f75847c5 100644 --- a/framework/Source/CPTLimitBand.m +++ b/framework/Source/CPTLimitBand.m @@ -8,12 +8,12 @@ **/ @implementation CPTLimitBand -/** @property CPTPlotRange *range +/** @property nullable CPTPlotRange *range * @brief The data range for the band. **/ @synthesize range; -/** @property CPTFill *fill +/** @property nullable CPTFill *fill * @brief The fill used to draw the band. **/ @synthesize fill; @@ -26,9 +26,9 @@ @implementation CPTLimitBand * @param newFill The fill used to draw the interior of the band. * @return A new CPTLimitBand instance initialized with the provided range and fill. **/ -+(instancetype)limitBandWithRange:(CPTPlotRange *)newRange fill:(CPTFill *)newFill ++(nonnull instancetype)limitBandWithRange:(nullable CPTPlotRange *)newRange fill:(nullable CPTFill *)newFill { - return [[CPTLimitBand alloc] initWithRange:newRange fill:newFill]; + return [[self alloc] initWithRange:newRange fill:newFill]; } /** @brief Initializes a newly allocated CPTLimitBand object with the provided range and fill. @@ -36,9 +36,9 @@ +(instancetype)limitBandWithRange:(CPTPlotRange *)newRange fill:(CPTFill *)newFi * @param newFill The fill used to draw the interior of the band. * @return The initialized CPTLimitBand object. **/ --(instancetype)initWithRange:(CPTPlotRange *)newRange fill:(CPTFill *)newFill +-(nonnull instancetype)initWithRange:(nullable CPTPlotRange *)newRange fill:(nullable CPTFill *)newFill { - if ( (self = [super init]) ) { + if ((self = [super init])) { range = newRange; fill = newFill; } @@ -47,7 +47,7 @@ -(instancetype)initWithRange:(CPTPlotRange *)newRange fill:(CPTFill *)newFill /// @cond --(instancetype)init +-(nonnull instancetype)init { return [self initWithRange:nil fill:nil]; } @@ -59,7 +59,7 @@ -(instancetype)init /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTLimitBand *newBand = [[CPTLimitBand allocWithZone:zone] init]; @@ -77,16 +77,10 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(void)encodeWithCoder:(NSCoder *)encoder +-(void)encodeWithCoder:(nonnull NSCoder *)encoder { - if ( [encoder allowsKeyedCoding] ) { - [encoder encodeObject:self.range forKey:@"CPTLimitBand.range"]; - [encoder encodeObject:self.fill forKey:@"CPTLimitBand.fill"]; - } - else { - [encoder encodeObject:self.range]; - [encoder encodeObject:self.fill]; - } + [encoder encodeObject:self.range forKey:@"CPTLimitBand.range"]; + [encoder encodeObject:self.fill forKey:@"CPTLimitBand.fill"]; } /// @endcond @@ -95,29 +89,37 @@ -(void)encodeWithCoder:(NSCoder *)encoder * @param decoder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)decoder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder { - if ( (self = [super init]) ) { - if ( [decoder allowsKeyedCoding] ) { - range = [decoder decodeObjectForKey:@"CPTLimitBand.range"]; - fill = [decoder decodeObjectForKey:@"CPTLimitBand.fill"]; - } - else { - range = [decoder decodeObject]; - fill = [decoder decodeObject]; - } + if ((self = [super init])) { + range = [decoder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTLimitBand.range"]; + fill = [decoder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTLimitBand.fill"]; } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Description /// @cond --(NSString *)description +-(nullable NSString *)description { - return [NSString stringWithFormat:@"<%@ with range: %@ and fill: %@>", [super description], self.range, self.fill]; + return [NSString stringWithFormat:@"<%@ with range: %@ and fill: %@>", super.description, self.range, self.fill]; } /// @endcond diff --git a/framework/Source/CPTLineCap.h b/framework/Source/CPTLineCap.h index b1ab81115..e6c0605ac 100644 --- a/framework/Source/CPTLineCap.h +++ b/framework/Source/CPTLineCap.h @@ -22,7 +22,7 @@ typedef NS_ENUM (NSInteger, CPTLineCapType) { CPTLineCapTypeCustom ///< Custom line cap. }; -@interface CPTLineCap : NSObject +@interface CPTLineCap : NSObject @property (nonatomic, readwrite, assign) CGSize size; @property (nonatomic, readwrite, assign) CPTLineCapType lineCapType; diff --git a/framework/Source/CPTLineCap.m b/framework/Source/CPTLineCap.m index 2c36f0bde..5350d1149 100644 --- a/framework/Source/CPTLineCap.m +++ b/framework/Source/CPTLineCap.m @@ -35,19 +35,19 @@ @implementation CPTLineCap **/ @synthesize lineCapType; -/** @property CPTLineStyle *lineStyle +/** @property nullable CPTLineStyle *lineStyle * @brief The line style for the border of the line cap. * If @nil, the border is not drawn. **/ @synthesize lineStyle; -/** @property CPTFill *fill +/** @property nullable CPTFill *fill * @brief The fill for the interior of the line cap. * If @nil, the symbol is not filled. **/ @synthesize fill; -/** @property CGPathRef customLineCapPath +/** @property nullable CGPathRef customLineCapPath * @brief The drawing path for a custom line cap. It will be scaled to size before being drawn. **/ @synthesize customLineCapPath; @@ -78,9 +78,9 @@ @implementation CPTLineCap * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { size = CPTSizeMake(5.0, 5.0); lineCapType = CPTLineCapTypeNone; lineStyle = [[CPTLineStyle alloc] init]; @@ -109,7 +109,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeCPTSize:self.size forKey:@"CPTLineCap.size"]; [coder encodeInteger:self.lineCapType forKey:@"CPTLineCap.lineCapType"]; @@ -122,13 +122,15 @@ -(void)encodeWithCoder:(NSCoder *)coder // cachedLineCapPath } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - size = [coder decodeCPTSizeForKey:@"CPTLineCap.size"]; - lineCapType = (CPTLineCapType)[coder decodeIntegerForKey : @"CPTLineCap.lineCapType"]; - lineStyle = [coder decodeObjectForKey:@"CPTLineCap.lineStyle"]; - fill = [coder decodeObjectForKey:@"CPTLineCap.fill"]; + if ((self = [super init])) { + size = [coder decodeCPTSizeForKey:@"CPTLineCap.size"]; + lineCapType = (CPTLineCapType)[coder decodeIntegerForKey:@"CPTLineCap.lineCapType"]; + lineStyle = [coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTLineCap.lineStyle"]; + fill = [coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTLineCap.fill"]; customLineCapPath = [coder newCGPathDecodeForKey:@"CPTLineCap.customLineCapPath"]; usesEvenOddClipRule = [coder decodeBoolForKey:@"CPTLineCap.usesEvenOddClipRule"]; @@ -139,6 +141,18 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Accessors @@ -146,7 +160,7 @@ -(instancetype)initWithCoder:(NSCoder *)coder -(void)setSize:(CGSize)newSize { - if ( !CGSizeEqualToSize(newSize, size) ) { + if ( !CGSizeEqualToSize(newSize, size)) { size = newSize; self.cachedLineCapPath = NULL; } @@ -160,7 +174,7 @@ -(void)setLineCapType:(CPTLineCapType)newType } } --(void)setCustomLineCapPath:(CGPathRef)newPath +-(void)setCustomLineCapPath:(nullable CGPathRef)newPath { if ( customLineCapPath != newPath ) { CGPathRelease(customLineCapPath); @@ -169,7 +183,7 @@ -(void)setCustomLineCapPath:(CGPathRef)newPath } } --(CGPathRef)cachedLineCapPath +-(nullable CGPathRef)cachedLineCapPath { if ( !cachedLineCapPath ) { cachedLineCapPath = [self newLineCapPath]; @@ -177,7 +191,7 @@ -(CGPathRef)cachedLineCapPath return cachedLineCapPath; } --(void)setCachedLineCapPath:(CGPathRef)newPath +-(void)setCachedLineCapPath:(nullable CGPathRef)newPath { if ( cachedLineCapPath != newPath ) { CGPathRelease(cachedLineCapPath); @@ -193,7 +207,7 @@ -(void)setCachedLineCapPath:(CGPathRef)newPath /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeNone. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeNone. **/ -+(instancetype)lineCap ++(nonnull instancetype)lineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -205,7 +219,7 @@ +(instancetype)lineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeOpenArrow. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeOpenArrow. **/ -+(instancetype)openArrowPlotLineCap ++(nonnull instancetype)openArrowPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -217,7 +231,7 @@ +(instancetype)openArrowPlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeSolidArrow. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeSolidArrow. **/ -+(instancetype)solidArrowPlotLineCap ++(nonnull instancetype)solidArrowPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -229,7 +243,7 @@ +(instancetype)solidArrowPlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeSweptArrow. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeSweptArrow. **/ -+(instancetype)sweptArrowPlotLineCap ++(nonnull instancetype)sweptArrowPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -241,7 +255,7 @@ +(instancetype)sweptArrowPlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeRectangle. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeRectangle. **/ -+(instancetype)rectanglePlotLineCap ++(nonnull instancetype)rectanglePlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -253,7 +267,7 @@ +(instancetype)rectanglePlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeEllipse. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeEllipse. **/ -+(instancetype)ellipsePlotLineCap ++(nonnull instancetype)ellipsePlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -265,7 +279,7 @@ +(instancetype)ellipsePlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeDiamond. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeDiamond. **/ -+(instancetype)diamondPlotLineCap ++(nonnull instancetype)diamondPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -277,7 +291,7 @@ +(instancetype)diamondPlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypePentagon. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypePentagon. **/ -+(instancetype)pentagonPlotLineCap ++(nonnull instancetype)pentagonPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -289,7 +303,7 @@ +(instancetype)pentagonPlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeHexagon. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeHexagon. **/ -+(instancetype)hexagonPlotLineCap ++(nonnull instancetype)hexagonPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -301,7 +315,7 @@ +(instancetype)hexagonPlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeBar. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeBar. **/ -+(instancetype)barPlotLineCap ++(nonnull instancetype)barPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -313,7 +327,7 @@ +(instancetype)barPlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeCross. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeCross. **/ -+(instancetype)crossPlotLineCap ++(nonnull instancetype)crossPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -325,7 +339,7 @@ +(instancetype)crossPlotLineCap /** @brief Creates and returns a new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeSnow. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeSnow. **/ -+(instancetype)snowPlotLineCap ++(nonnull instancetype)snowPlotLineCap { CPTLineCap *lineCap = [[self alloc] init]; @@ -338,7 +352,7 @@ +(instancetype)snowPlotLineCap * @param aPath The bounding path for the custom line cap. * @return A new CPTLineCap instance initialized with a line cap type of #CPTLineCapTypeCustom. **/ -+(instancetype)customLineCapWithPath:(CGPathRef)aPath ++(nonnull instancetype)customLineCapWithPath:(nullable CGPathRef)aPath { CPTLineCap *lineCap = [[self alloc] init]; @@ -353,7 +367,7 @@ +(instancetype)customLineCapWithPath:(CGPathRef)aPath /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTLineCap *copy = [[[self class] allocWithZone:zone] init]; @@ -382,7 +396,7 @@ -(id)copyWithZone:(NSZone *)zone * @param center The center point of the line cap. * @param direction The direction the line is pointing. **/ --(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center inDirection:(CGPoint)direction +-(void)renderAsVectorInContext:(nonnull CGContextRef)context atPoint:(CGPoint)center inDirection:(CGPoint)direction { CGPathRef theLineCapPath = self.cachedLineCapPath; @@ -417,16 +431,16 @@ -(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center inD if ( theLineStyle || theFill ) { CGContextSaveGState(context); CGContextTranslateCTM(context, center.x, center.y); - CGContextRotateCTM( context, atan2(direction.y, direction.x) - CPTFloat(M_PI_2) ); // standard symbol points up + CGContextRotateCTM(context, atan2(direction.y, direction.x) - CPTFloat(M_PI_2)); // standard symbol points up if ( theFill ) { // use fillRect instead of fillPath so that images and gradients are properly centered in the symbol CGSize symbolSize = self.size; - CGSize halfSize = CPTSizeMake( symbolSize.width / CPTFloat(2.0), symbolSize.height / CPTFloat(2.0) ); + CGSize halfSize = CPTSizeMake(symbolSize.width / CPTFloat(2.0), symbolSize.height / CPTFloat(2.0)); CGRect bounds = CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height); CGContextSaveGState(context); - if ( !CGPathIsEmpty(theLineCapPath) ) { + if ( !CGPathIsEmpty(theLineCapPath)) { CGContextBeginPath(context); CGContextAddPath(context, theLineCapPath); if ( self.usesEvenOddClipRule ) { @@ -462,11 +476,11 @@ -(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center inD * The path is standardized for a line direction of @quote{up}. * @return A path describing the outline of the current line cap type. **/ --(CGPathRef)newLineCapPath +-(nonnull CGPathRef)newLineCapPath { CGFloat dx, dy; CGSize lineCapSize = self.size; - CGSize halfSize = CPTSizeMake( lineCapSize.width / CPTFloat(2.0), lineCapSize.height / CPTFloat(2.0) ); + CGSize halfSize = CPTSizeMake(lineCapSize.width / CPTFloat(2.0), lineCapSize.height / CPTFloat(2.0)); CGMutablePathRef lineCapPath = CGPathCreateMutable(); @@ -477,47 +491,47 @@ -(CGPathRef)newLineCapPath case CPTLineCapTypeOpenArrow: CGPathMoveToPoint(lineCapPath, NULL, -halfSize.width, -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0)); CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width, -halfSize.height); break; case CPTLineCapTypeSolidArrow: CGPathMoveToPoint(lineCapPath, NULL, -halfSize.width, -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0)); CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width, -halfSize.height); CGPathCloseSubpath(lineCapPath); break; case CPTLineCapTypeSweptArrow: CGPathMoveToPoint(lineCapPath, NULL, -halfSize.width, -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), CPTFloat(0.0)); CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width, -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, CPTFloat(0.0), -lineCapSize.height * CPTFloat(0.375) ); + CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), -lineCapSize.height * CPTFloat(0.375)); CGPathCloseSubpath(lineCapPath); break; case CPTLineCapTypeRectangle: - CGPathAddRect( lineCapPath, NULL, CPTRectMake( -halfSize.width, -halfSize.height, halfSize.width * CPTFloat(2.0), halfSize.height * CPTFloat(2.0) ) ); + CGPathAddRect(lineCapPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, halfSize.width * CPTFloat(2.0), halfSize.height * CPTFloat(2.0))); break; case CPTLineCapTypeEllipse: - CGPathAddEllipseInRect( lineCapPath, NULL, CPTRectMake( -halfSize.width, -halfSize.height, halfSize.width * CPTFloat(2.0), halfSize.height * CPTFloat(2.0) ) ); + CGPathAddEllipseInRect(lineCapPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, halfSize.width * CPTFloat(2.0), halfSize.height * CPTFloat(2.0))); break; case CPTLineCapTypeDiamond: CGPathMoveToPoint(lineCapPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, halfSize.width, CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width, CPTFloat(0.0)); CGPathAddLineToPoint(lineCapPath, NULL, CPTFloat(0.0), -halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, -halfSize.width, CPTFloat(0.0) ); + CGPathAddLineToPoint(lineCapPath, NULL, -halfSize.width, CPTFloat(0.0)); CGPathCloseSubpath(lineCapPath); break; case CPTLineCapTypePentagon: CGPathMoveToPoint(lineCapPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( lineCapPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( lineCapPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( lineCapPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( lineCapPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); + CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(lineCapPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(lineCapPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(lineCapPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); CGPathCloseSubpath(lineCapPath); break; @@ -535,8 +549,8 @@ -(CGPathRef)newLineCapPath break; case CPTLineCapTypeBar: - CGPathMoveToPoint( lineCapPath, NULL, halfSize.width, CPTFloat(0.0) ); - CGPathAddLineToPoint( lineCapPath, NULL, -halfSize.width, CPTFloat(0.0) ); + CGPathMoveToPoint(lineCapPath, NULL, halfSize.width, CPTFloat(0.0)); + CGPathAddLineToPoint(lineCapPath, NULL, -halfSize.width, CPTFloat(0.0)); break; case CPTLineCapTypeCross: @@ -567,8 +581,8 @@ -(CGPathRef)newLineCapPath CGFloat dy1 = lineCapSize.height / oldBounds.size.height; CGAffineTransform scaleTransform = CGAffineTransformScale(CGAffineTransformIdentity, dx1, dy1); - scaleTransform = CGAffineTransformConcat( scaleTransform, - CGAffineTransformMakeTranslation(-halfSize.width, -halfSize.height) ); + scaleTransform = CGAffineTransformConcat(scaleTransform, + CGAffineTransformMakeTranslation(-halfSize.width, -halfSize.height)); CGPathAddPath(lineCapPath, &scaleTransform, customPath); } } @@ -584,14 +598,14 @@ -(CGPathRef)newLineCapPath /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { const CGSize symbolSize = self.size; - const CGSize halfSize = CPTSizeMake( symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5) ); + const CGSize halfSize = CPTSizeMake(symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5)); const CGRect rect = CGRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height); const CGPoint centerPoint = CGPointMake(halfSize.width, halfSize.height); - return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat scale, CGRect bounds) { + return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat __unused scale, CGRect bounds __unused) { [self renderAsVectorInContext:context atPoint:centerPoint inDirection:CGPointMake(1.0, 0.0)]; }); } diff --git a/framework/Source/CPTLineStyle.h b/framework/Source/CPTLineStyle.h index bb9534d16..2b5c687b7 100644 --- a/framework/Source/CPTLineStyle.h +++ b/framework/Source/CPTLineStyle.h @@ -10,20 +10,20 @@ /** * @brief An array of line styles. **/ -typedef NSArray *CPTLineStyleArray; +typedef NSArray CPTLineStyleArray; /** * @brief A mutable array of line styles. **/ -typedef NSMutableArray *CPTMutableLineStyleArray; +typedef NSMutableArray CPTMutableLineStyleArray; -@interface CPTLineStyle : NSObject +@interface CPTLineStyle : NSObject @property (nonatomic, readonly) CGLineCap lineCap; @property (nonatomic, readonly) CGLineJoin lineJoin; @property (nonatomic, readonly) CGFloat miterLimit; @property (nonatomic, readonly) CGFloat lineWidth; -@property (nonatomic, readonly, nullable) CPTNumberArray dashPattern; +@property (nonatomic, readonly, nullable) CPTNumberArray *dashPattern; @property (nonatomic, readonly) CGFloat patternPhase; @property (nonatomic, readonly, nullable) CPTColor *lineColor; @property (nonatomic, readonly, nullable) CPTFill *lineFill; diff --git a/framework/Source/CPTLineStyle.m b/framework/Source/CPTLineStyle.m index c4263415a..2208471f6 100644 --- a/framework/Source/CPTLineStyle.m +++ b/framework/Source/CPTLineStyle.m @@ -16,13 +16,13 @@ @interface CPTLineStyle() @property (nonatomic, readwrite, assign) CGLineJoin lineJoin; @property (nonatomic, readwrite, assign) CGFloat miterLimit; @property (nonatomic, readwrite, assign) CGFloat lineWidth; -@property (nonatomic, readwrite, strong, nullable) CPTNumberArray dashPattern; +@property (nonatomic, readwrite, strong, nullable) CPTNumberArray *dashPattern; @property (nonatomic, readwrite, assign) CGFloat patternPhase; @property (nonatomic, readwrite, strong, nullable) CPTColor *lineColor; @property (nonatomic, readwrite, strong, nullable) CPTFill *lineFill; @property (nonatomic, readwrite, strong, nullable) CPTGradient *lineGradient; --(void)strokePathWithGradient:(CPTGradient *)gradient inContext:(CGContextRef)context; +-(void)strokePathWithGradient:(nonnull CPTGradient *)gradient inContext:(nonnull CGContextRef)context; @end @@ -65,7 +65,7 @@ @implementation CPTLineStyle **/ @synthesize lineWidth; -/** @property CPTNumberArray dashPattern +/** @property nullable CPTNumberArray *dashPattern * @brief The dash-and-space pattern for the line. Default is @nil. **/ @synthesize dashPattern; @@ -75,19 +75,19 @@ @implementation CPTLineStyle **/ @synthesize patternPhase; -/** @property CPTColor *lineColor +/** @property nullable CPTColor *lineColor * @brief The current stroke color in a context. Default is solid black. **/ @synthesize lineColor; -/** @property CPTFill *lineFill +/** @property nullable CPTFill *lineFill * @brief The current line fill. Default is @nil. * * If @nil, the line is drawn using the @ref lineGradient or @ref lineColor. **/ @synthesize lineFill; -/** @property CPTGradient *lineGradient +/** @property nullable CPTGradient *lineGradient * @brief The current line gradient fill. Default is @nil. * * If @nil, the line is drawn using the @ref lineFill or @ref lineColor. @@ -105,7 +105,7 @@ @implementation CPTLineStyle /** @brief Creates and returns a new CPTLineStyle instance. * @return A new CPTLineStyle instance. **/ -+(instancetype)lineStyle ++(nonnull instancetype)lineStyle { return [[self alloc] init]; } @@ -117,7 +117,7 @@ +(instancetype)lineStyle * @param lineStyle An existing CPTLineStyle. * @return A new line style instance. **/ -+(instancetype)lineStyleWithStyle:(CPTLineStyle *)lineStyle ++(nonnull instancetype)lineStyleWithStyle:(nullable CPTLineStyle *)lineStyle { CPTLineStyle *newLineStyle = [[self alloc] init]; @@ -152,9 +152,9 @@ +(instancetype)lineStyleWithStyle:(CPTLineStyle *)lineStyle * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { lineCap = kCGLineCapButt; lineJoin = kCGLineJoinMiter; miterLimit = CPTFloat(10.0); @@ -175,7 +175,7 @@ -(instancetype)init /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeInt:self.lineCap forKey:@"CPTLineStyle.lineCap"]; [coder encodeInt:self.lineJoin forKey:@"CPTLineStyle.lineJoin"]; @@ -188,42 +188,58 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeObject:self.lineGradient forKey:@"CPTLineStyle.lineGradient"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - lineCap = (CGLineCap)[coder decodeIntForKey : @"CPTLineStyle.lineCap"]; - lineJoin = (CGLineJoin)[coder decodeIntForKey : @"CPTLineStyle.lineJoin"]; - miterLimit = [coder decodeCGFloatForKey:@"CPTLineStyle.miterLimit"]; - lineWidth = [coder decodeCGFloatForKey:@"CPTLineStyle.lineWidth"]; - dashPattern = [coder decodeObjectForKey:@"CPTLineStyle.dashPattern"]; + if ((self = [super init])) { + lineCap = (CGLineCap)[coder decodeIntForKey:@"CPTLineStyle.lineCap"]; + lineJoin = (CGLineJoin)[coder decodeIntForKey:@"CPTLineStyle.lineJoin"]; + miterLimit = [coder decodeCGFloatForKey:@"CPTLineStyle.miterLimit"]; + lineWidth = [coder decodeCGFloatForKey:@"CPTLineStyle.lineWidth"]; + dashPattern = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTLineStyle.dashPattern"]; patternPhase = [coder decodeCGFloatForKey:@"CPTLineStyle.patternPhase"]; - lineColor = [coder decodeObjectForKey:@"CPTLineStyle.lineColor"]; - lineFill = [coder decodeObjectForKey:@"CPTLineStyle.lineFill"]; - lineGradient = [coder decodeObjectForKey:@"CPTLineStyle.lineGradient"]; + lineColor = [coder decodeObjectOfClass:[CPTColor class] + forKey:@"CPTLineStyle.lineColor"]; + lineFill = [coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTLineStyle.lineFill"]; + lineGradient = [coder decodeObjectOfClass:[CPTGradient class] + forKey:@"CPTLineStyle.lineGradient"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /** @brief Sets all of the line drawing properties in the given graphics context. * @param context The graphics context. **/ --(void)setLineStyleInContext:(CGContextRef)context +-(void)setLineStyleInContext:(nonnull CGContextRef)context { CGContextSetLineCap(context, self.lineCap); CGContextSetLineJoin(context, self.lineJoin); CGContextSetMiterLimit(context, self.miterLimit); CGContextSetLineWidth(context, self.lineWidth); - CPTNumberArray myDashPattern = self.dashPattern; + CPTNumberArray *myDashPattern = self.dashPattern; NSUInteger dashCount = myDashPattern.count; if ( dashCount > 0 ) { - CGFloat *dashLengths = (CGFloat *)calloc( dashCount, sizeof(CGFloat) ); + CGFloat *dashLengths = (CGFloat *)calloc(dashCount, sizeof(CGFloat)); NSUInteger dashCounter = 0; for ( NSNumber *currentDashLength in myDashPattern ) { @@ -244,7 +260,7 @@ -(void)setLineStyleInContext:(CGContextRef)context * * @param context The graphics context. **/ --(void)strokePathInContext:(CGContextRef)context +-(void)strokePathInContext:(nonnull CGContextRef)context { CPTGradient *gradient = self.lineGradient; CPTFill *fill = self.lineFill; @@ -267,7 +283,7 @@ -(void)strokePathInContext:(CGContextRef)context * @param rect The rectangle to draw. * @param context The graphics context. **/ --(void)strokeRect:(CGRect)rect inContext:(CGContextRef)context +-(void)strokeRect:(CGRect)rect inContext:(nonnull CGContextRef)context { CPTGradient *gradient = self.lineGradient; CPTFill *fill = self.lineFill; @@ -290,10 +306,10 @@ -(void)strokeRect:(CGRect)rect inContext:(CGContextRef)context /// @cond --(void)strokePathWithGradient:(CPTGradient *)gradient inContext:(CGContextRef)context +-(void)strokePathWithGradient:(nonnull CPTGradient *)gradient inContext:(nonnull CGContextRef)context { if ( gradient ) { - CGRect deviceRect = CGContextConvertRectToDeviceSpace( context, CPTRectMake(0.0, 0.0, 1.0, 1.0) ); + CGRect deviceRect = CGContextConvertRectToDeviceSpace(context, CPTRectMake(0.0, 0.0, 1.0, 1.0)); CGFloat step = CPTFloat(2.0) / deviceRect.size.height; @@ -303,7 +319,7 @@ -(void)strokePathWithGradient:(CPTGradient *)gradient inContext:(CGContextRef)co CGContextBeginPath(context); CGFloat width = startWidth; - while ( width > CPTFloat(0.0) ) { + while ( width > CPTFloat(0.0)) { CGContextSetLineWidth(context, width); CGColorRef gradientColor = [gradient newColorAtPosition:CPTFloat(1.0) - width / startWidth]; @@ -325,6 +341,8 @@ -(void)strokePathWithGradient:(CPTGradient *)gradient inContext:(CGContextRef)co #pragma mark - #pragma mark Opacity +/// @cond + -(BOOL)isOpaque { BOOL opaqueLine = NO; @@ -344,12 +362,14 @@ -(BOOL)isOpaque return opaqueLine; } +/// @endcond + #pragma mark - #pragma mark NSCopying Methods /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTLineStyle *styleCopy = [[CPTLineStyle allocWithZone:zone] init]; @@ -373,7 +393,7 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(id)mutableCopyWithZone:(NSZone *)zone +-(nonnull id)mutableCopyWithZone:(nullable NSZone *)zone { CPTLineStyle *styleCopy = [[CPTMutableLineStyle allocWithZone:zone] init]; @@ -397,11 +417,11 @@ -(id)mutableCopyWithZone:(NSZone *)zone /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { const CGRect rect = CGRectMake(0.0, 0.0, 100.0, 100.0); - return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat scale, CGRect bounds) { + return CPTQuickLookImage(rect, ^(CGContextRef context, CGFloat __unused scale, CGRect bounds) { const CGRect alignedRect = CPTAlignBorderedRectToUserSpace(context, bounds, self); [self setLineStyleInContext:context]; diff --git a/framework/Source/CPTLineStyleTests.m b/framework/Source/CPTLineStyleTests.m index ec90f91cc..89772788a 100644 --- a/framework/Source/CPTLineStyleTests.m +++ b/framework/Source/CPTLineStyleTests.m @@ -11,7 +11,7 @@ -(void)testKeyedArchivingRoundTrip { CPTLineStyle *lineStyle = [CPTLineStyle lineStyle]; - CPTLineStyle *newLineStyle = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:lineStyle]]; + CPTLineStyle *newLineStyle = [self archiveRoundTrip:lineStyle]; XCTAssertEqual(newLineStyle.lineCap, lineStyle.lineCap, @"Line cap not equal"); XCTAssertEqual(newLineStyle.lineJoin, lineStyle.lineJoin, @"Line join not equal"); diff --git a/framework/Source/CPTMutableLineStyle.h b/framework/Source/CPTMutableLineStyle.h index a42eadb47..0d69bb453 100644 --- a/framework/Source/CPTMutableLineStyle.h +++ b/framework/Source/CPTMutableLineStyle.h @@ -8,7 +8,7 @@ @property (nonatomic, readwrite, assign) CGLineJoin lineJoin; @property (nonatomic, readwrite, assign) CGFloat miterLimit; @property (nonatomic, readwrite, assign) CGFloat lineWidth; -@property (nonatomic, readwrite, strong, nullable) CPTNumberArray dashPattern; +@property (nonatomic, readwrite, strong, nullable) CPTNumberArray *dashPattern; @property (nonatomic, readwrite, assign) CGFloat patternPhase; @property (nonatomic, readwrite, strong, nullable) CPTColor *lineColor; @property (nonatomic, readwrite, strong, nullable) CPTFill *lineFill; diff --git a/framework/Source/CPTMutableLineStyle.m b/framework/Source/CPTMutableLineStyle.m index 39b9500a8..1a69123e2 100644 --- a/framework/Source/CPTMutableLineStyle.m +++ b/framework/Source/CPTMutableLineStyle.m @@ -29,7 +29,7 @@ @implementation CPTMutableLineStyle **/ @dynamic lineWidth; -/** @property CPTNumberArray dashPattern +/** @property nullable CPTNumberArray *dashPattern * @brief The dash-and-space pattern for the line. Default is @nil. **/ @dynamic dashPattern; @@ -39,19 +39,19 @@ @implementation CPTMutableLineStyle **/ @dynamic patternPhase; -/** @property CPTColor *lineColor +/** @property nullable CPTColor *lineColor * @brief The current stroke color in a context. Default is solid black. **/ @dynamic lineColor; -/** @property CPTFill *lineFill +/** @property nullable CPTFill *lineFill * @brief The current line fill. Default is @nil. * * If @nil, the line is drawn using the @ref lineGradient or @ref lineColor. **/ @dynamic lineFill; -/** @property CPTGradient *lineGradient +/** @property nullable CPTGradient *lineGradient * @brief The current line gradient fill. Default is @nil. * * If @nil, the line is drawn using the @ref lineFill or @ref lineColor. diff --git a/framework/Source/CPTMutableNumericData.h b/framework/Source/CPTMutableNumericData.h index 51307f7e9..32d299487 100644 --- a/framework/Source/CPTMutableNumericData.h +++ b/framework/Source/CPTMutableNumericData.h @@ -10,13 +10,13 @@ /// @name Dimensions /// @{ -@property (nonatomic, readwrite, copy, nonnull) CPTNumberArray shape; +@property (nonatomic, readwrite, copy, nonnull) CPTNumberArray *shape; /// @} /// @name Samples /// @{ --(nullable void *)mutableSamplePointer:(NSUInteger)sample; --(nullable void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ...; +-(nullable void *)mutableSamplePointer:(NSUInteger)sample NS_RETURNS_INNER_POINTER; +-(nullable void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ... NS_RETURNS_INNER_POINTER; /// @} @end diff --git a/framework/Source/CPTMutableNumericData.m b/framework/Source/CPTMutableNumericData.m index af1ec220f..631d70704 100644 --- a/framework/Source/CPTMutableNumericData.m +++ b/framework/Source/CPTMutableNumericData.m @@ -24,12 +24,12 @@ -(NSUInteger)sampleIndex:(NSUInteger)idx indexList:(va_list)indexList; **/ @implementation CPTMutableNumericData -/** @property void *mutableBytes +/** @property nonnull void *mutableBytes * @brief Returns a pointer to the data buffer’s contents. **/ @dynamic mutableBytes; -/** @property CPTNumberArray shape +/** @property nonnull CPTNumberArray *shape * @brief The shape of the data buffer array. Set a new shape to change the size of the data buffer. * * The shape describes the dimensions of the sample array stored in @@ -46,10 +46,10 @@ @implementation CPTMutableNumericData * @param sample The zero-based index into the sample array. The array is treated as if it only has one dimension. * @return A pointer to the sample or @NULL if the sample index is out of bounds. **/ --(void *)mutableSamplePointer:(NSUInteger)sample +-(nullable void *)mutableSamplePointer:(NSUInteger)sample { if ( sample < self.numberOfSamples ) { - return (void *)( (char *)self.mutableBytes + sample * self.sampleBytes ); + return (void *)((char *)self.mutableBytes + sample * self.sampleBytes); } else { return NULL; @@ -58,11 +58,11 @@ -(void *)mutableSamplePointer:(NSUInteger)sample /** @brief Gets a pointer to a given sample in the data buffer. * @param idx The zero-based indices into a multi-dimensional sample array. Each index should of type @ref NSUInteger and the number of indices - * (including @par{index}) should match the @ref numberOfDimensions. + * (including @par{idx}) should match the @ref numberOfDimensions. * @return A pointer to the sample or @NULL if any of the sample indices are out of bounds. **/ --(void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ... - { +-(nullable void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ... +{ NSUInteger newIndex; if ( self.numberOfDimensions > 1 ) { @@ -85,9 +85,9 @@ -(void *)mutableSamplePointerAtIndex:(NSUInteger)idx, ... /// @cond --(void *)mutableBytes +-(nonnull void *)mutableBytes { - return [(NSMutableData *)self.data mutableBytes]; + return ((NSMutableData *)self.data).mutableBytes; } /// @endcond diff --git a/framework/Source/CPTMutableNumericDataTests.m b/framework/Source/CPTMutableNumericDataTests.m index 67eafd056..d5cc0870a 100644 --- a/framework/Source/CPTMutableNumericDataTests.m +++ b/framework/Source/CPTMutableNumericDataTests.m @@ -16,7 +16,7 @@ -(void)testNilShapeGivesSingleDimension NSUInteger expected = 1; XCTAssertEqual(actual, expected, @"numberOfDimensions == 1"); - expected = [nd.shape count]; + expected = nd.shape.count; XCTAssertEqual(actual, expected, @"numberOfDimensions == 1"); } @@ -28,7 +28,7 @@ -(void)testNumberOfDimensionsGivesShapeCount NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:shape]; XCTAssertEqual(nd.numberOfDimensions, nd.shape.count, @"numberOfDimensions == shape.count == 3"); @@ -47,7 +47,7 @@ -(void)testNilShapeCorrectElementCount NSUInteger prod = 1; for ( NSNumber *num in nd.shape ) { - prod *= [num unsignedIntValue]; + prod *= num.unsignedIntegerValue; } XCTAssertEqual(prod, nElems, @"prod == nElems"); @@ -64,7 +64,7 @@ -(void)testIllegalShapeRaisesException NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(NSUInteger)]; XCTAssertThrowsSpecificNamed(testData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTUnsignedIntegerDataType, sizeof(NSUInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTUnsignedIntegerDataType, sizeof(NSUInteger), NSHostByteOrder()) shape:shape], NSException, CPTNumericDataException, @@ -79,7 +79,7 @@ -(void)testReturnsDataLength shape:nil]; NSUInteger expected = 10 * sizeof(float); - NSUInteger actual = [nd length]; + NSUInteger actual = nd.length; XCTAssertEqual(expected, actual, @"data length"); } @@ -88,14 +88,14 @@ -(void)testBytesEqualDataBytes { NSUInteger nElements = 10; NSMutableData *data = [NSMutableData dataWithLength:nElements * sizeof(NSInteger)]; - NSInteger *intData = (NSInteger *)[data mutableBytes]; + NSInteger *intData = (NSInteger *)data.mutableBytes; for ( NSUInteger i = 0; i < nElements; i++ ) { intData[i] = (NSInteger)i; } CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; NSMutableData *expected = data; @@ -106,17 +106,17 @@ -(void)testArchivingRoundTrip { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - CPTMutableNumericData *nd2 = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:nd]]; + CPTMutableNumericData *nd2 = [self archiveRoundTrip:nd]; XCTAssertTrue([nd.data isEqualToData:nd2.data], @"equal data"); @@ -133,27 +133,27 @@ -(void)testNumberOfSamplesCorrectForDataType { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd numberOfSamples], nElems, @"numberOfSamples == nElems"); nElems = 10; data = [NSMutableData dataWithLength:nElems * sizeof(char)]; - char *charSamples = (char *)[data mutableBytes]; + char *charSamples = (char *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { charSamples[i] = (char)lrint(sin(i) * 100.0); } nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(char), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(char), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd numberOfSamples], nElems, @"numberOfSamples == nElems"); @@ -163,14 +163,14 @@ -(void)testDataTypeAccessorsCorrectForDataType { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTMutableNumericData *nd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd dataTypeFormat], CPTFloatingPointDataType, @"dataTypeFormat"); @@ -182,23 +182,23 @@ -(void)testConvertTypeConvertsType { NSUInteger numberOfSamples = 10; NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i); } CPTMutableNumericData *fd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *dd = [fd dataByConvertingToType:CPTFloatingPointDataType sampleBytes:sizeof(double) byteOrder:NSHostByteOrder()]; - const double *doubleSamples = (const double *)[dd.data bytes]; + const double *doubleSamples = (const double *)dd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertTrue(samples[i] == doubleSamples[i], @"(float)%g != (double)%g", samples[i], doubleSamples[i]); + XCTAssertTrue((double)samples[i] == doubleSamples[i], @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i]); } } @@ -206,19 +206,19 @@ -(void)testSamplePointerCorrect { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTMutableNumericData *fd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - XCTAssertEqual( ( (float *)[fd mutableBytes] ) + 4, (float *)[fd mutableSamplePointer:4], @"%p,%p", samples + 4, (float *)[fd mutableSamplePointer:4] ); - XCTAssertEqual( ( (float *)[fd mutableBytes] ), (float *)[fd mutableSamplePointer:0], @"" ); - XCTAssertEqual( ( (float *)[fd mutableBytes] ) + nElems - 1, (float *)[fd mutableSamplePointer:nElems - 1], @"" ); + XCTAssertEqual(((float *)[fd mutableBytes]) + 4, (float *)[fd mutableSamplePointer:4], @"%p,%p", samples + 4, (float *)[fd mutableSamplePointer:4]); + XCTAssertEqual(((float *)[fd mutableBytes]), (float *)[fd mutableSamplePointer:0], @""); + XCTAssertEqual(((float *)[fd mutableBytes]) + nElems - 1, (float *)[fd mutableSamplePointer:nElems - 1], @""); XCTAssertNil([fd samplePointer:nElems], @"too many samples"); } @@ -226,14 +226,14 @@ -(void)testSampleValueCorrect { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTMutableNumericData *fd = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqualWithAccuracy([[fd sampleValue:0] doubleValue], sin(0), 0.01, @"sample value"); @@ -245,13 +245,13 @@ -(void)testMutableCopy const NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTMutableNumericData *ndCopy = [nd mutableCopy]; // should be mutable--if not, this will error - ndCopy.dataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ); + ndCopy.dataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()); } @end diff --git a/framework/Source/CPTMutableNumericDataTypeConversionTests.m b/framework/Source/CPTMutableNumericDataTypeConversionTests.m index 1f825e4c8..2c01ecfe5 100644 --- a/framework/Source/CPTMutableNumericDataTypeConversionTests.m +++ b/framework/Source/CPTMutableNumericDataTypeConversionTests.m @@ -11,103 +11,103 @@ @implementation CPTMutableNumericDataTypeConversionTests -(void)testFloatToDoubleInPlaceConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i); } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; numericData.sampleBytes = sizeof(double); - const double *doubleSamples = (const double *)[numericData.data bytes]; + const double *doubleSamples = (const double *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", samples[i], doubleSamples[i] ); + XCTAssertEqualWithAccuracy((double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i]); } } -(void)testDoubleToFloatInPlaceConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(double)]; - double *samples = (double *)[data mutableBytes]; + double *samples = (double *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; numericData.sampleBytes = sizeof(float); - const float *floatSamples = (const float *)[numericData.data bytes]; + const float *floatSamples = (const float *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", floatSamples[i], samples[i] ); + XCTAssertEqualWithAccuracy((double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", (double)floatSamples[i], samples[i]); } } -(void)testFloatToIntegerInPlaceConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i) * 1000.0f; } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - numericData.dataType = CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ); + numericData.dataType = CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()); - const NSInteger *intSamples = (const NSInteger *)[numericData.data bytes]; + const NSInteger *intSamples = (const NSInteger *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", samples[i], (long)intSamples[i] ); + XCTAssertEqualWithAccuracy((NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", (double)samples[i], (long)intSamples[i]); } } -(void)testIntegerToFloatInPlaceConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSInteger)]; - NSInteger *samples = (NSInteger *)[data mutableBytes]; + NSInteger *samples = (NSInteger *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = (NSInteger)(sin(i) * 1000.0); } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; - numericData.dataType = CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ); + numericData.dataType = CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()); - const float *floatSamples = (const float *)[numericData.data bytes]; + const float *floatSamples = (const float *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy(floatSamples[i], (float)samples[i], precision, @"(float)%g != (NSInteger)%ld", floatSamples[i], (long)samples[i]); + XCTAssertEqualWithAccuracy(floatSamples[i], (float)samples[i], (float)precision, @"(float)%g != (NSInteger)%ld", (double)floatSamples[i], (long)samples[i]); } } -(void)testDecimalToDoubleInPlaceConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSDecimal)]; - NSDecimal *samples = (NSDecimal *)[data mutableBytes]; + NSDecimal *samples = (NSDecimal *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - samples[i] = CPTDecimalFromDouble( sin(i) ); + samples[i] = CPTDecimalFromDouble(sin(i)); } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder() ) + dataType:CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()) shape:nil]; - numericData.dataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ); + numericData.dataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()); - const double *doubleSamples = (const double *)[numericData.data bytes]; + const double *doubleSamples = (const double *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { XCTAssertEqual(CPTDecimalDoubleValue(samples[i]), doubleSamples[i], @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(samples[i]), doubleSamples[i]); } @@ -116,21 +116,21 @@ -(void)testDecimalToDoubleInPlaceConversion -(void)testDoubleToDecimalInPlaceConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(double)]; - double *samples = (double *)[data mutableBytes]; + double *samples = (double *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } CPTMutableNumericData *numericData = [[CPTMutableNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; - numericData.dataType = CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder() ); + numericData.dataType = CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()); - const NSDecimal *decimalSamples = (const NSDecimal *)[numericData.data bytes]; + const NSDecimal *decimalSamples = (const NSDecimal *)numericData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertTrue(CPTDecimalEquals( decimalSamples[i], CPTDecimalFromDouble(samples[i]) ), @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(decimalSamples[i]), samples[i]); + XCTAssertTrue(CPTDecimalEquals(decimalSamples[i], CPTDecimalFromDouble(samples[i])), @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(decimalSamples[i]), samples[i]); } } @@ -177,7 +177,7 @@ -(void)testTypeConversionSwapsByteOrderDoubleInPlace uint64_t end = *(const uint64_t *)numericData.bytes; union swap { - double v; + double v; CFSwappedFloat64 sv; } result; diff --git a/framework/Source/CPTMutablePlotRange.h b/framework/Source/CPTMutablePlotRange.h index 0735717f7..a4d602679 100644 --- a/framework/Source/CPTMutablePlotRange.h +++ b/framework/Source/CPTMutablePlotRange.h @@ -4,8 +4,8 @@ /// @name Range Limits /// @{ -@property (nonatomic, readwrite, strong) NSNumber *location; -@property (nonatomic, readwrite, strong) NSNumber *length; +@property (nonatomic, readwrite, strong, nonnull) NSNumber *location; +@property (nonatomic, readwrite, strong, nonnull) NSNumber *length; @property (nonatomic, readwrite) NSDecimal locationDecimal; @property (nonatomic, readwrite) NSDecimal lengthDecimal; @property (nonatomic, readwrite) double locationDouble; @@ -14,19 +14,19 @@ /// @name Combining Ranges /// @{ --(void)unionPlotRange:(CPTPlotRange *)otherRange; --(void)intersectionPlotRange:(CPTPlotRange *)otherRange; +-(void)unionPlotRange:(nullable CPTPlotRange *)otherRange; +-(void)intersectionPlotRange:(nullable CPTPlotRange *)otherRange; /// @} /// @name Shifting Ranges /// @{ --(void)shiftLocationToFitInRange:(CPTPlotRange *)otherRange; --(void)shiftEndToFitInRange:(CPTPlotRange *)otherRange; +-(void)shiftLocationToFitInRange:(nonnull CPTPlotRange *)otherRange; +-(void)shiftEndToFitInRange:(nonnull CPTPlotRange *)otherRange; /// @} /// @name Expanding/Contracting Ranges /// @{ --(void)expandRangeByFactor:(NSNumber *)factor; +-(void)expandRangeByFactor:(nonnull NSNumber *)factor; /// @} @end diff --git a/framework/Source/CPTMutablePlotRange.m b/framework/Source/CPTMutablePlotRange.m index 3e54ebf41..eb1079824 100644 --- a/framework/Source/CPTMutablePlotRange.m +++ b/framework/Source/CPTMutablePlotRange.m @@ -21,13 +21,13 @@ @interface CPTMutablePlotRange() **/ @implementation CPTMutablePlotRange -/** @property NSNumber *location +/** @property nonnull NSNumber *location * @brief The starting value of the range. * @see @ref locationDecimal, @ref locationDouble **/ @dynamic location; -/** @property NSNumber *length +/** @property nonnull NSNumber *length * @brief The length of the range. * @see @ref lengthDecimal, @ref lengthDouble **/ @@ -65,7 +65,7 @@ @implementation CPTMutablePlotRange /** @brief Extends the range to include another range. The sign of @ref length is unchanged. * @param other The other plot range. **/ --(void)unionPlotRange:(CPTPlotRange *)other +-(void)unionPlotRange:(nullable CPTPlotRange *)other { if ( !other ) { return; @@ -73,30 +73,82 @@ -(void)unionPlotRange:(CPTPlotRange *)other NSDecimal min1 = self.minLimitDecimal; NSDecimal min2 = other.minLimitDecimal; - NSDecimal minimum = CPTDecimalLessThan(min1, min2) ? min1 : min2; + NSDecimal minimum = CPTDecimalMin(min1, min2); NSDecimal max1 = self.maxLimitDecimal; NSDecimal max2 = other.maxLimitDecimal; - NSDecimal maximum = CPTDecimalGreaterThan(max1, max2) ? max1 : max2; - - NSDecimal newLocation, newLength; - if ( CPTDecimalGreaterThanOrEqualTo( self.lengthDecimal, CPTDecimalFromInteger(0) ) ) { - newLocation = minimum; - newLength = CPTDecimalSubtract(maximum, minimum); + NSDecimal maximum = CPTDecimalMax(max1, max2); + + if ( self.isInfinite && other.isInfinite ) { + if ( self.lengthSign == other.lengthSign ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + break; + + default: + break; + } + } + else { + self.locationDouble = -HUGE_VAL; + self.lengthDouble = HUGE_VAL; + } + } + else if ( self.isInfinite && !other.isInfinite ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + break; + + default: + break; + } + } + else if ( !self.isInfinite && other.isInfinite ) { + switch ( other.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + self.lengthDouble = HUGE_VAL; + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + self.lengthDouble = -HUGE_VAL; + break; + + default: + break; + } + } + else if ( NSDecimalIsNotANumber(&minimum) || NSDecimalIsNotANumber(&maximum)) { + self.locationDecimal = CPTDecimalNaN(); + self.lengthDecimal = CPTDecimalNaN(); } else { - newLocation = maximum; - newLength = CPTDecimalSubtract(minimum, maximum); + if ( CPTDecimalGreaterThanOrEqualTo(self.lengthDecimal, CPTDecimalFromInteger(0))) { + self.locationDecimal = minimum; + self.lengthDecimal = CPTDecimalSubtract(maximum, minimum); + } + else { + self.locationDecimal = maximum; + self.lengthDecimal = CPTDecimalSubtract(minimum, maximum); + } } - - self.locationDecimal = newLocation; - self.lengthDecimal = newLength; } /** @brief Sets the messaged object to the intersection with another range. The sign of @ref length is unchanged. * @param other The other plot range. **/ --(void)intersectionPlotRange:(CPTPlotRange *)other +-(void)intersectionPlotRange:(nullable CPTPlotRange *)other { if ( !other ) { return; @@ -104,28 +156,75 @@ -(void)intersectionPlotRange:(CPTPlotRange *)other NSDecimal min1 = self.minLimitDecimal; NSDecimal min2 = other.minLimitDecimal; - NSDecimal minimum = CPTDecimalGreaterThan(min1, min2) ? min1 : min2; + NSDecimal minimum = CPTDecimalMax(min1, min2); NSDecimal max1 = self.maxLimitDecimal; NSDecimal max2 = other.maxLimitDecimal; - NSDecimal maximum = CPTDecimalLessThan(max1, max2) ? max1 : max2; + NSDecimal maximum = CPTDecimalMin(max1, max2); - if ( CPTDecimalGreaterThanOrEqualTo(maximum, minimum) ) { - NSDecimal newLocation, newLength; - if ( CPTDecimalGreaterThanOrEqualTo( self.lengthDecimal, CPTDecimalFromInteger(0) ) ) { - newLocation = minimum; - newLength = CPTDecimalSubtract(maximum, minimum); + if ( ![self intersectsRange:other] ) { + self.locationDecimal = CPTDecimalNaN(); + self.lengthDecimal = CPTDecimalNaN(); + } + else if ( self.isInfinite && other.isInfinite ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + break; + + default: + break; } - else { - newLocation = maximum; - newLength = CPTDecimalSubtract(minimum, maximum); + } + else if ( self.isInfinite && !other.isInfinite ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + self.lengthDecimal = CPTDecimalSubtract(other.maxLimitDecimal, minimum); + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + self.lengthDecimal = CPTDecimalSubtract(other.minLimitDecimal, maximum); + break; + + default: + break; + } + } + else if ( !self.isInfinite && other.isInfinite ) { + switch ( other.lengthSign ) { + case CPTSignPositive: + self.locationDecimal = minimum; + self.lengthDecimal = CPTDecimalSubtract(self.maxLimitDecimal, minimum); + break; + + case CPTSignNegative: + self.locationDecimal = maximum; + self.lengthDecimal = CPTDecimalSubtract(self.minLimitDecimal, maximum); + break; + + default: + break; } - - self.locationDecimal = newLocation; - self.lengthDecimal = newLength; + } + else if ( NSDecimalIsNotANumber(&minimum) || NSDecimalIsNotANumber(&maximum)) { + self.locationDecimal = CPTDecimalNaN(); + self.lengthDecimal = CPTDecimalNaN(); } else { - self.lengthDecimal = CPTDecimalFromInteger(0); + if ( CPTDecimalGreaterThanOrEqualTo(self.lengthDecimal, CPTDecimalFromInteger(0))) { + self.locationDecimal = minimum; + self.lengthDecimal = CPTDecimalSubtract(maximum, minimum); + } + else { + self.locationDecimal = maximum; + self.lengthDecimal = CPTDecimalSubtract(minimum, maximum); + } } } @@ -136,11 +235,11 @@ -(void)intersectionPlotRange:(CPTPlotRange *)other * @param factor Factor used. A value of @num{1.0} gives no change. * Less than @num{1.0} is a contraction, and greater than @num{1.0} is expansion. **/ --(void)expandRangeByFactor:(NSNumber *)factor +-(void)expandRangeByFactor:(nonnull NSNumber *)factor { NSDecimal oldLength = self.lengthDecimal; NSDecimal newLength = CPTDecimalMultiply(oldLength, factor.decimalValue); - NSDecimal locationOffset = CPTDecimalDivide( CPTDecimalSubtract(oldLength, newLength), CPTDecimalFromInteger(2) ); + NSDecimal locationOffset = CPTDecimalDivide(CPTDecimalSubtract(oldLength, newLength), CPTDecimalFromInteger(2)); NSDecimal newLocation = CPTDecimalAdd(self.locationDecimal, locationOffset); self.locationDecimal = newLocation; @@ -154,7 +253,7 @@ -(void)expandRangeByFactor:(NSNumber *)factor * @param otherRange Other range. * The minimum possible shift is made. The range @ref length is unchanged. **/ --(void)shiftLocationToFitInRange:(CPTPlotRange *)otherRange +-(void)shiftLocationToFitInRange:(nonnull CPTPlotRange *)otherRange { NSParameterAssert(otherRange); @@ -177,7 +276,7 @@ -(void)shiftLocationToFitInRange:(CPTPlotRange *)otherRange * @param otherRange Other range. * The minimum possible shift is made. The range @ref length is unchanged. **/ --(void)shiftEndToFitInRange:(CPTPlotRange *)otherRange +-(void)shiftEndToFitInRange:(nonnull CPTPlotRange *)otherRange { NSParameterAssert(otherRange); @@ -201,8 +300,10 @@ -(void)shiftEndToFitInRange:(CPTPlotRange *)otherRange /// @cond --(void)setLocation:(NSNumber *)newLocation +-(void)setLocation:(nonnull NSNumber *)newLocation { + NSParameterAssert(newLocation); + self.inValueUpdate = YES; self.locationDecimal = newLocation.decimalValue; @@ -211,8 +312,10 @@ -(void)setLocation:(NSNumber *)newLocation self.inValueUpdate = NO; } --(void)setLength:(NSNumber *)newLength +-(void)setLength:(nonnull NSNumber *)newLength { + NSParameterAssert(newLength); + self.inValueUpdate = YES; self.lengthDecimal = newLength.decimalValue; diff --git a/framework/Source/CPTMutableShadow.m b/framework/Source/CPTMutableShadow.m index db73e4aef..b30e7afca 100644 --- a/framework/Source/CPTMutableShadow.m +++ b/framework/Source/CPTMutableShadow.m @@ -21,7 +21,7 @@ @implementation CPTMutableShadow **/ @dynamic shadowBlurRadius; -/** @property CPTColor *shadowColor +/** @property nullable CPTColor *shadowColor * @brief The shadow color. If @nil (the default), the shadow will not be drawn. **/ @dynamic shadowColor; diff --git a/framework/Source/CPTMutableTextStyle.h b/framework/Source/CPTMutableTextStyle.h index 471a79bb0..e63ec361f 100644 --- a/framework/Source/CPTMutableTextStyle.h +++ b/framework/Source/CPTMutableTextStyle.h @@ -4,6 +4,7 @@ @interface CPTMutableTextStyle : CPTTextStyle +@property (readwrite, strong, nonatomic, nullable) CPTNativeFont *font; @property (readwrite, copy, nonatomic, nullable) NSString *fontName; @property (readwrite, assign, nonatomic) CGFloat fontSize; @property (readwrite, copy, nonatomic, nullable) CPTColor *color; diff --git a/framework/Source/CPTMutableTextStyle.m b/framework/Source/CPTMutableTextStyle.m index 4c50dd317..50cce383a 100644 --- a/framework/Source/CPTMutableTextStyle.m +++ b/framework/Source/CPTMutableTextStyle.m @@ -7,17 +7,24 @@ @implementation CPTMutableTextStyle +/** @property CPTNativeFont* font + * @brief The font. Default is @nil. + * + * Font will override fontName and fontSize if not @nil. + **/ +@synthesize font; + /** @property CGFloat fontSize - * @brief The font size. Default is @num{12.0}. + * @brief The font size. Default is @num{12.0}. Ignored if font is not @nil. **/ @dynamic fontSize; -/** @property NSString *fontName - * @brief The font name. Default is Helvetica. +/** @property nullable NSString *fontName + * @brief The font name. Default is Helvetica. Ignored if font is not @nil. **/ @dynamic fontName; -/** @property CPTColor *color +/** @property nullable CPTColor *color * @brief The current text color. Default is solid black. **/ @dynamic color; diff --git a/framework/Source/CPTNumericData+TypeConversion.h b/framework/Source/CPTNumericData+TypeConversion.h index 7ae0179c6..7bd08216b 100644 --- a/framework/Source/CPTNumericData+TypeConversion.h +++ b/framework/Source/CPTNumericData+TypeConversion.h @@ -8,15 +8,15 @@ /// @name Type Conversion /// @{ --(CPTNumericData *)dataByConvertingToDataType:(CPTNumericDataType)newDataType; +-(nonnull CPTNumericData *)dataByConvertingToDataType:(CPTNumericDataType)newDataType; --(CPTNumericData *)dataByConvertingToType:(CPTDataTypeFormat)newDataType sampleBytes:(size_t)newSampleBytes byteOrder:(CFByteOrder)newByteOrder; +-(nonnull CPTNumericData *)dataByConvertingToType:(CPTDataTypeFormat)newDataType sampleBytes:(size_t)newSampleBytes byteOrder:(CFByteOrder)newByteOrder; /// @} /// @name Data Conversion Utilities /// @{ --(void)convertData:(NSData *)sourceData dataType:(CPTNumericDataType *)sourceDataType toData:(NSMutableData *)destData dataType:(CPTNumericDataType *)destDataType; --(void)swapByteOrderForData:(NSMutableData *)sourceData sampleSize:(size_t)sampleSize; +-(void)convertData:(nonnull NSData *)sourceData dataType:(nonnull CPTNumericDataType *)sourceDataType toData:(nonnull NSMutableData *)destData dataType:(nonnull CPTNumericDataType *)destDataType; +-(void)swapByteOrderForData:(nonnull NSMutableData *)sourceData sampleSize:(size_t)sampleSize; /// @} @end diff --git a/framework/Source/CPTNumericData+TypeConversion.m b/framework/Source/CPTNumericData+TypeConversion.m index 60b17ddc7..2ebfd19a1 100644 --- a/framework/Source/CPTNumericData+TypeConversion.m +++ b/framework/Source/CPTNumericData+TypeConversion.m @@ -1,7 +1,7 @@ #import "CPTNumericData+TypeConversion.h" -#import "CPTUtilities.h" #import "complex.h" +#import "CPTUtilities.h" @implementation CPTNumericData(TypeConversion) @@ -11,9 +11,9 @@ @implementation CPTNumericData(TypeConversion) * @param newByteOrder The new byte order. * @return A copy of the current numeric data converted to the new data type. **/ --(CPTNumericData *)dataByConvertingToType:(CPTDataTypeFormat)newDataType - sampleBytes:(size_t)newSampleBytes - byteOrder:(CFByteOrder)newByteOrder +-(nonnull CPTNumericData *)dataByConvertingToType:(CPTDataTypeFormat)newDataType + sampleBytes:(size_t)newSampleBytes + byteOrder:(CFByteOrder)newByteOrder { return [self dataByConvertingToDataType:CPTDataType(newDataType, newSampleBytes, newByteOrder)]; } @@ -22,24 +22,24 @@ -(CPTNumericData *)dataByConvertingToType:(CPTDataTypeFormat)newDataType * @param newDataType The new data type. * @return A copy of the current numeric data converted to the new data type. **/ --(CPTNumericData *)dataByConvertingToDataType:(CPTNumericDataType)newDataType +-(nonnull CPTNumericData *)dataByConvertingToDataType:(CPTNumericDataType)newDataType { CPTNumericDataType myDataType = self.dataType; NSParameterAssert(myDataType.dataTypeFormat != CPTUndefinedDataType); NSParameterAssert(myDataType.byteOrder != CFByteOrderUnknown); - NSParameterAssert( CPTDataTypeIsSupported(newDataType) ); + NSParameterAssert(CPTDataTypeIsSupported(newDataType)); NSParameterAssert(newDataType.dataTypeFormat != CPTUndefinedDataType); NSParameterAssert(newDataType.byteOrder != CFByteOrderUnknown); NSData *newData = nil; CFByteOrder hostByteOrder = CFByteOrderGetCurrent(); - if ( CPTDataTypeEqualToDataType(myDataType, newDataType) ) { + if ( CPTDataTypeEqualToDataType(myDataType, newDataType)) { newData = self.data; } - else if ( ( myDataType.sampleBytes == sizeof(int8_t) ) && ( newDataType.sampleBytes == sizeof(int8_t) ) ) { + else if ((myDataType.sampleBytes == sizeof(int8_t)) && (newDataType.sampleBytes == sizeof(int8_t))) { newData = self.data; } else { @@ -80,10 +80,10 @@ -(CPTNumericData *)dataByConvertingToDataType:(CPTNumericDataType)newDataType * @param destData The destination data buffer. * @param destDataType The new data type. **/ --(void)convertData:(NSData *)sourceData - dataType:(CPTNumericDataType *)sourceDataType - toData:(NSMutableData *)destData - dataType:(CPTNumericDataType *)destDataType +-(void)convertData:(nonnull NSData *)sourceData + dataType:(nonnull CPTNumericDataType *)sourceDataType + toData:(nonnull NSMutableData *)destData + dataType:(nonnull CPTNumericDataType *)destDataType { NSUInteger sampleCount = sourceData.length / sourceDataType->sampleBytes; @@ -105,7 +105,7 @@ case sizeof(int8_t): switch ( destDataType->sampleBytes ) { case sizeof(int8_t): { // int8_t -> int8_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int8_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int8_t)); } break; @@ -281,7 +281,7 @@ case sizeof(int8_t): case sizeof(int16_t): { // int16_t -> int16_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int16_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int16_t)); } break; @@ -457,7 +457,7 @@ case sizeof(int16_t): case sizeof(int32_t): { // int32_t -> int32_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int32_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int32_t)); } break; @@ -633,7 +633,7 @@ case sizeof(int32_t): case sizeof(int64_t): { // int64_t -> int64_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int64_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(int64_t)); } break; } @@ -817,7 +817,7 @@ case sizeof(int64_t): switch ( destDataType->sampleBytes ) { case sizeof(uint8_t): { // uint8_t -> uint8_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint8_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint8_t)); } break; @@ -993,7 +993,7 @@ case sizeof(uint8_t): case sizeof(uint16_t): { // uint16_t -> uint16_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint16_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint16_t)); } break; @@ -1169,7 +1169,7 @@ case sizeof(uint16_t): case sizeof(uint32_t): { // uint32_t -> uint32_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint32_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint32_t)); } break; @@ -1345,7 +1345,7 @@ case sizeof(uint32_t): case sizeof(uint64_t): { // uint64_t -> uint64_t - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint64_t) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(uint64_t)); } break; } @@ -1529,7 +1529,7 @@ case sizeof(uint64_t): switch ( destDataType->sampleBytes ) { case sizeof(float): { // float -> float - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float)); } break; @@ -1705,7 +1705,7 @@ case sizeof(float): case sizeof(double): { // double -> double - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double)); } break; } @@ -1889,7 +1889,7 @@ case sizeof(double): switch ( destDataType->sampleBytes ) { case sizeof(float complex): { // float complex -> float complex - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float complex) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(float complex)); } break; @@ -1914,7 +1914,7 @@ case sizeof(NSDecimal): const float complex *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) { - *toBytes++ = CPTDecimalFromFloat( crealf(*fromBytes++) ); + *toBytes++ = CPTDecimalFromFloat(crealf(*fromBytes++)); } } break; @@ -2065,7 +2065,7 @@ case sizeof(float complex): case sizeof(double complex): { // double complex -> double complex - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double complex) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(double complex)); } break; } @@ -2079,7 +2079,7 @@ case sizeof(NSDecimal): const double complex *lastSample = fromBytes + sampleCount; NSDecimal *toBytes = (NSDecimal *)destData.mutableBytes; while ( fromBytes < lastSample ) { - *toBytes++ = CPTDecimalFromDouble( creal(*fromBytes++) ); + *toBytes++ = CPTDecimalFromDouble(creal(*fromBytes++)); } } break; @@ -2249,7 +2249,7 @@ case sizeof(double complex): switch ( destDataType->sampleBytes ) { case sizeof(NSDecimal): { // NSDecimal -> NSDecimal - memcpy( destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(NSDecimal) ); + memcpy(destData.mutableBytes, sourceData.bytes, sampleCount * sizeof(NSDecimal)); } break; } @@ -2268,7 +2268,7 @@ case sizeof(NSDecimal): * @param sourceData The data buffer. * @param sampleSize The number of bytes in each sample stored in sourceData. **/ --(void)swapByteOrderForData:(NSMutableData *)sourceData sampleSize:(size_t)sampleSize +-(void)swapByteOrderForData:(nonnull NSMutableData *)sourceData sampleSize:(size_t)sampleSize { NSUInteger sampleCount; diff --git a/framework/Source/CPTNumericData+TypeConversions_Generation.py b/framework/Source/CPTNumericData+TypeConversions_Generation.py index 1f340c706..1bad205f8 100644 --- a/framework/Source/CPTNumericData+TypeConversions_Generation.py +++ b/framework/Source/CPTNumericData+TypeConversions_Generation.py @@ -46,9 +46,9 @@ "uint32_t" : "0", "uint64_t" : "0", "float" : "NAN", - "double" : "NAN", - "float complex" : "NAN", - "double complex" : "NAN", + "double" : "(double)NAN", + "float complex" : "CMPLXF(NAN, NAN)", + "double complex" : "CMPLX(NAN, NAN)", "NSDecimal" : "CPTDecimalNaN()" } diff --git a/framework/Source/CPTNumericData.h b/framework/Source/CPTNumericData.h index 83deb4292..0215482fc 100644 --- a/framework/Source/CPTNumericData.h +++ b/framework/Source/CPTNumericData.h @@ -1,7 +1,7 @@ #import "CPTDefinitions.h" #import "CPTNumericDataType.h" -@interface CPTNumericData : NSObject +@interface CPTNumericData : NSObject /// @name Data Buffer /// @{ @@ -20,7 +20,7 @@ /// @name Dimensions /// @{ -@property (nonatomic, readonly, copy, nonnull) CPTNumberArray shape; +@property (nonatomic, readonly, copy, nonnull) CPTNumberArray *shape; @property (nonatomic, readonly) NSUInteger numberOfDimensions; @property (nonatomic, readonly) NSUInteger numberOfSamples; @property (nonatomic, readonly) CPTDataOrder dataOrder; @@ -28,40 +28,40 @@ /// @name Factory Methods /// @{ -+(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray; -+(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray)shapeArray; -+(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray; -+(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray)shapeArray; ++(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray; ++(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray *)shapeArray; ++(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray; ++(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray *)shapeArray; -+(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order; -+(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order; -+(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order; -+(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order; ++(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order; ++(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order; ++(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order; ++(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order; /// @} /// @name Initialization /// @{ --(nonnull instancetype)initWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray; --(nonnull instancetype)initWithData:(nonnull NSData *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray)shapeArray; --(nonnull instancetype)initWithArray:(nonnull CPTNumberArray)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray; --(nonnull instancetype)initWithArray:(nonnull CPTNumberArray)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray)shapeArray; +-(nonnull instancetype)initWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray; +-(nonnull instancetype)initWithData:(nonnull NSData *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray *)shapeArray; +-(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray; +-(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray *)shapeArray; --(nonnull instancetype)initWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithData:(nonnull NSData *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order; --(nonnull instancetype)initWithArray:(nonnull CPTNumberArray)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order; --(nonnull instancetype)initWithArray:(nonnull CPTNumberArray)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order; +-(nonnull instancetype)initWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithData:(nonnull NSData *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order; +-(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order; +-(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData dataTypeString:(nonnull NSString *)newDataTypeString shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; /// @} /// @name Samples /// @{ -(NSUInteger)sampleIndex:(NSUInteger)idx, ...; --(nullable const void *)samplePointer:(NSUInteger)sample; --(nullable const void *)samplePointerAtIndex:(NSUInteger)idx, ...; +-(nullable const void *)samplePointer:(NSUInteger)sample NS_RETURNS_INNER_POINTER; +-(nullable const void *)samplePointerAtIndex:(NSUInteger)idx, ... NS_RETURNS_INNER_POINTER; -(nullable NSNumber *)sampleValue:(NSUInteger)sample; -(nullable NSNumber *)sampleValueAtIndex:(NSUInteger)idx, ...; --(nonnull CPTNumberArray)sampleArray; +-(nonnull CPTNumberArray *)sampleArray; /// @} @end diff --git a/framework/Source/CPTNumericData.m b/framework/Source/CPTNumericData.m index 5e57367f2..b8c5d1243 100644 --- a/framework/Source/CPTNumericData.m +++ b/framework/Source/CPTNumericData.m @@ -1,22 +1,22 @@ #import "CPTNumericData.h" +#import "complex.h" #import "CPTExceptions.h" #import "CPTMutableNumericData.h" #import "CPTNumericData+TypeConversion.h" #import "CPTUtilities.h" -#import "complex.h" /// @cond @interface CPTNumericData() @property (nonatomic, readwrite, copy, nonnull) NSData *data; @property (nonatomic, readwrite, assign) CPTNumericDataType dataType; -@property (nonatomic, readwrite, copy, nonnull) CPTNumberArray shape; +@property (nonatomic, readwrite, copy, nonnull) CPTNumberArray *shape; @property (nonatomic, readwrite, assign) CPTDataOrder dataOrder; --(void)commonInitWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray)shapeArray dataOrder:(CPTDataOrder)order; +-(void)commonInitWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order; -(NSUInteger)sampleIndex:(NSUInteger)idx indexList:(va_list)indexList; --(NSData *)dataFromArray:(CPTNumberArray)newData dataType:(CPTNumericDataType)newDataType; +-(nonnull NSData *)dataFromArray:(nonnull CPTNumberArray *)newData dataType:(CPTNumericDataType)newDataType; @end @@ -46,12 +46,12 @@ -(NSData *)dataFromArray:(CPTNumberArray)newData dataType:(CPTNumericDataType)ne **/ @implementation CPTNumericData -/** @property NSData *data +/** @property nonnull NSData *data * @brief The data buffer. **/ @synthesize data; -/** @property const void *bytes +/** @property nonnull const void *bytes * @brief Returns a pointer to the data buffer’s contents. **/ @dynamic bytes; @@ -81,7 +81,7 @@ @implementation CPTNumericData **/ @dynamic byteOrder; -/** @property CPTNumberArray shape +/** @property nonnull CPTNumberArray *shape * @brief The shape of the data buffer array. * * The shape describes the dimensions of the sample array stored in @@ -115,9 +115,9 @@ @implementation CPTNumericData * @param shapeArray The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in #CPTDataOrderRowsFirst. * @return A new CPTNumericData instance. **/ -+(instancetype)numericDataWithData:(NSData *)newData - dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray ++(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData + dataType:(CPTNumericDataType)newDataType + shape:(nullable CPTNumberArray *)shapeArray { return [[self alloc] initWithData:newData dataType:newDataType @@ -130,9 +130,9 @@ +(instancetype)numericDataWithData:(NSData *)newData * @param shapeArray The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in #CPTDataOrderRowsFirst. * @return A new CPTNumericData instance. **/ -+(instancetype)numericDataWithData:(NSData *)newData - dataTypeString:(NSString *)newDataTypeString - shape:(CPTNumberArray)shapeArray ++(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData + dataTypeString:(nonnull NSString *)newDataTypeString + shape:(nullable CPTNumberArray *)shapeArray { return [[self alloc] initWithData:newData dataType:CPTDataTypeWithDataTypeString(newDataTypeString) @@ -149,9 +149,9 @@ +(instancetype)numericDataWithData:(NSData *)newData * @param shapeArray The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in #CPTDataOrderRowsFirst. * @return A new CPTNumericData instance. **/ -+(instancetype)numericDataWithArray:(CPTNumberArray)newData - dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray ++(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray *)newData + dataType:(CPTNumericDataType)newDataType + shape:(nullable CPTNumberArray *)shapeArray { return [[self alloc] initWithArray:newData dataType:newDataType @@ -168,9 +168,9 @@ +(instancetype)numericDataWithArray:(CPTNumberArray)newData * @param shapeArray The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in #CPTDataOrderRowsFirst. * @return A new CPTNumericData instance. **/ -+(instancetype)numericDataWithArray:(CPTNumberArray)newData - dataTypeString:(NSString *)newDataTypeString - shape:(CPTNumberArray)shapeArray ++(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray *)newData + dataTypeString:(nonnull NSString *)newDataTypeString + shape:(nullable CPTNumberArray *)shapeArray { return [[self alloc] initWithArray:newData dataType:CPTDataTypeWithDataTypeString(newDataTypeString) @@ -184,10 +184,10 @@ +(instancetype)numericDataWithArray:(CPTNumberArray)newData * @param order The data order for a multi-dimensional data array (row-major or column-major). * @return A new CPTNumericData instance. **/ -+(instancetype)numericDataWithData:(NSData *)newData - dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray - dataOrder:(CPTDataOrder)order ++(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData + dataType:(CPTNumericDataType)newDataType + shape:(nullable CPTNumberArray *)shapeArray + dataOrder:(CPTDataOrder)order { return [[self alloc] initWithData:newData dataType:newDataType @@ -202,10 +202,10 @@ +(instancetype)numericDataWithData:(NSData *)newData * @param order The data order for a multi-dimensional data array (row-major or column-major). * @return A new CPTNumericData instance. **/ -+(instancetype)numericDataWithData:(NSData *)newData - dataTypeString:(NSString *)newDataTypeString - shape:(CPTNumberArray)shapeArray - dataOrder:(CPTDataOrder)order ++(nonnull instancetype)numericDataWithData:(nonnull NSData *)newData + dataTypeString:(nonnull NSString *)newDataTypeString + shape:(nullable CPTNumberArray *)shapeArray + dataOrder:(CPTDataOrder)order { return [[self alloc] initWithData:newData dataType:CPTDataTypeWithDataTypeString(newDataTypeString) @@ -224,10 +224,10 @@ +(instancetype)numericDataWithData:(NSData *)newData * @param order The data order for a multi-dimensional data array (row-major or column-major). * @return A new CPTNumericData instance. **/ -+(instancetype)numericDataWithArray:(CPTNumberArray)newData - dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray - dataOrder:(CPTDataOrder)order ++(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray *)newData + dataType:(CPTNumericDataType)newDataType + shape:(nullable CPTNumberArray *)shapeArray + dataOrder:(CPTDataOrder)order { return [[self alloc] initWithArray:newData dataType:newDataType @@ -246,10 +246,10 @@ +(instancetype)numericDataWithArray:(CPTNumberArray)newData * @param order The data order for a multi-dimensional data array (row-major or column-major). * @return A new CPTNumericData instance. **/ -+(instancetype)numericDataWithArray:(CPTNumberArray)newData - dataTypeString:(NSString *)newDataTypeString - shape:(CPTNumberArray)shapeArray - dataOrder:(CPTDataOrder)order ++(nonnull instancetype)numericDataWithArray:(nonnull CPTNumberArray *)newData + dataTypeString:(nonnull NSString *)newDataTypeString + shape:(nullable CPTNumberArray *)shapeArray + dataOrder:(CPTDataOrder)order { return [[self alloc] initWithArray:newData dataType:CPTDataTypeWithDataTypeString(newDataTypeString) @@ -266,9 +266,9 @@ +(instancetype)numericDataWithArray:(CPTNumberArray)newData * @param shapeArray The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in #CPTDataOrderRowsFirst. * @return The initialized CPTNumericData instance. **/ --(instancetype)initWithData:(NSData *)newData - dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray +-(nonnull instancetype)initWithData:(nonnull NSData *)newData + dataType:(CPTNumericDataType)newDataType + shape:(nullable CPTNumberArray *)shapeArray { return [self initWithData:newData dataType:newDataType @@ -282,9 +282,9 @@ -(instancetype)initWithData:(NSData *)newData * @param shapeArray The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in #CPTDataOrderRowsFirst. * @return The initialized CPTNumericData instance. **/ --(instancetype)initWithData:(NSData *)newData - dataTypeString:(NSString *)newDataTypeString - shape:(CPTNumberArray)shapeArray +-(nonnull instancetype)initWithData:(nonnull NSData *)newData + dataTypeString:(nonnull NSString *)newDataTypeString + shape:(nullable CPTNumberArray *)shapeArray { return [self initWithData:newData dataType:CPTDataTypeWithDataTypeString(newDataTypeString) @@ -301,9 +301,9 @@ -(instancetype)initWithData:(NSData *)newData * @param shapeArray The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in #CPTDataOrderRowsFirst. * @return The initialized CPTNumericData instance. **/ --(instancetype)initWithArray:(CPTNumberArray)newData - dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray +-(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData + dataType:(CPTNumericDataType)newDataType + shape:(nullable CPTNumberArray *)shapeArray { return [self initWithData:[self dataFromArray:newData dataType:newDataType] dataType:newDataType @@ -320,9 +320,9 @@ -(instancetype)initWithArray:(CPTNumberArray)newData * @param shapeArray The shape of the data buffer array. Multi-dimensional data arrays will be assumed to be stored in #CPTDataOrderRowsFirst. * @return The initialized CPTNumericData instance. **/ --(instancetype)initWithArray:(CPTNumberArray)newData - dataTypeString:(NSString *)newDataTypeString - shape:(CPTNumberArray)shapeArray +-(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData + dataTypeString:(nonnull NSString *)newDataTypeString + shape:(nullable CPTNumberArray *)shapeArray { return [self initWithArray:newData dataType:CPTDataTypeWithDataTypeString(newDataTypeString) @@ -336,12 +336,12 @@ -(instancetype)initWithArray:(CPTNumberArray)newData * @param order The data order for a multi-dimensional data array (row-major or column-major). * @return The initialized CPTNumericData instance. **/ --(instancetype)initWithData:(NSData *)newData - dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray - dataOrder:(CPTDataOrder)order +-(nonnull instancetype)initWithData:(nonnull NSData *)newData + dataType:(CPTNumericDataType)newDataType + shape:(nullable CPTNumberArray *)shapeArray + dataOrder:(CPTDataOrder)order { - if ( (self = [super init]) ) { + if ((self = [super init])) { [self commonInitWithData:newData dataType:newDataType shape:shapeArray @@ -358,10 +358,10 @@ -(instancetype)initWithData:(NSData *)newData * @param order The data order for a multi-dimensional data array (row-major or column-major). * @return The initialized CPTNumericData instance. **/ --(instancetype)initWithData:(NSData *)newData - dataTypeString:(NSString *)newDataTypeString - shape:(CPTNumberArray)shapeArray - dataOrder:(CPTDataOrder)order +-(nonnull instancetype)initWithData:(nonnull NSData *)newData + dataTypeString:(nonnull NSString *)newDataTypeString + shape:(nullable CPTNumberArray *)shapeArray + dataOrder:(CPTDataOrder)order { return [self initWithData:newData dataType:CPTDataTypeWithDataTypeString(newDataTypeString) @@ -380,10 +380,10 @@ -(instancetype)initWithData:(NSData *)newData * @param order The data order for a multi-dimensional data array (row-major or column-major). * @return The initialized CPTNumericData instance. **/ --(instancetype)initWithArray:(CPTNumberArray)newData - dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray - dataOrder:(CPTDataOrder)order +-(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData + dataType:(CPTNumericDataType)newDataType + shape:(nullable CPTNumberArray *)shapeArray + dataOrder:(CPTDataOrder)order { return [self initWithData:[self dataFromArray:newData dataType:newDataType] dataType:newDataType @@ -402,10 +402,10 @@ -(instancetype)initWithArray:(CPTNumberArray)newData * @param order The data order for a multi-dimensional data array (row-major or column-major). * @return The initialized CPTNumericData instance. **/ --(instancetype)initWithArray:(CPTNumberArray)newData - dataTypeString:(NSString *)newDataTypeString - shape:(CPTNumberArray)shapeArray - dataOrder:(CPTDataOrder)order +-(nonnull instancetype)initWithArray:(nonnull CPTNumberArray *)newData + dataTypeString:(nonnull NSString *)newDataTypeString + shape:(nullable CPTNumberArray *)shapeArray + dataOrder:(CPTDataOrder)order { return [self initWithArray:newData dataType:CPTDataTypeWithDataTypeString(newDataTypeString) @@ -415,31 +415,33 @@ -(instancetype)initWithArray:(CPTNumberArray)newData /// @cond --(instancetype)init +-(nonnull instancetype)init { return [self initWithData:[NSData data] - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; } --(void)commonInitWithData:(NSData *)newData +-(void)commonInitWithData:(nonnull NSData *)newData dataType:(CPTNumericDataType)newDataType - shape:(CPTNumberArray)shapeArray + shape:(nullable CPTNumberArray *)shapeArray dataOrder:(CPTDataOrder)order { - NSParameterAssert( CPTDataTypeIsSupported(newDataType) ); + NSParameterAssert(CPTDataTypeIsSupported(newDataType)); self.data = newData; self.dataType = newDataType; self.dataOrder = order; - if ( shapeArray == nil ) { + CPTNumberArray *theShape = shapeArray; + + if ( theShape == nil ) { self.shape = @[@(self.numberOfSamples)]; } else { NSUInteger prod = 1; - for ( NSNumber *cNum in shapeArray ) { - prod *= [cNum unsignedIntegerValue]; + for ( NSNumber *cNum in theShape ) { + prod *= cNum.unsignedIntegerValue; } if ( prod != self.numberOfSamples ) { @@ -447,7 +449,7 @@ -(void)commonInitWithData:(NSData *)newData format:@"Shape product (%lu) does not match data size (%lu)", (unsigned long)prod, (unsigned long)self.numberOfSamples]; } - self.shape = shapeArray; + self.shape = theShape; } } @@ -463,7 +465,7 @@ -(NSUInteger)numberOfDimensions return self.shape.count; } --(const void *)bytes +-(nonnull const void *)bytes { return self.data.bytes; } @@ -493,7 +495,7 @@ -(CFByteOrder)byteOrder return self.dataType.byteOrder; } --(void)setData:(NSData *)newData +-(void)setData:(nonnull NSData *)newData { if ( data != newData ) { if ( [self isKindOfClass:[CPTMutableNumericData class]] ) { @@ -509,21 +511,21 @@ -(void)setDataType:(CPTNumericDataType)newDataType { CPTNumericDataType oldDataType = dataType; - if ( CPTDataTypeEqualToDataType(oldDataType, newDataType) ) { + if ( CPTDataTypeEqualToDataType(oldDataType, newDataType)) { return; } - NSParameterAssert( CPTDataTypeIsSupported(newDataType) ); + NSParameterAssert(CPTDataTypeIsSupported(newDataType)); NSParameterAssert(newDataType.dataTypeFormat != CPTUndefinedDataType); NSParameterAssert(newDataType.byteOrder != CFByteOrderUnknown); dataType = newDataType; - if ( ( oldDataType.sampleBytes == sizeof(int8_t) ) && ( newDataType.sampleBytes == sizeof(int8_t) ) ) { + if ((oldDataType.sampleBytes == sizeof(int8_t)) && (newDataType.sampleBytes == sizeof(int8_t))) { return; } - if ( (oldDataType.dataTypeFormat != CPTUndefinedDataType) && (oldDataType.byteOrder != CFByteOrderUnknown) ) { + if ((oldDataType.dataTypeFormat != CPTUndefinedDataType) && (oldDataType.byteOrder != CFByteOrderUnknown)) { NSMutableData *myData = (NSMutableData *)self.data; CFByteOrder hostByteOrder = CFByteOrderGetCurrent(); @@ -549,7 +551,7 @@ -(void)setDataType:(CPTNumericDataType)newDataType } } --(void)setShape:(CPTNumberArray)newShape +-(void)setShape:(nonnull CPTNumberArray *)newShape { if ( newShape != shape ) { shape = [newShape copy]; @@ -559,7 +561,7 @@ -(void)setShape:(CPTNumberArray)newShape if ( [myData isKindOfClass:[NSMutableData class]] ) { NSUInteger sampleCount = 1; for ( NSNumber *num in shape ) { - sampleCount *= [num unsignedIntegerValue]; + sampleCount *= num.unsignedIntegerValue; } myData.length = sampleCount * self.sampleBytes; @@ -574,13 +576,13 @@ -(void)setShape:(CPTNumberArray)newShape /** @brief Gets the offset of a given sample in the data buffer. * @param idx The zero-based indices into a multi-dimensional sample array. Each index should of type @ref NSUInteger and the number of indices - * (including @par{index}) should match the @ref numberOfDimensions. + * (including @par{idx}) should match the @ref numberOfDimensions. * @return The sample offset in the data buffer. To get the byte offset, multiply this value by * @ref sampleBytes. If any index is greater than or equal to the corresponding * dimension of the data buffer, this method returns @ref NSNotFound. **/ -(NSUInteger)sampleIndex:(NSUInteger)idx, ... - { +{ va_list indices; va_start(indices, idx); @@ -667,11 +669,11 @@ case sizeof(double): case CPTComplexFloatingPointDataType: switch ( self.sampleBytes ) { case sizeof(float complex): - result = @( crealf(*(const float complex *)[self samplePointer:sample]) ); + result = @(crealf(*(const float complex *)[self samplePointer:sample])); break; case sizeof(double complex): - result = @( creal(*(const double complex *)[self samplePointer:sample]) ); + result = @(creal(*(const double complex *)[self samplePointer:sample])); break; } break; @@ -694,14 +696,14 @@ case sizeof(NSDecimal): /** @brief Gets the value of a given sample in the data buffer. * @param idx The zero-based indices into a multi-dimensional sample array. Each index should of type @ref NSUInteger and the number of indices - * (including @par{index}) should match the @ref numberOfDimensions. + * (including @par{idx}) should match the @ref numberOfDimensions. * @return The sample value wrapped in an instance of NSNumber or @nil if any of the sample indices are out of bounds. * * @note NSNumber does not support complex numbers. Complex number types will be cast to * @float or @double before being wrapped in an instance of NSNumber. **/ -(NSNumber *)sampleValueAtIndex:(NSUInteger)idx, ... - { +{ NSUInteger newIndex; if ( self.numberOfDimensions > 1 ) { @@ -723,10 +725,10 @@ -(NSNumber *)sampleValueAtIndex:(NSUInteger)idx, ... * @param sample The zero-based index into the sample array. The array is treated as if it only has one dimension. * @return A pointer to the sample or @NULL if the sample index is out of bounds. **/ --(const void *)samplePointer:(NSUInteger)sample +-(nullable const void *)samplePointer:(NSUInteger)sample { if ( sample < self.numberOfSamples ) { - return (const void *)( (const char *)self.bytes + sample * self.sampleBytes ); + return (const void *)((const char *)self.bytes + sample * self.sampleBytes); } else { return NULL; @@ -735,11 +737,11 @@ -(const void *)samplePointer:(NSUInteger)sample /** @brief Gets a pointer to a given sample in the data buffer. * @param idx The zero-based indices into a multi-dimensional sample array. Each index should of type @ref NSUInteger and the number of indices - * (including @par{index}) should match the @ref numberOfDimensions. + * (including @par{idx}) should match the @ref numberOfDimensions. * @return A pointer to the sample or @NULL if any of the sample indices are out of bounds. **/ --(const void *)samplePointerAtIndex:(NSUInteger)idx, ... - { +-(nullable const void *)samplePointerAtIndex:(NSUInteger)idx, ... +{ NSUInteger newIndex; if ( self.numberOfDimensions > 1 ) { @@ -763,11 +765,11 @@ -(const void *)samplePointerAtIndex:(NSUInteger)idx, ... * @note NSNumber does not support complex numbers. Complex number types will be cast to * @float or @double before being wrapped in an instance of NSNumber. **/ --(CPTNumberArray)sampleArray +-(nonnull CPTNumberArray *)sampleArray { NSUInteger sampleCount = self.numberOfSamples; - CPTMutableNumberArray samples = [[NSMutableArray alloc] initWithCapacity:sampleCount]; + CPTMutableNumberArray *samples = [[NSMutableArray alloc] initWithCapacity:sampleCount]; for ( NSUInteger i = 0; i < sampleCount; i++ ) { NSNumber *sampleValue = [self sampleValue:i]; @@ -776,7 +778,7 @@ -(CPTNumberArray)sampleArray } } - CPTNumberArray result = [NSArray arrayWithArray:samples]; + CPTNumberArray *result = [NSArray arrayWithArray:samples]; return result; } @@ -787,7 +789,7 @@ -(CPTNumberArray)sampleArray * @brief Gets the offset of a given sample in the data buffer. This method does not call @par{va_end()} * on the @par{indexList}. * @param idx The zero-based indices into a multi-dimensional sample array. Each index should of type @ref NSUInteger and the number of indices - * (including @par{index}) should match the @ref numberOfDimensions. + * (including @par{idx}) should match the @ref numberOfDimensions. * @param indexList A @par{va_list} of the additional indices. * @return The sample offset in the data buffer. To get the byte offset, multiply this value by * @ref sampleBytes. If any index is greater than or equal to the corresponding @@ -795,14 +797,14 @@ -(CPTNumberArray)sampleArray **/ -(NSUInteger)sampleIndex:(NSUInteger)idx indexList:(va_list)indexList { - CPTNumberArray theShape = self.shape; - NSUInteger numDims = theShape.count; - NSUInteger newIndex = 0; + CPTNumberArray *theShape = self.shape; + NSUInteger numDims = theShape.count; + NSUInteger newIndex = 0; if ( numDims > 1 ) { - NSUInteger *dims = calloc( numDims, sizeof(NSUInteger) ); - NSUInteger *dimProducts = calloc( numDims, sizeof(NSUInteger) ); - NSUInteger *indices = calloc( numDims, sizeof(NSUInteger) ); + NSUInteger *dims = calloc(numDims, sizeof(NSUInteger)); + NSUInteger *dimProducts = calloc(numDims, sizeof(NSUInteger)); + NSUInteger *indices = calloc(numDims, sizeof(NSUInteger)); NSUInteger argIndex = 0; indices[0] = idx; @@ -810,7 +812,7 @@ -(NSUInteger)sampleIndex:(NSUInteger)idx indexList:(va_list)indexList if ( argIndex > 0 ) { indices[argIndex] = va_arg(indexList, NSUInteger); } - dims[argIndex] = [dim unsignedIntegerValue]; + dims[argIndex] = dim.unsignedIntegerValue; if ( indices[argIndex] >= dims[argIndex] ) { free(dims); @@ -861,9 +863,9 @@ -(NSUInteger)sampleIndex:(NSUInteger)idx indexList:(va_list)indexList return newIndex; } --(NSData *)dataFromArray:(CPTNumberArray)newData dataType:(CPTNumericDataType)newDataType +-(nonnull NSData *)dataFromArray:(nonnull CPTNumberArray *)newData dataType:(CPTNumericDataType)newDataType { - NSParameterAssert( CPTDataTypeIsSupported(newDataType) ); + NSParameterAssert(CPTDataTypeIsSupported(newDataType)); NSParameterAssert(newDataType.dataTypeFormat != CPTUndefinedDataType); NSParameterAssert(newDataType.dataTypeFormat != CPTComplexFloatingPointDataType); @@ -1021,7 +1023,7 @@ case sizeof(double): *toBytes++ = (double)[sample doubleValue]; } else { - *toBytes++ = NAN; + *toBytes++ = (double)NAN; } } } @@ -1039,7 +1041,7 @@ case sizeof(float complex): *toBytes++ = (float complex)[sample floatValue]; } else { - *toBytes++ = NAN; + *toBytes++ = CMPLXF(NAN, NAN); } } } @@ -1053,7 +1055,7 @@ case sizeof(double complex): *toBytes++ = (double complex)[sample doubleValue]; } else { - *toBytes++ = NAN; + *toBytes++ = CMPLX(NAN, NAN); } } } @@ -1083,7 +1085,7 @@ case sizeof(NSDecimal): // End of code generated with "CPTNumericData+TypeConversions_Generation.py" // ======================================================================== - if ( ( newDataType.byteOrder != CFByteOrderGetCurrent() ) && (newDataType.byteOrder != CFByteOrderUnknown) ) { + if ((newDataType.byteOrder != CFByteOrderGetCurrent()) && (newDataType.byteOrder != CFByteOrderUnknown)) { [self swapByteOrderForData:sampleData sampleSize:newDataType.sampleBytes]; } @@ -1097,12 +1099,12 @@ case sizeof(NSDecimal): /// @cond --(NSString *)description +-(nonnull NSString *)description { NSUInteger sampleCount = self.numberOfSamples; NSMutableString *descriptionString = [NSMutableString stringWithCapacity:sampleCount * 3]; - [descriptionString appendFormat:@"<%@ [", [super description]]; + [descriptionString appendFormat:@"<%@ [", super.description]; for ( NSUInteger i = 0; i < sampleCount; i++ ) { if ( i > 0 ) { [descriptionString appendFormat:@","]; @@ -1124,7 +1126,7 @@ -(NSString *)description /// @cond --(id)mutableCopyWithZone:(NSZone *)zone +-(nonnull id)mutableCopyWithZone:(nullable NSZone *)zone { return [[CPTMutableNumericData allocWithZone:zone] initWithData:self.data dataType:self.dataType @@ -1135,11 +1137,11 @@ -(id)mutableCopyWithZone:(NSZone *)zone /// @endcond #pragma mark - -#pragma mark NSCoding Methods +#pragma mark NSCopying Methods /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { return [[[self class] allocWithZone:zone] initWithData:self.data dataType:self.dataType @@ -1150,36 +1152,21 @@ -(id)copyWithZone:(NSZone *)zone /// @endcond #pragma mark - -#pragma mark NSCopying Methods +#pragma mark NSCoding Methods /// @cond --(void)encodeWithCoder:(NSCoder *)encoder +-(void)encodeWithCoder:(nonnull NSCoder *)encoder { - if ( [encoder allowsKeyedCoding] ) { - [encoder encodeObject:self.data forKey:@"CPTNumericData.data"]; - - CPTNumericDataType selfDataType = self.dataType; - [encoder encodeInteger:selfDataType.dataTypeFormat forKey:@"CPTNumericData.dataType.dataTypeFormat"]; - [encoder encodeInt64:(int64_t)selfDataType.sampleBytes forKey:@"CPTNumericData.dataType.sampleBytes"]; - [encoder encodeInt64:selfDataType.byteOrder forKey:@"CPTNumericData.dataType.byteOrder"]; - - [encoder encodeObject:self.shape forKey:@"CPTNumericData.shape"]; - [encoder encodeInteger:self.dataOrder forKey:@"CPTNumericData.dataOrder"]; - } - else { - [encoder encodeObject:self.data]; + [encoder encodeObject:self.data forKey:@"CPTNumericData.data"]; - CPTNumericDataType selfDataType = self.dataType; - [encoder encodeValueOfObjCType:@encode(CPTDataTypeFormat) at:&(selfDataType.dataTypeFormat)]; - [encoder encodeValueOfObjCType:@encode(size_t) at:&(selfDataType.sampleBytes)]; - [encoder encodeValueOfObjCType:@encode(CFByteOrder) at:&(selfDataType.byteOrder)]; + CPTNumericDataType selfDataType = self.dataType; + [encoder encodeInteger:selfDataType.dataTypeFormat forKey:@"CPTNumericData.dataType.dataTypeFormat"]; + [encoder encodeInt64:(int64_t)selfDataType.sampleBytes forKey:@"CPTNumericData.dataType.sampleBytes"]; + [encoder encodeInt64:selfDataType.byteOrder forKey:@"CPTNumericData.dataType.byteOrder"]; - [encoder encodeObject:self.shape]; - - CPTDataOrder order = self.dataOrder; - [encoder encodeValueOfObjCType:@encode(CPTDataOrder) at:&order]; - } + [encoder encodeObject:self.shape forKey:@"CPTNumericData.shape"]; + [encoder encodeInteger:self.dataOrder forKey:@"CPTNumericData.dataOrder"]; } /// @endcond @@ -1188,34 +1175,25 @@ -(void)encodeWithCoder:(NSCoder *)encoder * @param decoder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)decoder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder { - if ( (self = [super init]) ) { + if ((self = [super init])) { NSData *newData; CPTNumericDataType newDataType; - CPTNumberArray shapeArray; + CPTNumberArray *shapeArray; CPTDataOrder order; - if ( [decoder allowsKeyedCoding] ) { - newData = [decoder decodeObjectForKey:@"CPTNumericData.data"]; - - newDataType = CPTDataType( (CPTDataTypeFormat)[decoder decodeIntegerForKey: @"CPTNumericData.dataType.dataTypeFormat"], - (size_t)[decoder decodeInt64ForKey: @"CPTNumericData.dataType.sampleBytes"], - (CFByteOrder)[decoder decodeInt64ForKey: @"CPTNumericData.dataType.byteOrder"] ); + newData = [decoder decodeObjectOfClass:[NSData class] + forKey:@"CPTNumericData.data"]; - shapeArray = [decoder decodeObjectForKey:@"CPTNumericData.shape"]; - order = (CPTDataOrder)[decoder decodeIntegerForKey : @"CPTNumericData.dataOrder"]; - } - else { - newData = [decoder decodeObject]; + newDataType = CPTDataType((CPTDataTypeFormat)[decoder decodeIntegerForKey:@"CPTNumericData.dataType.dataTypeFormat"], + (size_t)[decoder decodeInt64ForKey:@"CPTNumericData.dataType.sampleBytes"], + (CFByteOrder)[decoder decodeInt64ForKey:@"CPTNumericData.dataType.byteOrder"]); - [decoder decodeValueOfObjCType:@encode(CPTDataTypeFormat) at:&(newDataType.dataTypeFormat)]; - [decoder decodeValueOfObjCType:@encode(size_t) at:&(newDataType.sampleBytes)]; - [decoder decodeValueOfObjCType:@encode(CFByteOrder) at:&(newDataType.byteOrder)]; + shapeArray = [decoder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTNumericData.shape"]; - shapeArray = [decoder decodeObject]; - [decoder decodeValueOfObjCType:@encode(CPTDataOrder) at:&order]; - } + order = (CPTDataOrder)[decoder decodeIntegerForKey:@"CPTNumericData.dataOrder"]; [self commonInitWithData:newData dataType:newDataType shape:shapeArray dataOrder:order]; } @@ -1223,4 +1201,16 @@ -(instancetype)initWithCoder:(NSCoder *)decoder return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end diff --git a/framework/Source/CPTNumericDataTests.m b/framework/Source/CPTNumericDataTests.m index c0eaeb007..26e0ca4c6 100644 --- a/framework/Source/CPTNumericDataTests.m +++ b/framework/Source/CPTNumericDataTests.m @@ -15,7 +15,7 @@ -(void)testNilShapeGivesSingleDimension NSUInteger expected = 1; XCTAssertEqual(actual, expected, @"numberOfDimensions == 1"); - expected = [nd.shape count]; + expected = nd.shape.count; XCTAssertEqual(actual, expected, @"numberOfDimensions == 1"); } @@ -27,7 +27,7 @@ -(void)testNumberOfDimensionsGivesShapeCount NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:shape]; XCTAssertEqual(nd.numberOfDimensions, nd.shape.count, @"numberOfDimensions == shape.count == 3"); @@ -46,7 +46,7 @@ -(void)testNilShapeCorrectElementCount NSUInteger prod = 1; for ( NSNumber *num in nd.shape ) { - prod *= [num unsignedIntValue]; + prod *= num.unsignedIntegerValue; } XCTAssertEqual(prod, nElems, @"prod == nElems"); @@ -63,7 +63,7 @@ -(void)testIllegalShapeRaisesException NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(NSUInteger)]; XCTAssertThrowsSpecificNamed(testData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTUnsignedIntegerDataType, sizeof(NSUInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTUnsignedIntegerDataType, sizeof(NSUInteger), NSHostByteOrder()) shape:shape], NSException, CPTNumericDataException, @@ -78,7 +78,7 @@ -(void)testReturnsDataLength shape:nil]; NSUInteger expected = 10 * sizeof(float); - NSUInteger actual = [nd.data length]; + NSUInteger actual = nd.data.length; XCTAssertEqual(expected, actual, @"data length"); } @@ -87,14 +87,14 @@ -(void)testBytesEqualDataBytes { NSUInteger nElements = 10; NSMutableData *data = [NSMutableData dataWithLength:nElements * sizeof(NSInteger)]; - NSInteger *intData = (NSInteger *)[data mutableBytes]; + NSInteger *intData = (NSInteger *)data.mutableBytes; for ( NSUInteger i = 0; i < nElements; i++ ) { intData[i] = (NSInteger)i; } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; NSData *expected = data; @@ -106,17 +106,17 @@ -(void)testArchivingRoundTrip { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - CPTNumericData *nd2 = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:nd]]; + CPTNumericData *nd2 = [self archiveRoundTrip:nd]; XCTAssertTrue([nd.data isEqualToData:nd2.data], @"equal data"); @@ -133,17 +133,17 @@ -(void)testKeyedArchivingRoundTrip { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - CPTNumericData *nd2 = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:nd]]; + CPTNumericData *nd2 = [self archiveRoundTrip:nd]; XCTAssertTrue([nd.data isEqualToData:nd2.data], @"equal data"); @@ -160,27 +160,27 @@ -(void)testNumberOfSamplesCorrectForDataType { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd numberOfSamples], nElems, @"numberOfSamples == nElems"); nElems = 10; data = [NSMutableData dataWithLength:nElems * sizeof(char)]; - char *charSamples = (char *)[data mutableBytes]; + char *charSamples = (char *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { charSamples[i] = (char)lrint(sin(i) * 100.0); } nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(char), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(char), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd numberOfSamples], nElems, @"numberOfSamples == nElems"); @@ -190,14 +190,14 @@ -(void)testDataTypeAccessorsCorrectForDataType { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTNumericData *nd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqual([nd dataTypeFormat], CPTFloatingPointDataType, @"dataTypeFormat"); @@ -209,23 +209,23 @@ -(void)testConvertTypeConvertsType { NSUInteger numberOfSamples = 10; NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i); } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *dd = [fd dataByConvertingToType:CPTFloatingPointDataType sampleBytes:sizeof(double) byteOrder:NSHostByteOrder()]; - const double *doubleSamples = (const double *)[dd.data bytes]; + const double *doubleSamples = (const double *)dd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertTrue(samples[i] == doubleSamples[i], @"(float)%g != (double)%g", samples[i], doubleSamples[i]); + XCTAssertTrue((double)samples[i] == doubleSamples[i], @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i]); } } @@ -233,19 +233,19 @@ -(void)testSamplePointerCorrect { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; - XCTAssertEqual( ( (const float *)[fd.data bytes] ) + 4, (const float *)[fd samplePointer:4], @"%p,%p", samples + 4, (const float *)[fd samplePointer:4] ); - XCTAssertEqual( ( (const float *)[fd.data bytes] ), (const float *)[fd samplePointer:0], @"" ); - XCTAssertEqual( ( (const float *)[fd.data bytes] ) + nElems - 1, (const float *)[fd samplePointer:nElems - 1], @"" ); + XCTAssertEqual(((const float *)[fd.data bytes]) + 4, (const float *)[fd samplePointer:4], @"%p,%p", samples + 4, (const float *)[fd samplePointer:4]); + XCTAssertEqual(((const float *)[fd.data bytes]), (const float *)[fd samplePointer:0], @""); + XCTAssertEqual(((const float *)[fd.data bytes]) + nElems - 1, (const float *)[fd samplePointer:nElems - 1], @""); XCTAssertNil([fd samplePointer:nElems], @"too many samples"); } @@ -253,14 +253,14 @@ -(void)testSampleValueCorrect { NSUInteger nElems = 10; NSMutableData *data = [NSMutableData dataWithLength:nElems * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < nElems; i++ ) { samples[i] = sinf(i); } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; XCTAssertEqualWithAccuracy([[fd sampleValue:0] doubleValue], sin(0), 0.01, @"sample value"); @@ -273,23 +273,23 @@ -(void)testSampleIndexRowsFirstOrder const NSUInteger cols = 4; NSMutableData *data = [NSMutableData dataWithLength:rows * cols * sizeof(NSUInteger)]; - NSUInteger *samples = (NSUInteger *)[data mutableBytes]; + NSUInteger *samples = (NSUInteger *)data.mutableBytes; for ( NSUInteger i = 0; i < rows * cols; i++ ) { samples[i] = i; } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(NSUInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(NSUInteger), NSHostByteOrder()) shape:@[@(rows), @(cols)] dataOrder:CPTDataOrderRowsFirst]; - XCTAssertEqual( ([fd sampleIndex:rows, 0]), (NSUInteger)NSNotFound, @"row index out of range" ); - XCTAssertEqual( ([fd sampleIndex:0, cols]), (NSUInteger)NSNotFound, @"column index out of range" ); + XCTAssertEqual(([fd sampleIndex:rows, 0]), (NSUInteger)NSNotFound, @"row index out of range"); + XCTAssertEqual(([fd sampleIndex:0, cols]), (NSUInteger)NSNotFound, @"column index out of range"); for ( NSUInteger i = 0; i < rows; i++ ) { for ( NSUInteger j = 0; j < cols; j++ ) { - XCTAssertEqual( ([fd sampleIndex:i, j]), i * cols + j, @"(%lu, %lu)", (unsigned long)i, (unsigned long)j ); + XCTAssertEqual(([fd sampleIndex:i, j]), i * cols + j, @"(%lu, %lu)", (unsigned long)i, (unsigned long)j); } } } @@ -300,23 +300,23 @@ -(void)testSampleIndexColumnsFirstOrder const NSUInteger cols = 4; NSMutableData *data = [NSMutableData dataWithLength:rows * cols * sizeof(NSUInteger)]; - NSUInteger *samples = (NSUInteger *)[data mutableBytes]; + NSUInteger *samples = (NSUInteger *)data.mutableBytes; for ( NSUInteger i = 0; i < rows * cols; i++ ) { samples[i] = i; } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(NSUInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(NSUInteger), NSHostByteOrder()) shape:@[@(rows), @(cols)] dataOrder:CPTDataOrderColumnsFirst]; - XCTAssertEqual( ([fd sampleIndex:rows, 0]), (NSUInteger)NSNotFound, @"row index out of range" ); - XCTAssertEqual( ([fd sampleIndex:0, cols]), (NSUInteger)NSNotFound, @"column index out of range" ); + XCTAssertEqual(([fd sampleIndex:rows, 0]), (NSUInteger)NSNotFound, @"row index out of range"); + XCTAssertEqual(([fd sampleIndex:0, cols]), (NSUInteger)NSNotFound, @"column index out of range"); for ( NSUInteger i = 0; i < rows; i++ ) { for ( NSUInteger j = 0; j < cols; j++ ) { - XCTAssertEqual( ([fd sampleIndex:i, j]), i + j * rows, @"(%lu, %lu)", (unsigned long)i, (unsigned long)j ); + XCTAssertEqual(([fd sampleIndex:i, j]), i + j * rows, @"(%lu, %lu)", (unsigned long)i, (unsigned long)j); } } } diff --git a/framework/Source/CPTNumericDataType.h b/framework/Source/CPTNumericDataType.h index 51d9017bc..0898f7b60 100644 --- a/framework/Source/CPTNumericDataType.h +++ b/framework/Source/CPTNumericDataType.h @@ -16,7 +16,7 @@ typedef NS_ENUM (NSInteger, CPTDataTypeFormat) { * @brief Enumeration of memory arrangements for multi-dimensional data arrays. * @see See Wikipedia for more information. **/ -typedef NS_ENUM (NSInteger, CPTDataOrder) { +typedef NS_CLOSED_ENUM(NSInteger, CPTDataOrder) { CPTDataOrderRowsFirst, ///< Numeric data is arranged in row-major order. CPTDataOrderColumnsFirst ///< Numeric data is arranged in column-major order. }; @@ -26,8 +26,8 @@ typedef NS_ENUM (NSInteger, CPTDataOrder) { **/ typedef struct _CPTNumericDataType { CPTDataTypeFormat dataTypeFormat; ///< Data type format - size_t sampleBytes; ///< Number of bytes in each sample - CFByteOrder byteOrder; ///< Byte order + size_t sampleBytes; ///< Number of bytes in each sample + CFByteOrder byteOrder; ///< Byte order } CPTNumericDataType; diff --git a/framework/Source/CPTNumericDataType.m b/framework/Source/CPTNumericDataType.m index 4ea9e4171..af098066e 100644 --- a/framework/Source/CPTNumericDataType.m +++ b/framework/Source/CPTNumericDataType.m @@ -2,9 +2,9 @@ #import "complex.h" -static CPTDataTypeFormat DataTypeForDataTypeString(NSString *dataTypeString); -static size_t SampleBytesForDataTypeString(NSString *dataTypeString); -static CFByteOrder ByteOrderForDataTypeString(NSString *dataTypeString); +static CPTDataTypeFormat DataTypeForDataTypeString(NSString *__nonnull dataTypeString); +static size_t SampleBytesForDataTypeString(NSString *__nonnull dataTypeString); +static CFByteOrder ByteOrderForDataTypeString(NSString *__nonnull dataTypeString); #pragma mark - #pragma mark Data type utilities @@ -30,7 +30,7 @@ CPTNumericDataType CPTDataType(CPTDataTypeFormat format, size_t sampleBytes, CFB * @param dataTypeString The data type string. * @return The initialized CPTNumericDataType struct. **/ -CPTNumericDataType CPTDataTypeWithDataTypeString(NSString *dataTypeString) +CPTNumericDataType CPTDataTypeWithDataTypeString(NSString *__nonnull dataTypeString) { CPTNumericDataType type; @@ -161,14 +161,14 @@ case sizeof(double): case sizeof(float complex): case sizeof(double complex): // only the native byte order is supported - valid = ( format.byteOrder == CFByteOrderGetCurrent() ); + valid = (format.byteOrder == CFByteOrderGetCurrent()); break; } break; case CPTDecimalDataType: // only the native byte order is supported - valid = ( format.sampleBytes == sizeof(NSDecimal) ) && ( format.byteOrder == CFByteOrderGetCurrent() ); + valid = (format.sampleBytes == sizeof(NSDecimal)) && (format.byteOrder == CFByteOrderGetCurrent()); break; } @@ -193,7 +193,7 @@ BOOL CPTDataTypeEqualToDataType(CPTNumericDataType dataType1, CPTNumericDataType #pragma mark - #pragma mark Private functions -CPTDataTypeFormat DataTypeForDataTypeString(NSString *dataTypeString) +CPTDataTypeFormat DataTypeForDataTypeString(NSString *__nonnull dataTypeString) { CPTDataTypeFormat result = CPTUndefinedDataType; @@ -202,7 +202,7 @@ CPTDataTypeFormat DataTypeForDataTypeString(NSString *dataTypeString) NSCAssert([dataTypeString length] >= 3, @"dataTypeString is too short"); #pragma clang diagnostic pop - switch ( [[dataTypeString lowercaseString] characterAtIndex:1] ) { + switch ( [dataTypeString.lowercaseString characterAtIndex:1] ) { case 'f': result = CPTFloatingPointDataType; break; @@ -231,19 +231,19 @@ CPTDataTypeFormat DataTypeForDataTypeString(NSString *dataTypeString) return result; } -size_t SampleBytesForDataTypeString(NSString *dataTypeString) +size_t SampleBytesForDataTypeString(NSString *__nonnull dataTypeString) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion" NSCAssert([dataTypeString length] >= 3, @"dataTypeString is too short"); - NSInteger result = [[dataTypeString substringFromIndex:2] integerValue]; + NSInteger result = [dataTypeString substringFromIndex:2].integerValue; NSCAssert(result > 0, @"sample bytes is negative."); #pragma clang diagnostic pop return (size_t)result; } -CFByteOrder ByteOrderForDataTypeString(NSString *dataTypeString) +CFByteOrder ByteOrderForDataTypeString(NSString *__nonnull dataTypeString) { #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion" @@ -252,7 +252,7 @@ CFByteOrder ByteOrderForDataTypeString(NSString *dataTypeString) CFByteOrder result = CFByteOrderUnknown; - switch ( [[dataTypeString lowercaseString] characterAtIndex:0] ) { + switch ( [dataTypeString.lowercaseString characterAtIndex:0] ) { case '=': result = CFByteOrderGetCurrent(); break; diff --git a/framework/Source/CPTNumericDataTypeConversionPerformanceTests.m b/framework/Source/CPTNumericDataTypeConversionPerformanceTests.m index e30e9214a..431999fcf 100644 --- a/framework/Source/CPTNumericDataTypeConversionPerformanceTests.m +++ b/framework/Source/CPTNumericDataTypeConversionPerformanceTests.m @@ -17,7 +17,7 @@ -(void)testFloatToDoubleConversion } CPTNumericData *floatNumericData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), CFByteOrderGetCurrent()) shape:nil]; __block CPTNumericData *doubleNumericData = nil; @@ -37,7 +37,7 @@ -(void)testDoubleToFloatConversion } CPTNumericData *doubleNumericData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; __block CPTNumericData *floatNumericData = nil; @@ -57,7 +57,7 @@ -(void)testIntegerToDoubleConversion } CPTNumericData *integerNumericData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), CFByteOrderGetCurrent()) shape:nil]; __block CPTNumericData *doubleNumericData = nil; @@ -77,7 +77,7 @@ -(void)testDoubleToIntegerConversion } CPTNumericData *doubleNumericData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()) shape:nil]; __block CPTNumericData *integerNumericData = nil; diff --git a/framework/Source/CPTNumericDataTypeConversionTests.m b/framework/Source/CPTNumericDataTypeConversionTests.m index 46f7fb1ff..8fc215339 100644 --- a/framework/Source/CPTNumericDataTypeConversionTests.m +++ b/framework/Source/CPTNumericDataTypeConversionTests.m @@ -11,92 +11,92 @@ @implementation CPTNumericDataTypeConversionTests -(void)testFloatToDoubleConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i); } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *dd = [fd dataByConvertingToType:CPTFloatingPointDataType sampleBytes:sizeof(double) byteOrder:NSHostByteOrder()]; - const double *doubleSamples = (const double *)[dd.data bytes]; + const double *doubleSamples = (const double *)dd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", samples[i], doubleSamples[i] ); + XCTAssertEqualWithAccuracy((double)samples[i], doubleSamples[i], precision, @"(float)%g != (double)%g", (double)samples[i], doubleSamples[i]); } } -(void)testDoubleToFloatConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(double)]; - double *samples = (double *)[data mutableBytes]; + double *samples = (double *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } CPTNumericData *dd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; CPTNumericData *fd = [dd dataByConvertingToType:CPTFloatingPointDataType sampleBytes:sizeof(float) byteOrder:NSHostByteOrder()]; - const float *floatSamples = (const float *)[fd.data bytes]; + const float *floatSamples = (const float *)fd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", floatSamples[i], samples[i] ); + XCTAssertEqualWithAccuracy((double)floatSamples[i], samples[i], precision, @"(float)%g != (double)%g", (double)floatSamples[i], samples[i]); } } -(void)testFloatToIntegerConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(float)]; - float *samples = (float *)[data mutableBytes]; + float *samples = (float *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sinf(i) * 1000.0f; } CPTNumericData *fd = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(float), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(float), NSHostByteOrder()) shape:nil]; CPTNumericData *intData = [fd dataByConvertingToType:CPTIntegerDataType sampleBytes:sizeof(NSInteger) byteOrder:NSHostByteOrder()]; - const NSInteger *intSamples = (const NSInteger *)[intData.data bytes]; + const NSInteger *intSamples = (const NSInteger *)intData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy( (NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", samples[i], (long)intSamples[i] ); + XCTAssertEqualWithAccuracy((NSInteger)samples[i], intSamples[i], precision, @"(float)%g != (NSInteger)%ld", (double)samples[i], (long)intSamples[i]); } } -(void)testIntegerToFloatConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSInteger)]; - NSInteger *samples = (NSInteger *)[data mutableBytes]; + NSInteger *samples = (NSInteger *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = (NSInteger)(sin(i) * 1000.0); } CPTNumericData *intData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ) + dataType:CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()) shape:nil]; CPTNumericData *fd = [intData dataByConvertingToType:CPTFloatingPointDataType sampleBytes:sizeof(float) byteOrder:NSHostByteOrder()]; - const float *floatSamples = (const float *)[fd.data bytes]; + const float *floatSamples = (const float *)fd.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertEqualWithAccuracy(floatSamples[i], (float)samples[i], precision, @"(float)%g != (NSInteger)%ld", floatSamples[i], (long)samples[i]); + XCTAssertEqualWithAccuracy(floatSamples[i], (float)samples[i], (float)precision, @"(float)%g != (NSInteger)%ld", (double)floatSamples[i], (long)samples[i]); } } @@ -133,21 +133,21 @@ -(void)testTypeConversionSwapsByteOrderInteger -(void)testDecimalToDoubleConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSDecimal)]; - NSDecimal *samples = (NSDecimal *)[data mutableBytes]; + NSDecimal *samples = (NSDecimal *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - samples[i] = CPTDecimalFromDouble( sin(i) ); + samples[i] = CPTDecimalFromDouble(sin(i)); } CPTNumericData *decimalData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder() ) + dataType:CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()) shape:nil]; CPTNumericData *doubleData = [decimalData dataByConvertingToType:CPTFloatingPointDataType sampleBytes:sizeof(double) byteOrder:NSHostByteOrder()]; - const double *doubleSamples = (const double *)[doubleData.data bytes]; + const double *doubleSamples = (const double *)doubleData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { XCTAssertEqual(CPTDecimalDoubleValue(samples[i]), doubleSamples[i], @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(samples[i]), doubleSamples[i]); } @@ -156,23 +156,23 @@ -(void)testDecimalToDoubleConversion -(void)testDoubleToDecimalConversion { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(double)]; - double *samples = (double *)[data mutableBytes]; + double *samples = (double *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } CPTNumericData *doubleData = [[CPTNumericData alloc] initWithData:data - dataType:CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ) + dataType:CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()) shape:nil]; CPTNumericData *decimalData = [doubleData dataByConvertingToType:CPTDecimalDataType sampleBytes:sizeof(NSDecimal) byteOrder:NSHostByteOrder()]; - const NSDecimal *decimalSamples = (const NSDecimal *)[decimalData.data bytes]; + const NSDecimal *decimalSamples = (const NSDecimal *)decimalData.data.bytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - XCTAssertTrue(CPTDecimalEquals( decimalSamples[i], CPTDecimalFromDouble(samples[i]) ), @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(decimalSamples[i]), samples[i]); + XCTAssertTrue(CPTDecimalEquals(decimalSamples[i], CPTDecimalFromDouble(samples[i])), @"(NSDecimal)%@ != (double)%g", CPTDecimalStringValue(decimalSamples[i]), samples[i]); } } @@ -196,7 +196,7 @@ -(void)testTypeConversionSwapsByteOrderDouble uint64_t end = *(const uint64_t *)swappedData.bytes; union swap { - double v; + double v; CFSwappedFloat64 sv; } result; @@ -215,18 +215,18 @@ -(void)testTypeConversionSwapsByteOrderDouble -(void)testRoundTripToDoubleArray { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(double)]; - double *samples = (double *)[data mutableBytes]; + double *samples = (double *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = sin(i); } - CPTNumericDataType theDataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), NSHostByteOrder() ); + CPTNumericDataType theDataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), NSHostByteOrder()); CPTNumericData *doubleData = [[CPTNumericData alloc] initWithData:data dataType:theDataType shape:nil]; - CPTNumberArray doubleArray = [doubleData sampleArray]; + CPTNumberArray *doubleArray = [doubleData sampleArray]; XCTAssertEqual(doubleArray.count, numberOfSamples, @"doubleArray size"); CPTNumericData *roundTripData = [[CPTNumericData alloc] initWithArray:doubleArray @@ -243,18 +243,18 @@ -(void)testRoundTripToDoubleArray -(void)testRoundTripToIntegerArray { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSInteger)]; - NSInteger *samples = (NSInteger *)[data mutableBytes]; + NSInteger *samples = (NSInteger *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { samples[i] = (NSInteger)(sin(i) * 1000.0); } - CPTNumericDataType theDataType = CPTDataType( CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder() ); + CPTNumericDataType theDataType = CPTDataType(CPTIntegerDataType, sizeof(NSInteger), NSHostByteOrder()); CPTNumericData *intData = [[CPTNumericData alloc] initWithData:data dataType:theDataType shape:nil]; - CPTNumberArray integerArray = [intData sampleArray]; + CPTNumberArray *integerArray = [intData sampleArray]; XCTAssertEqual(integerArray.count, numberOfSamples, @"integerArray size"); CPTNumericData *roundTripData = [[CPTNumericData alloc] initWithArray:integerArray @@ -271,18 +271,18 @@ -(void)testRoundTripToIntegerArray -(void)testRoundTripToDecimalArray { NSMutableData *data = [NSMutableData dataWithLength:numberOfSamples * sizeof(NSDecimal)]; - NSDecimal *samples = (NSDecimal *)[data mutableBytes]; + NSDecimal *samples = (NSDecimal *)data.mutableBytes; for ( NSUInteger i = 0; i < numberOfSamples; i++ ) { - samples[i] = CPTDecimalFromDouble( sin(i) ); + samples[i] = CPTDecimalFromDouble(sin(i)); } - CPTNumericDataType theDataType = CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder() ); + CPTNumericDataType theDataType = CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), NSHostByteOrder()); CPTNumericData *decimalData = [[CPTNumericData alloc] initWithData:data dataType:theDataType shape:nil]; - CPTNumberArray decimalArray = [decimalData sampleArray]; + CPTNumberArray *decimalArray = [decimalData sampleArray]; XCTAssertEqual(decimalArray.count, numberOfSamples, @"doubleArray size"); CPTNumericData *roundTripData = [[CPTNumericData alloc] initWithArray:decimalArray diff --git a/framework/Source/CPTPathExtensions.h b/framework/Source/CPTPathExtensions.h index a3722a615..c47bfcf5a 100644 --- a/framework/Source/CPTPathExtensions.h +++ b/framework/Source/CPTPathExtensions.h @@ -4,7 +4,12 @@ extern "C" { #endif +CF_IMPLICIT_BRIDGING_ENABLED + __nonnull CGPathRef CPTCreateRoundedRectPath(CGRect rect, CGFloat cornerRadius); + +CF_IMPLICIT_BRIDGING_DISABLED + void CPTAddRoundedRectPath(__nonnull CGContextRef context, CGRect rect, CGFloat cornerRadius); #if __cplusplus diff --git a/framework/Source/CPTPathExtensions.m b/framework/Source/CPTPathExtensions.m index d2f9bed3c..fbd20d904 100644 --- a/framework/Source/CPTPathExtensions.m +++ b/framework/Source/CPTPathExtensions.m @@ -8,12 +8,12 @@ * @param cornerRadius The radius of the rounded corners. * @return The new path. Caller is responsible for releasing this. **/ -CGPathRef CPTCreateRoundedRectPath(CGRect rect, CGFloat cornerRadius) +__nonnull CGPathRef CPTCreateRoundedRectPath(CGRect rect, CGFloat cornerRadius) { - if ( cornerRadius > CPTFloat(0.0) ) { - cornerRadius = MIN( MIN( cornerRadius, rect.size.width * CPTFloat(0.5) ), rect.size.height * CPTFloat(0.5) ); + if ( cornerRadius > CPTFloat(0.0)) { + cornerRadius = MIN(MIN(cornerRadius, rect.size.width * CPTFloat(0.5)), rect.size.height * CPTFloat(0.5)); - // CGPathCreateWithRoundedRect() is available in Mac OS X 10.9 and iOS 7 but not marked in the header file + // CGPathCreateWithRoundedRect() is available in macOS 10.9 and iOS 7 but not marked in the header file #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wunreachable-code" #pragma clang diagnostic ignored "-Wpointer-bool-conversion" @@ -52,7 +52,7 @@ CGPathRef CPTCreateRoundedRectPath(CGRect rect, CGFloat cornerRadius) * @param rect The bounding rectangle for the path. * @param cornerRadius The radius of the rounded corners. **/ -void CPTAddRoundedRectPath(CGContextRef context, CGRect rect, CGFloat cornerRadius) +void CPTAddRoundedRectPath(__nonnull CGContextRef context, CGRect rect, CGFloat cornerRadius) { CGPathRef path = CPTCreateRoundedRectPath(rect, cornerRadius); diff --git a/framework/Source/CPTPieChart.h b/framework/Source/CPTPieChart.h index 427f76386..3d568bb59 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; /// @} /** @@ -28,7 +33,7 @@ typedef NS_ENUM (NSInteger, CPTPieChartField) { /** * @brief Enumeration of pie slice drawing directions. **/ -typedef NS_ENUM (NSInteger, CPTPieDirection) { +typedef NS_CLOSED_ENUM(NSInteger, CPTPieDirection) { CPTPieDirectionClockwise, ///< Pie slices are drawn in a clockwise direction. CPTPieDirectionCounterClockwise ///< Pie slices are drawn in a counter-clockwise direction. }; @@ -49,7 +54,7 @@ typedef NS_ENUM (NSInteger, CPTPieDirection) { * @param indexRange The range of the data indexes of interest. * @return An array of pie slice fills. **/ --(nullable CPTFillArray)sliceFillsForPieChart:(nonnull CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange; +-(nullable CPTFillArray *)sliceFillsForPieChart:(nonnull CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets a fill for the given pie chart slice. * This method will not be called if @@ -72,7 +77,7 @@ typedef NS_ENUM (NSInteger, CPTPieDirection) { * @param indexRange The range of the data indexes of interest. * @return An array of radial offsets. **/ --(nullable CPTNumberArray)radialOffsetsForPieChart:(nonnull CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange; +-(nullable CPTNumberArray *)radialOffsetsForPieChart:(nonnull CPTPieChart *)pieChart recordIndexRange:(NSRange)indexRange; /** @brief @optional Offsets the slice radially from the center point. Can be used to @quote{explode} the chart. * This method will not be called if diff --git a/framework/Source/CPTPieChart.m b/framework/Source/CPTPieChart.m index 7b876ddf1..83bbda7c8 100644 --- a/framework/Source/CPTPieChart.m +++ b/framework/Source/CPTPieChart.m @@ -25,16 +25,16 @@ * @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() -@property (nonatomic, readwrite, copy) CPTNumberArray sliceWidths; -@property (nonatomic, readwrite, copy) CPTFillArray sliceFills; -@property (nonatomic, readwrite, copy) CPTNumberArray sliceRadialOffsets; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *sliceWidths; +@property (nonatomic, readwrite, copy, nullable) CPTFillArray *sliceFills; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *sliceRadialOffsets; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; -(void)updateNormalizedData; @@ -42,8 +42,8 @@ -(CGFloat)radiansForPieSliceValue:(CGFloat)pieSliceValue; -(CGFloat)normalizedPosition:(CGFloat)rawPosition; -(BOOL)angle:(CGFloat)touchedAngle betweenStartAngle:(CGFloat)startingAngle endAngle:(CGFloat)endingAngle; --(void)addSliceToPath:(CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle; --(CPTFill *)sliceFillForIndex:(NSUInteger)idx; +-(void)addSliceToPath:(nonnull CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle width:(CGFloat)currentWidth; +-(nullable CPTFill *)sliceFillForIndex:(NSUInteger)idx; @end @@ -102,12 +102,12 @@ @implementation CPTPieChart **/ @synthesize centerAnchor; -/** @property CPTLineStyle *borderLineStyle +/** @property nullable CPTLineStyle *borderLineStyle * @brief The line style used to outline the pie slices. If @nil, no border is drawn. Defaults to @nil. **/ @synthesize borderLineStyle; -/** @property CPTFill *overlayFill +/** @property nullable CPTFill *overlayFill * @brief A fill drawn on top of the pie chart. * Can be used to add shading and/or gloss effects. Defaults to @nil. **/ @@ -158,11 +158,11 @@ @implementation CPTPieChart * @return A new CPTColor instance corresponding to the default value for this pie slice index. **/ -+(CPTColor *)defaultPieSliceColorForIndex:(NSUInteger)pieSliceIndex ++(nonnull CPTColor *)defaultPieSliceColorForIndex:(NSUInteger)pieSliceIndex { - return [CPTColor colorWithComponentRed:( colorLookupTable[pieSliceIndex % 10][0] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1) ) - green:( colorLookupTable[pieSliceIndex % 10][1] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1) ) - blue:( colorLookupTable[pieSliceIndex % 10][2] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1) ) + return [CPTColor colorWithComponentRed:(colorLookupTable[pieSliceIndex % 10][0] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1)) + green:(colorLookupTable[pieSliceIndex % 10][1] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1)) + blue:(colorLookupTable[pieSliceIndex % 10][2] + (CGFloat)(pieSliceIndex / 10) * CPTFloat(0.1)) alpha:CPTFloat(1.0)]; } @@ -171,7 +171,7 @@ +(CPTColor *)defaultPieSliceColorForIndex:(NSUInteger)pieSliceIndex /// @cond -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else +(void)initialize { @@ -181,6 +181,7 @@ +(void)initialize [self exposeBinding:CPTPieChartBindingPieSliceRadialOffsets]; } } + #endif /// @endcond @@ -206,13 +207,13 @@ +(void)initialize * @param newFrame The frame rectangle. * @return The initialized CPTPieChart object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { - pieRadius = CPTFloat(0.8) * ( MIN(newFrame.size.width, newFrame.size.height) / CPTFloat(2.0) ); + if ((self = [super initWithFrame:newFrame])) { + pieRadius = CPTFloat(0.8) * (MIN(newFrame.size.width, newFrame.size.height) / CPTFloat(2.0)); pieInnerRadius = CPTFloat(0.0); startAngle = CPTFloat(M_PI_2); // pi/2 - endAngle = NAN; + endAngle = CPTNAN; sliceDirection = CPTPieDirectionClockwise; centerAnchor = CPTPointMake(0.5, 0.5); borderLineStyle = nil; @@ -230,9 +231,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTPieChart *theLayer = (CPTPieChart *)layer; pieRadius = theLayer->pieRadius; @@ -256,7 +257,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -274,17 +275,19 @@ -(void)encodeWithCoder:(NSCoder *)coder // pointingDeviceDownIndex } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - pieRadius = [coder decodeCGFloatForKey:@"CPTPieChart.pieRadius"]; - pieInnerRadius = [coder decodeCGFloatForKey:@"CPTPieChart.pieInnerRadius"]; - startAngle = [coder decodeCGFloatForKey:@"CPTPieChart.startAngle"]; - endAngle = [coder decodeCGFloatForKey:@"CPTPieChart.endAngle"]; - sliceDirection = (CPTPieDirection)[coder decodeIntegerForKey : @"CPTPieChart.sliceDirection"]; - centerAnchor = [coder decodeCPTPointForKey:@"CPTPieChart.centerAnchor"]; - borderLineStyle = [[coder decodeObjectForKey:@"CPTPieChart.borderLineStyle"] copy]; - overlayFill = [[coder decodeObjectForKey:@"CPTPieChart.overlayFill"] copy]; + if ((self = [super initWithCoder:coder])) { + pieRadius = [coder decodeCGFloatForKey:@"CPTPieChart.pieRadius"]; + pieInnerRadius = [coder decodeCGFloatForKey:@"CPTPieChart.pieInnerRadius"]; + startAngle = [coder decodeCGFloatForKey:@"CPTPieChart.startAngle"]; + endAngle = [coder decodeCGFloatForKey:@"CPTPieChart.endAngle"]; + sliceDirection = (CPTPieDirection)[coder decodeIntegerForKey:@"CPTPieChart.sliceDirection"]; + centerAnchor = [coder decodeCPTPointForKey:@"CPTPieChart.centerAnchor"]; + borderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTPieChart.borderLineStyle"] copy]; + overlayFill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTPieChart.overlayFill"] copy]; labelRotationRelativeToRadius = [coder decodeBoolForKey:@"CPTPieChart.labelRotationRelativeToRadius"]; pointingDeviceDownIndex = NSNotFound; } @@ -293,6 +296,18 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Data Loading @@ -370,12 +385,12 @@ -(void)updateNormalizedData const double *dataEnd = dataBytes + sampleCount; while ( dataBytes < dataEnd ) { double currentWidth = *dataBytes++; - if ( !isnan(currentWidth) ) { + if ( !isnan(currentWidth)) { valueSum += currentWidth; } } - CPTNumericDataType dataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ); + CPTNumericDataType dataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()); CPTMutableNumericData *normalizedSliceValues = [[CPTMutableNumericData alloc] initWithData:[NSData data] dataType:dataType shape:nil]; normalizedSliceValues.shape = @[@(sampleCount)]; @@ -389,8 +404,8 @@ -(void)updateNormalizedData double *cumulativeBytes = cumulativeSliceValues.mutableBytes; while ( dataBytes < dataEnd ) { double currentWidth = *dataBytes++; - if ( isnan(currentWidth) ) { - *normalizedBytes++ = NAN; + if ( isnan(currentWidth)) { + *normalizedBytes++ = (double)NAN; } else { *normalizedBytes++ = currentWidth / valueSum; @@ -407,12 +422,12 @@ -(void)updateNormalizedData const NSDecimal *dataEnd = dataBytes + sampleCount; while ( dataBytes < dataEnd ) { NSDecimal currentWidth = *dataBytes++; - if ( !NSDecimalIsNotANumber(¤tWidth) ) { + if ( !NSDecimalIsNotANumber(¤tWidth)) { valueSum = CPTDecimalAdd(valueSum, currentWidth); } } - CPTNumericDataType dataType = CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent() ); + CPTNumericDataType dataType = CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent()); CPTMutableNumericData *normalizedSliceValues = [[CPTMutableNumericData alloc] initWithData:[NSData data] dataType:dataType shape:nil]; normalizedSliceValues.shape = @[@(sampleCount)]; @@ -427,7 +442,7 @@ -(void)updateNormalizedData NSDecimal *cumulativeBytes = cumulativeSliceValues.mutableBytes; while ( dataBytes < dataEnd ) { NSDecimal currentWidth = *dataBytes++; - if ( NSDecimalIsNotANumber(¤tWidth) ) { + if ( NSDecimalIsNotANumber(¤tWidth)) { *normalizedBytes++ = decimalNAN; } else { @@ -479,9 +494,9 @@ -(void)reloadSliceFillsInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(sliceFillForPieChart:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableFillArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableFillArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTFill *dataSourceFill = [theDataSource sliceFillForPieChart:self recordIndex:idx]; @@ -525,8 +540,8 @@ -(void)reloadRadialOffsetsInIndexRange:(NSRange)indexRange atRecordIndex:indexRange.location]; } else if ( [theDataSource respondsToSelector:@selector(radialOffsetForPieChart:recordIndex:)] ) { - CPTMutableNumberArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + CPTMutableNumberArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CGFloat offset = [theDataSource radialOffsetForPieChart:self recordIndex:idx]; @@ -544,7 +559,7 @@ -(void)reloadRadialOffsetsInIndexRange:(NSRange)indexRange /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -579,10 +594,10 @@ -(void)renderAsVectorInContext:(CGContextRef)context CPTLineStyle *borderStyle = self.borderLineStyle; CPTFill *overlay = self.overlayFill; - BOOL hasNonZeroOffsets = NO; - CPTNumberArray offsetArray = [self cachedArrayForKey:CPTPieChartBindingPieSliceRadialOffsets]; + BOOL hasNonZeroOffsets = NO; + CPTNumberArray *offsetArray = [self cachedArrayForKey:CPTPieChartBindingPieSliceRadialOffsets]; for ( NSNumber *offset in offsetArray ) { - if ( [offset cgFloatValue] != CPTFloat(0.0) ) { + if ( [offset cgFloatValue] != CPTFloat(0.0)) { hasNonZeroOffsets = YES; break; } @@ -592,17 +607,20 @@ -(void)renderAsVectorInContext:(CGContextRef)context if ( overlay && hasNonZeroOffsets ) { CGFloat radius = self.pieRadius + borderStyle.lineWidth * CPTFloat(0.5); - bounds = CPTRectMake( centerPoint.x - radius, centerPoint.y - radius, radius * CPTFloat(2.0), radius * CPTFloat(2.0) ); + bounds = CPTRectMake(centerPoint.x - radius, centerPoint.y - radius, radius * CPTFloat(2.0), radius * CPTFloat(2.0)); + } + else { + bounds = CGRectZero; } [borderStyle setLineStyleInContext:context]; Class fillClass = [CPTFill class]; while ( currentIndex < sampleCount ) { - CGFloat currentWidth = (CGFloat)[self cachedDoubleForField : CPTPieChartFieldSliceWidthNormalized recordIndex : currentIndex]; + CGFloat currentWidth = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]; - if ( !isnan(currentWidth) ) { - CGFloat radialOffset = [(NSNumber *)offsetArray[currentIndex] cgFloatValue]; + if ( !isnan(currentWidth)) { + CGFloat radialOffset = [(NSNumber *) offsetArray[currentIndex] cgFloatValue]; // draw slice CGContextSaveGState(context); @@ -613,7 +631,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context CGFloat xOffset = CPTFloat(0.0); CGFloat yOffset = CPTFloat(0.0); CGPoint center = centerPoint; - if ( radialOffset != 0.0 ) { + if ( radialOffset != CPTFloat(0.0)) { CGFloat medianAngle = CPTFloat(0.5) * (startingAngle + finishingAngle); xOffset = cos(medianAngle) * radialOffset; yOffset = sin(medianAngle) * radialOffset; @@ -626,8 +644,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context } CGMutablePathRef slicePath = CGPathCreateMutable(); - [self addSliceToPath:slicePath centerPoint:center startingAngle:startingAngle finishingAngle:finishingAngle]; - CGPathCloseSubpath(slicePath); + [self addSliceToPath:slicePath centerPoint:center startingAngle:startingAngle finishingAngle:finishingAngle width:currentWidth]; CPTFill *currentFill = [self sliceFillForIndex:currentIndex]; if ( [currentFill isKindOfClass:fillClass] ) { @@ -672,7 +689,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context CGMutablePathRef fillPath = CGPathCreateMutable(); CGFloat innerRadius = self.pieInnerRadius; - if ( innerRadius > 0.0 ) { + if ( innerRadius > CPTFloat(0.0)) { CGPathAddArc(fillPath, NULL, centerPoint.x, centerPoint.y, self.pieRadius, CPTFloat(0.0), CPTFloat(2.0 * M_PI), false); CGPathAddArc(fillPath, NULL, centerPoint.x, centerPoint.y, innerRadius, CPTFloat(2.0 * M_PI), CPTFloat(0.0), true); } @@ -707,36 +724,49 @@ -(CGFloat)radiansForPieSliceValue:(CGFloat)pieSliceValue angle += pieSliceValue * pieRange; break; } - return angle; + return isnan(endingAngle) ? angle : fmod(angle, CPTFloat(2.0 * M_PI)); } --(void)addSliceToPath:(CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle +-(void)addSliceToPath:(nonnull CGMutablePathRef)slicePath centerPoint:(CGPoint)center startingAngle:(CGFloat)startingAngle finishingAngle:(CGFloat)finishingAngle width:(CGFloat)currentWidth { bool direction = (self.sliceDirection == CPTPieDirectionClockwise) ? true : false; + CGFloat outerRadius = self.pieRadius; CGFloat innerRadius = self.pieInnerRadius; - if ( innerRadius > 0.0 ) { - CGPathAddArc(slicePath, NULL, center.x, center.y, self.pieRadius, startingAngle, finishingAngle, direction); - CGPathAddArc(slicePath, NULL, center.x, center.y, innerRadius, finishingAngle, startingAngle, !direction); + if ( innerRadius > CPTFloat(0.0)) { + if ( currentWidth >= CPTFloat(1.0)) { + CGPathAddArc(slicePath, NULL, center.x, center.y, outerRadius, startingAngle, startingAngle + CPTFloat(2.0 * M_PI), direction); + CGPathAddArc(slicePath, NULL, center.x, center.y, innerRadius, startingAngle + CPTFloat(2.0 * M_PI), startingAngle, !direction); + } + else { + CGPathAddArc(slicePath, NULL, center.x, center.y, outerRadius, startingAngle, finishingAngle, direction); + CGPathAddArc(slicePath, NULL, center.x, center.y, innerRadius, finishingAngle, startingAngle, !direction); + } } else { - CGPathMoveToPoint(slicePath, NULL, center.x, center.y); - CGPathAddArc(slicePath, NULL, center.x, center.y, self.pieRadius, startingAngle, finishingAngle, direction); + if ( currentWidth >= CPTFloat(1.0)) { + CGPathAddEllipseInRect(slicePath, NULL, CGRectMake(center.x - outerRadius, center.y - outerRadius, outerRadius * CPTFloat(2.0), outerRadius * CPTFloat(2.0))); + } + else { + CGPathMoveToPoint(slicePath, NULL, center.x, center.y); + CGPathAddArc(slicePath, NULL, center.x, center.y, outerRadius, startingAngle, finishingAngle, direction); + } } + CGPathCloseSubpath(slicePath); } --(CPTFill *)sliceFillForIndex:(NSUInteger)idx +-(nullable CPTFill *)sliceFillForIndex:(NSUInteger)idx { CPTFill *currentFill = [self cachedValueForKey:CPTPieChartBindingPieSliceFills recordIndex:idx]; - if ( (currentFill == nil) || (currentFill == [CPTPlot nilData]) ) { + if ((currentFill == nil) || (currentFill == [CPTPlot nilData])) { currentFill = [CPTFill fillWithColor:[CPTPieChart defaultPieSliceColorForIndex:idx]]; } return currentFill; } --(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(nonnull CGContextRef)context { [super drawSwatchForLegend:legend atIndex:idx inRect:rect inContext:context]; @@ -783,7 +813,7 @@ -(NSUInteger)pieSliceIndexAtAngle:(CGFloat)angle // of that pie slice. for ( NSUInteger currentIndex = 0; currentIndex < self.cachedDataCount; currentIndex++ ) { CGFloat width = CPTFloat([self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]); - if ( isnan(width) ) { + if ( isnan(width)) { continue; } CGFloat endingAngle = startingAngle; @@ -818,7 +848,7 @@ -(CGFloat)medianAngleForPieSliceIndex:(NSUInteger)idx NSParameterAssert(idx < sampleCount); if ( sampleCount == 0 ) { - return NAN; + return CPTNAN; } CGFloat startingWidth = CPTFloat(0.0); @@ -828,7 +858,7 @@ -(CGFloat)medianAngleForPieSliceIndex:(NSUInteger)idx CGFloat currentWidth = CPTFloat([self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]); // If the slice index is a match... - if ( !isnan(currentWidth) && (idx == currentIndex) ) { + if ( !isnan(currentWidth) && (idx == currentIndex)) { // Compute and return the angle that is halfway between the slice's starting and ending angles CGFloat startingAngle = [self radiansForPieSliceValue:startingWidth]; CGFloat finishingAngle = [self radiansForPieSliceValue:startingWidth + currentWidth]; @@ -839,7 +869,7 @@ -(CGFloat)medianAngleForPieSliceIndex:(NSUInteger)idx } // Searched every pie slice but couldn't find one that corresponds to the given index - return NAN; + return CPTNAN; } #pragma mark - @@ -847,7 +877,7 @@ -(CGFloat)medianAngleForPieSliceIndex:(NSUInteger)idx /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken = 0; @@ -880,7 +910,7 @@ -(NSUInteger)numberOfFields return 1; } --(CPTNumberArray)fieldIdentifiers +-(nonnull CPTNumberArray *)fieldIdentifiers { return @[@(CPTPieChartFieldSliceWidth)]; } @@ -892,7 +922,7 @@ -(CPTNumberArray)fieldIdentifiers /// @cond --(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx +-(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx { CPTLayer *contentLayer = label.contentLayer; CPTPlotArea *thePlotArea = self.plotArea; @@ -909,8 +939,8 @@ -(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInte NSDecimalNumber *yValue = [[NSDecimalNumber alloc] initWithDecimal:plotPoint[CPTCoordinateY]]; label.anchorPlotPoint = @[xValue, yValue]; - CGFloat currentWidth = (CGFloat)[self cachedDoubleForField : CPTPieChartFieldSliceWidthNormalized recordIndex : idx]; - if ( self.hidden || isnan(currentWidth) ) { + CGFloat currentWidth = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:idx]; + if ( self.hidden || isnan(currentWidth)) { contentLayer.hidden = YES; } else { @@ -919,15 +949,15 @@ -(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInte CGFloat startingWidth = CPTFloat(0.0); if ( idx > 0 ) { - startingWidth = (CGFloat)[self cachedDoubleForField : CPTPieChartFieldSliceWidthSum recordIndex : idx - 1]; + startingWidth = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthSum recordIndex:idx - 1]; } CGFloat labelAngle = [self radiansForPieSliceValue:startingWidth + currentWidth / CPTFloat(2.0)]; - label.displacement = CPTPointMake( labelRadius * cos(labelAngle), labelRadius * sin(labelAngle) ); + label.displacement = CPTPointMake(labelRadius * cos(labelAngle), labelRadius * sin(labelAngle)); if ( self.labelRotationRelativeToRadius ) { CGFloat rotation = [self normalizedPosition:self.labelRotation + labelAngle]; - if ( ( rotation > CPTFloat(0.25) ) && ( rotation < CPTFloat(0.75) ) ) { + if ((rotation > CPTFloat(0.25)) && (rotation < CPTFloat(0.75))) { rotation -= CPTFloat(0.5); } @@ -965,7 +995,7 @@ -(NSUInteger)numberOfLegendEntries * @param idx The index of the desired title. * @return The title of the legend entry at the requested index. **/ --(NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx +-(nullable NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx { NSString *legendTitle = nil; @@ -986,7 +1016,7 @@ -(NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx * @param idx The index of the desired title. * @return The styled title of the legend entry at the requested index. **/ --(NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger)idx +-(nullable NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger)idx { NSAttributedString *legendTitle = nil; @@ -1014,8 +1044,8 @@ -(CGFloat)normalizedPosition:(CGFloat)rawPosition CGFloat result = rawPosition; result /= (CGFloat)(2.0 * M_PI); - result = fmod( result, CPTFloat(1.0) ); - if ( result < CPTFloat(0.0) ) { + result = fmod(result, CPTFloat(1.0)); + if ( result < CPTFloat(0.0)) { result += CPTFloat(1.0); } @@ -1026,19 +1056,19 @@ -(BOOL)angle:(CGFloat)touchedAngle betweenStartAngle:(CGFloat)startingAngle endA { switch ( self.sliceDirection ) { case CPTPieDirectionClockwise: - if ( (touchedAngle <= startingAngle) && (touchedAngle >= endingAngle) ) { + if ((touchedAngle <= startingAngle) && (touchedAngle >= endingAngle)) { return YES; } - else if ( ( endingAngle < CPTFloat(0.0) ) && (touchedAngle - CPTFloat(1.0) >= endingAngle) ) { + else if ((endingAngle < CPTFloat(0.0)) && (touchedAngle - CPTFloat(1.0) >= endingAngle)) { return YES; } break; case CPTPieDirectionCounterClockwise: - if ( (touchedAngle >= startingAngle) && (touchedAngle <= endingAngle) ) { + if ((touchedAngle >= startingAngle) && (touchedAngle <= endingAngle)) { return YES; } - else if ( ( endingAngle > CPTFloat(1.0) ) && (touchedAngle + CPTFloat(1.0) <= endingAngle) ) { + else if ((endingAngle > CPTFloat(1.0)) && (touchedAngle + CPTFloat(1.0) <= endingAngle)) { return YES; } break; @@ -1069,7 +1099,7 @@ -(BOOL)angle:(CGFloat)touchedAngle betweenStartAngle:(CGFloat)startingAngle endA * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTGraph *theGraph = self.graph; CPTPlotArea *thePlotArea = self.plotArea; @@ -1078,7 +1108,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact 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:)] || @@ -1134,7 +1164,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { NSUInteger selectedDownIndex = self.pointingDeviceDownIndex; @@ -1147,7 +1177,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio 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:)] || @@ -1230,17 +1260,17 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point switch ( self.sliceDirection ) { case CPTPieDirectionClockwise: - if ( isnan(theEndAngle) || ( 2.0 * M_PI == ABS(theEndAngle - theStartAngle) ) ) { + if ( isnan(theEndAngle) || (CPTFloat(2.0 * M_PI) == ABS(theEndAngle - theStartAngle))) { widthFactor = CPTFloat(1.0); } else { - widthFactor = (CGFloat)(2.0 * M_PI) / ( (CGFloat)(2.0 * M_PI) - ABS(theEndAngle - theStartAngle) ); + widthFactor = CPTFloat(2.0 * M_PI) / (CPTFloat(2.0 * M_PI) - ABS(theEndAngle - theStartAngle)); } for ( NSUInteger currentIndex = 0; currentIndex < sampleCount; currentIndex++ ) { // calculate angles for this slice - CGFloat width = (CGFloat)[self cachedDoubleForField : CPTPieChartFieldSliceWidthNormalized recordIndex : currentIndex]; - if ( isnan(width) ) { + CGFloat width = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]; + if ( isnan(width)) { continue; } @@ -1252,7 +1282,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point CGFloat offsetTouchedAngle = touchedAngle; CGFloat offsetDistanceSquared = distanceSquared; CGFloat radialOffset = [(NSNumber *)[self cachedValueForKey:CPTPieChartBindingPieSliceRadialOffsets recordIndex:currentIndex] cgFloatValue]; - if ( radialOffset != 0.0 ) { + if ( radialOffset != CPTFloat(0.0)) { CGPoint offsetCenter; CGFloat medianAngle = CPTFloat(M_PI) * (startingAngle + endingAngle); offsetCenter = CPTPointMake(centerPoint.x + cos(medianAngle) * radialOffset, @@ -1277,7 +1307,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point } // check distance - if ( angleInSlice && (offsetDistanceSquared >= chartInnerRadiusSquared) && (offsetDistanceSquared <= chartRadiusSquared) ) { + if ( angleInSlice && (offsetDistanceSquared >= chartInnerRadiusSquared) && (offsetDistanceSquared <= chartRadiusSquared)) { return currentIndex; } @@ -1287,7 +1317,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point break; case CPTPieDirectionCounterClockwise: - if ( isnan(theEndAngle) || (theStartAngle == theEndAngle) ) { + if ( isnan(theEndAngle) || (theStartAngle == theEndAngle)) { widthFactor = CPTFloat(1.0); } else { @@ -1296,8 +1326,8 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point for ( NSUInteger currentIndex = 0; currentIndex < sampleCount; currentIndex++ ) { // calculate angles for this slice - CGFloat width = (CGFloat)[self cachedDoubleForField : CPTPieChartFieldSliceWidthNormalized recordIndex : currentIndex]; - if ( isnan(width) ) { + CGFloat width = (CGFloat)[self cachedDoubleForField:CPTPieChartFieldSliceWidthNormalized recordIndex:currentIndex]; + if ( isnan(width)) { continue; } width /= widthFactor; @@ -1308,7 +1338,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point CGFloat offsetTouchedAngle = touchedAngle; CGFloat offsetDistanceSquared = distanceSquared; CGFloat radialOffset = [(NSNumber *)[self cachedValueForKey:CPTPieChartBindingPieSliceRadialOffsets recordIndex:currentIndex] cgFloatValue]; - if ( radialOffset != 0.0 ) { + if ( radialOffset != CPTFloat(0.0)) { CGPoint offsetCenter; CGFloat medianAngle = CPTFloat(M_PI) * (startingAngle + endingAngle); offsetCenter = CPTPointMake(centerPoint.x + cos(medianAngle) * radialOffset, @@ -1333,7 +1363,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point } // check distance - if ( angleInSlice && (offsetDistanceSquared >= chartInnerRadiusSquared) && (offsetDistanceSquared <= chartRadiusSquared) ) { + if ( angleInSlice && (offsetDistanceSquared >= chartInnerRadiusSquared) && (offsetDistanceSquared <= chartRadiusSquared)) { return currentIndex; } @@ -1353,34 +1383,34 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point /// @cond --(CPTNumberArray)sliceWidths +-(nullable CPTNumberArray *)sliceWidths { return [[self cachedNumbersForField:CPTPieChartFieldSliceWidth] sampleArray]; } --(void)setSliceWidths:(CPTNumberArray)newSliceWidths +-(void)setSliceWidths:(nullable CPTNumberArray *)newSliceWidths { [self cacheNumbers:newSliceWidths forField:CPTPieChartFieldSliceWidth]; [self updateNormalizedData]; } --(CPTFillArray)sliceFills +-(nullable CPTFillArray *)sliceFills { return [self cachedArrayForKey:CPTPieChartBindingPieSliceFills]; } --(void)setSliceFills:(CPTFillArray)newSliceFills +-(void)setSliceFills:(nullable CPTFillArray *)newSliceFills { [self cacheArray:newSliceFills forKey:CPTPieChartBindingPieSliceFills]; [self setNeedsDisplay]; } --(CPTNumberArray)sliceRadialOffsets +-(nullable CPTNumberArray *)sliceRadialOffsets { return [self cachedArrayForKey:CPTPieChartBindingPieSliceRadialOffsets]; } --(void)setSliceRadialOffsets:(CPTNumberArray)newSliceRadialOffsets +-(void)setSliceRadialOffsets:(nullable CPTNumberArray *)newSliceRadialOffsets { [self cacheArray:newSliceRadialOffsets forKey:CPTPieChartBindingPieSliceRadialOffsets]; [self setNeedsDisplay]; @@ -1431,7 +1461,7 @@ -(void)setSliceDirection:(CPTPieDirection)newDirection } } --(void)setBorderLineStyle:(CPTLineStyle *)newStyle +-(void)setBorderLineStyle:(nullable CPTLineStyle *)newStyle { if ( borderLineStyle != newStyle ) { borderLineStyle = [newStyle copy]; @@ -1442,7 +1472,7 @@ -(void)setBorderLineStyle:(CPTLineStyle *)newStyle -(void)setCenterAnchor:(CGPoint)newCenterAnchor { - if ( !CGPointEqualToPoint(centerAnchor, newCenterAnchor) ) { + if ( !CGPointEqualToPoint(centerAnchor, newCenterAnchor)) { centerAnchor = newCenterAnchor; [self setNeedsDisplay]; [self repositionAllLabelAnnotations]; @@ -1460,7 +1490,7 @@ -(void)setLabelRotationRelativeToRadius:(BOOL)newLabelRotationRelativeToRadius -(void)setLabelRotation:(CGFloat)newRotation { if ( newRotation != self.labelRotation ) { - [super setLabelRotation:newRotation]; + super.labelRotation = newRotation; if ( self.labelRotationRelativeToRadius ) { [self repositionAllLabelAnnotations]; } diff --git a/framework/Source/CPTPlot.h b/framework/Source/CPTPlot.h index 26c0a37b9..d9dd3d976 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; /// @} /** @@ -31,12 +36,12 @@ typedef NS_ENUM (NSInteger, CPTPlotCachePrecision) { /** * @brief An array of plots. **/ -typedef NSArray<__kindof CPTPlot *> *CPTPlotArray; +typedef NSArray<__kindof CPTPlot *> CPTPlotArray; /** * @brief A mutable array of plots. **/ -typedef NSMutableArray<__kindof CPTPlot *> *CPTMutablePlotArray; +typedef NSMutableArray<__kindof CPTPlot *> CPTMutablePlotArray; #pragma mark - @@ -93,7 +98,7 @@ typedef NSMutableArray<__kindof CPTPlot *> *CPTMutablePlotArray; * @param indexRange The range of the data indexes of interest. * @return A retained C array of data points. **/ --(nullable double *)doublesForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange; +-(nullable double *)doublesForPlot:(nonnull CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange NS_RETURNS_INNER_POINTER; /** @brief @optional Gets a plot data value for the given plot and field. * Implement one and only one of the optional methods in this section. @@ -139,7 +144,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 @@ -162,7 +167,7 @@ typedef NSMutableArray<__kindof CPTPlot *> *CPTMutablePlotArray; /** * @brief Plot delegate. **/ -@protocol CPTPlotDelegate +@protocol CPTPlotDelegate @optional @@ -253,7 +258,7 @@ typedef NSMutableArray<__kindof CPTPlot *> *CPTMutablePlotArray; /// @name Data Source /// @{ -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak id dataSource; +@property (nonatomic, readwrite, cpt_weak_property, nullable) id dataSource; /// @} /// @name Identification @@ -327,8 +332,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 @@ -357,6 +364,8 @@ typedef NSMutableArray<__kindof CPTPlot *> *CPTMutablePlotArray; /// @{ -(nullable CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum; -(nullable CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord; +-(nullable CPTPlotRange *)plotRangeEnclosingField:(NSUInteger)fieldEnum; +-(nullable CPTPlotRange *)plotRangeEnclosingCoordinate:(CPTCoordinate)coord; /// @} /// @name Legends @@ -379,8 +388,8 @@ typedef NSMutableArray<__kindof CPTPlot *> *CPTMutablePlotArray; /// @name Fields /// @{ -(NSUInteger)numberOfFields; --(nonnull CPTNumberArray)fieldIdentifiers; --(nonnull CPTNumberArray)fieldIdentifiersForCoordinate:(CPTCoordinate)coord; +-(nonnull CPTNumberArray *)fieldIdentifiers; +-(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord; -(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field; /// @} diff --git a/framework/Source/CPTPlot.m b/framework/Source/CPTPlot.m index 79aa418bd..5cd2637a0 100644 --- a/framework/Source/CPTPlot.m +++ b/framework/Source/CPTPlot.m @@ -16,13 +16,12 @@ #import "CPTTextLayer.h" #import "CPTUtilities.h" #import "NSCoderExtensions.h" -#import #import /** @defgroup plotAnimation Plots * @brief Plot properties that can be animated using Core Animation. * @if MacOnly - * @since Custom layer property animation is supported on MacOS 10.6 and later. + * @since Custom layer property animation is supported on macOS 10.6 and later. * @endif * @ingroup animation **/ @@ -45,18 +44,18 @@ * @endif **/ -NSString *const CPTPlotBindingDataLabels = @"dataLabels"; ///< Plot data labels. +CPTPlotBinding const CPTPlotBindingDataLabels = @"dataLabels"; ///< Plot data labels. /// @cond @interface CPTPlot() @property (nonatomic, readwrite, assign) BOOL dataNeedsReloading; -@property (nonatomic, readwrite, strong) NSMutableDictionary *cachedData; +@property (nonatomic, readwrite, strong, nonnull) NSMutableDictionary *cachedData; @property (nonatomic, readwrite, assign) BOOL needsRelabel; @property (nonatomic, readwrite, assign) NSRange labelIndexRange; -@property (nonatomic, readwrite, strong) CPTMutableAnnotationArray labelAnnotations; -@property (nonatomic, readwrite, copy) NSArray *dataLabels; +@property (nonatomic, readwrite, strong, nullable) CPTMutableAnnotationArray *labelAnnotations; +@property (nonatomic, readwrite, copy, nullable) CPTLayerArray *dataLabels; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownLabelIndex; @property (nonatomic, readwrite, assign) NSUInteger cachedDataCount; @@ -64,9 +63,9 @@ @interface CPTPlot() @property (nonatomic, readonly, assign) NSUInteger numberOfRecords; --(CPTMutableNumericData *)numericDataForNumbers:(id)numbers; +-(nonnull CPTMutableNumericData *)numericDataForNumbers:(nonnull id)numbers; -(void)setCachedDataType:(CPTNumericDataType)newDataType; --(void)updateContentAnchorForLabel:(CPTPlotSpaceAnnotation *)label; +-(void)updateContentAnchorForLabel:(nonnull CPTPlotSpaceAnnotation *)label; @end @@ -79,7 +78,7 @@ -(void)updateContentAnchorForLabel:(CPTPlotSpaceAnnotation *)label; * Each data series on the graph is represented by a plot. Data is provided by * a datasource that conforms to the CPTPlotDataSource protocol. * @if MacOnly - * Plots also support data binding on MacOS. + * Plots also support data binding on macOS. * @endif * * A Core Plot plot will request its data from the datasource when it is first displayed. @@ -104,19 +103,19 @@ @implementation CPTPlot @dynamic dataLabels; -/** @property cpt_weak id dataSource +/** @property nullable id dataSource * @brief The data source for the plot. **/ @synthesize dataSource; -/** @property NSString *title +/** @property nullable NSString *title * @brief The title of the plot displayed in the legend. * * Assigning a new value to this property also sets the value of the @ref attributedTitle property to @nil. **/ @synthesize title; -/** @property NSAttributedString *attributedTitle +/** @property nullable NSAttributedString *attributedTitle * @brief The styled title of the plot displayed in the legend. * * Assigning a new value to this property also sets the value of the @ref title property to the @@ -124,12 +123,12 @@ @implementation CPTPlot **/ @synthesize attributedTitle; -/** @property CPTPlotSpace *plotSpace +/** @property nullable CPTPlotSpace *plotSpace * @brief The plot space for the plot. **/ @synthesize plotSpace; -/** @property CPTPlotArea *plotArea +/** @property nullable CPTPlotArea *plotArea * @brief The plot area for the plot. **/ @dynamic plotArea; @@ -199,13 +198,13 @@ @implementation CPTPlot **/ @synthesize labelField; -/** @property CPTTextStyle *labelTextStyle +/** @property nullable CPTTextStyle *labelTextStyle * @brief The text style used to draw the data labels. * Set this property to @nil to hide the data labels. **/ @synthesize labelTextStyle; -/** @property NSFormatter *labelFormatter +/** @property nullable NSFormatter *labelFormatter * @brief The number formatter used to format the data labels. * Set this property to @nil to hide the data labels. * If you need a non-numerical label, such as a date, you can use a formatter than turns @@ -214,7 +213,7 @@ @implementation CPTPlot **/ @synthesize labelFormatter; -/** @property CPTShadow *labelShadow +/** @property nullable CPTShadow *labelShadow * @brief The shadow applied to each data label. **/ @synthesize labelShadow; @@ -248,7 +247,7 @@ @implementation CPTPlot /// @cond -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else +(void)initialize { @@ -256,6 +255,7 @@ +(void)initialize [self exposeBinding:CPTPlotBindingDataLabels]; } } + #endif /// @endcond @@ -290,9 +290,9 @@ +(void)initialize * @param newFrame The frame rectangle. * @return The initialized CPTPlot object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { cachedData = [[NSMutableDictionary alloc] initWithCapacity:5]; cachedDataCount = 0; cachePrecision = CPTPlotCachePrecisionAuto; @@ -328,9 +328,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTPlot *theLayer = (CPTPlot *)layer; cachedData = theLayer->cachedData; @@ -368,7 +368,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -402,32 +402,42 @@ -(void)encodeWithCoder:(NSCoder *)coder // pointingDeviceDownLabelIndex } --(instancetype)initWithCoder:(NSCoder *)coder -{ - if ( (self = [super initWithCoder:coder]) ) { - dataSource = [coder decodeObjectForKey:@"CPTPlot.dataSource"]; - title = [[coder decodeObjectForKey:@"CPTPlot.title"] copy]; - attributedTitle = [[coder decodeObjectForKey:@"CPTPlot.attributedTitle"] copy]; - plotSpace = [coder decodeObjectForKey:@"CPTPlot.plotSpace"]; - cachePrecision = (CPTPlotCachePrecision)[coder decodeIntegerForKey : @"CPTPlot.cachePrecision"]; - needsRelabel = [coder decodeBoolForKey:@"CPTPlot.needsRelabel"]; - adjustLabelAnchors = [coder decodeBoolForKey:@"CPTPlot.adjustLabelAnchors"]; - showLabels = [coder decodeBoolForKey:@"CPTPlot.showLabels"]; - labelOffset = [coder decodeCGFloatForKey:@"CPTPlot.labelOffset"]; - labelRotation = [coder decodeCGFloatForKey:@"CPTPlot.labelRotation"]; - labelField = (NSUInteger)[coder decodeIntegerForKey : @"CPTPlot.labelField"]; - labelTextStyle = [[coder decodeObjectForKey:@"CPTPlot.labelTextStyle"] copy]; - labelFormatter = [coder decodeObjectForKey:@"CPTPlot.labelFormatter"]; - labelShadow = [coder decodeObjectForKey:@"CPTPlot.labelShadow"]; - labelIndexRange = [[coder decodeObjectForKey:@"CPTPlot.labelIndexRange"] rangeValue]; - labelAnnotations = [[coder decodeObjectForKey:@"CPTPlot.labelAnnotations"] mutableCopy]; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder +{ + if ((self = [super initWithCoder:coder])) { + dataSource = [coder decodeObjectOfClass:[NSObject class] + forKey:@"CPTPlot.dataSource"]; + title = [[coder decodeObjectOfClass:[NSString class] + forKey:@"CPTPlot.title"] copy]; + attributedTitle = [[coder decodeObjectOfClass:[NSAttributedString class] + forKey:@"CPTPlot.attributedTitle"] copy]; + plotSpace = [coder decodeObjectOfClass:[CPTPlotSpace class] + forKey:@"CPTPlot.plotSpace"]; + cachePrecision = (CPTPlotCachePrecision)[coder decodeIntegerForKey:@"CPTPlot.cachePrecision"]; + needsRelabel = [coder decodeBoolForKey:@"CPTPlot.needsRelabel"]; + adjustLabelAnchors = [coder decodeBoolForKey:@"CPTPlot.adjustLabelAnchors"]; + showLabels = [coder decodeBoolForKey:@"CPTPlot.showLabels"]; + labelOffset = [coder decodeCGFloatForKey:@"CPTPlot.labelOffset"]; + labelRotation = [coder decodeCGFloatForKey:@"CPTPlot.labelRotation"]; + labelField = (NSUInteger)[coder decodeIntegerForKey:@"CPTPlot.labelField"]; + labelTextStyle = [[coder decodeObjectOfClass:[CPTTextStyle class] + forKey:@"CPTPlot.labelTextStyle"] copy]; + labelFormatter = [coder decodeObjectOfClass:[NSFormatter class] + forKey:@"CPTPlot.labelFormatter"]; + labelShadow = [coder decodeObjectOfClass:[CPTShadow class] + forKey:@"CPTPlot.labelShadow"]; + labelIndexRange = [[coder decodeObjectOfClass:[NSValue class] + forKey:@"CPTPlot.labelIndexRange"] rangeValue]; + labelAnnotations = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTAnnotation class]]] + forKey:@"CPTPlot.labelAnnotations"] mutableCopy]; alignsPointsToPixels = [coder decodeBoolForKey:@"CPTPlot.alignsPointsToPixels"]; drawLegendSwatchDecoration = [coder decodeBoolForKey:@"CPTPlot.drawLegendSwatchDecoration"]; // support old archives if ( [coder containsValueForKey:@"CPTPlot.identifier"] ) { - self.identifier = [coder decodeObjectForKey:@"CPTPlot.identifier"]; + self.identifier = [coder decodeObjectOfClass:[NSObject class] + forKey:@"CPTPlot.identifier"]; } // init other properties @@ -443,15 +453,27 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Bindings -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else /// @cond --(Class)valueClassForBinding:(NSString *)binding +-(nullable Class)valueClassForBinding:(nonnull NSString *__unused)binding { return [NSArray class]; } @@ -464,7 +486,7 @@ -(Class)valueClassForBinding:(NSString *)binding /// @cond --(void)drawInContext:(CGContextRef)context +-(void)drawInContext:(nonnull CGContextRef)context { [self reloadDataIfNeeded]; [super drawInContext:context]; @@ -482,7 +504,7 @@ -(void)drawInContext:(CGContextRef)context /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken = 0; @@ -582,13 +604,13 @@ -(void)insertDataAtIndex:(NSUInteger)idx numberOfRecords:(NSUInteger)numberOfRec NSParameterAssert(idx <= self.cachedDataCount); Class numericClass = [CPTNumericData class]; - for ( id data in [self.cachedData allValues] ) { + for ( id data in self.cachedData.allValues ) { if ( [data isKindOfClass:numericClass] ) { CPTMutableNumericData *numericData = (CPTMutableNumericData *)data; size_t sampleSize = numericData.sampleBytes; size_t length = sampleSize * numberOfRecords; - [(NSMutableData *)numericData.data increaseLengthBy : length]; + [(NSMutableData *) numericData.data increaseLengthBy:length]; int8_t *start = [numericData mutableSamplePointer:idx]; size_t bytesToMove = numericData.data.length - (idx + numberOfRecords) * sampleSize; @@ -606,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)]; } @@ -618,7 +649,7 @@ -(void)deleteDataInIndexRange:(NSRange)indexRange NSParameterAssert(NSMaxRange(indexRange) <= self.cachedDataCount); Class numericClass = [CPTNumericData class]; - for ( id data in [self.cachedData allValues] ) { + for ( id data in self.cachedData.allValues ) { if ( [data isKindOfClass:numericClass] ) { CPTMutableNumericData *numericData = (CPTMutableNumericData *)data; size_t sampleSize = numericData.sampleBytes; @@ -633,12 +664,24 @@ -(void)deleteDataInIndexRange:(NSRange)indexRange dataBuffer.length -= length; } else { - [(NSMutableArray *)data removeObjectsInRange : indexRange]; + [(NSMutableArray *) data removeObjectsInRange: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]; } @@ -659,7 +702,7 @@ -(void)reloadPlotData /** @brief Reload plot data in the given index range from the data source immediately. * @param indexRange The index range to load. **/ --(void)reloadPlotDataInIndexRange:(NSRange)indexRange +-(void)reloadPlotDataInIndexRange:(NSRange __unused)indexRange { // do nothing--implementation provided by subclasses } @@ -687,9 +730,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]; @@ -712,7 +755,7 @@ -(void)reloadDataLabelsInIndexRange:(NSRange)indexRange /** * @brief A unique marker object used in collections to indicate that the datasource returned @nil. **/ -+(id)nilData ++(nonnull id)nilData { static id nilObject = nil; static dispatch_once_t onceToken = 0; @@ -729,7 +772,7 @@ +(id)nilData * @param indexRange The range of the data indexes of interest. * @return An array of data points. **/ --(id)numbersFromDataSourceForField:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange +-(nullable id)numbersFromDataSourceForField:(NSUInteger)fieldEnum recordIndexRange:(NSRange)indexRange { id numbers; // can be CPTNumericData, NSArray, or NSData @@ -757,7 +800,7 @@ -(id)numbersFromDataSourceForField:(NSUInteger)fieldEnum recordIndexRange:(NSRan else if ( [theDataSource respondsToSelector:@selector(doubleForPlot:field:recordIndex:)] ) { NSUInteger recordIndex; NSMutableData *fieldData = [NSMutableData dataWithLength:sizeof(double) * indexRange.length]; - double *fieldValues = [fieldData mutableBytes]; + double *fieldValues = fieldData.mutableBytes; for ( recordIndex = indexRange.location; recordIndex < indexRange.location + indexRange.length; ++recordIndex ) { double number = [theDataSource doubleForPlot:self field:fieldEnum recordIndex:recordIndex]; *fieldValues++ = number; @@ -812,24 +855,24 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan const NSUInteger sampleCount = data.numberOfSamples; CPTNumericDataType dataType = data.dataType; - if ( (sampleCount > 0) && (data.numberOfDimensions == 2) ) { - CPTNumberArray theShape = data.shape; - const NSUInteger rowCount = [theShape[0] unsignedIntegerValue]; - const NSUInteger fieldCount = [theShape[1] unsignedIntegerValue]; + if ((sampleCount > 0) && (data.numberOfDimensions == 2)) { + CPTNumberArray *theShape = data.shape; + const NSUInteger rowCount = theShape[0].unsignedIntegerValue; + const NSUInteger fieldCount = theShape[1].unsignedIntegerValue; if ( fieldCount > 0 ) { // convert data type if needed switch ( self.cachePrecision ) { case CPTPlotCachePrecisionAuto: if ( self.doublePrecisionCache ) { - if ( !CPTDataTypeEqualToDataType(dataType, self.doubleDataType) ) { + if ( !CPTDataTypeEqualToDataType(dataType, self.doubleDataType)) { CPTMutableNumericData *mutableData = [data mutableCopy]; mutableData.dataType = self.doubleDataType; data = mutableData; } } else { - if ( !CPTDataTypeEqualToDataType(dataType, self.decimalDataType) ) { + if ( !CPTDataTypeEqualToDataType(dataType, self.decimalDataType)) { CPTMutableNumericData *mutableData = [data mutableCopy]; mutableData.dataType = self.decimalDataType; data = mutableData; @@ -838,7 +881,7 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan break; case CPTPlotCachePrecisionDecimal: - if ( !CPTDataTypeEqualToDataType(dataType, self.decimalDataType) ) { + if ( !CPTDataTypeEqualToDataType(dataType, self.decimalDataType)) { CPTMutableNumericData *mutableData = [data mutableCopy]; mutableData.dataType = self.decimalDataType; data = mutableData; @@ -846,7 +889,7 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan break; case CPTPlotCachePrecisionDouble: - if ( !CPTDataTypeEqualToDataType(dataType, self.doubleDataType) ) { + if ( !CPTDataTypeEqualToDataType(dataType, self.doubleDataType)) { CPTMutableNumericData *mutableData = [data mutableCopy]; mutableData.dataType = self.doubleDataType; data = mutableData; @@ -865,7 +908,7 @@ -(BOOL)loadNumbersForAllFieldsFromDataSourceInRecordIndexRange:(NSRange)indexRan for ( NSUInteger fieldNum = 0; fieldNum < fieldCount; fieldNum++ ) { NSMutableData *tempData = [[NSMutableData alloc] initWithLength:bufferLength]; - if ( CPTDataTypeEqualToDataType(dataType, self.doubleDataType) ) { + if ( CPTDataTypeEqualToDataType(dataType, self.doubleDataType)) { const double *sourceData = [data samplePointerAtIndex:0, fieldNum]; double *destData = tempData.mutableBytes; @@ -930,7 +973,7 @@ -(NSUInteger)cachedDataCount * @param numbers An array of numbers to cache. Can be a CPTNumericData, NSArray, or NSData (NSData is assumed to be a c-style array of type @double). * @param fieldEnum The field enumerator identifying the field. **/ --(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum +-(void)cacheNumbers:(nullable id)numbers forField:(NSUInteger)fieldEnum { NSNumber *cacheKey = @(fieldEnum); @@ -943,7 +986,8 @@ -(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum case CPTScaleTypeLog: case CPTScaleTypeLogModulus: { - CPTMutableNumericData *mutableNumbers = [self numericDataForNumbers:numbers]; + id theNumbers = numbers; + CPTMutableNumericData *mutableNumbers = [self numericDataForNumbers:theNumbers]; NSUInteger sampleCount = mutableNumbers.numberOfSamples; if ( sampleCount > 0 ) { @@ -973,13 +1017,13 @@ -(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum case CPTScaleTypeCategory: { - CPTStringArray samples = (CPTStringArray)numbers; + CPTStringArray *samples = (CPTStringArray *)numbers; if ( [samples isKindOfClass:[NSArray class]] ) { [thePlotSpace setCategories:samples forCoordinate:coordinate]; NSUInteger sampleCount = samples.count; if ( sampleCount > 0 ) { - CPTMutableNumberArray indices = [[NSMutableArray alloc] initWithCapacity:sampleCount]; + CPTMutableNumberArray *indices = [[NSMutableArray alloc] initWithCapacity:sampleCount]; for ( NSString *category in samples ) { [indices addObject:@([thePlotSpace indexOfCategory:category forCoordinate:coordinate])]; @@ -1022,7 +1066,7 @@ -(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum * @param fieldEnum The field enumerator identifying the field. * @param idx The index of the first data point to replace. **/ --(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NSUInteger)idx +-(void)cacheNumbers:(nullable id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NSUInteger)idx { if ( numbers ) { NSNumber *cacheKey = @(fieldEnum); @@ -1038,7 +1082,8 @@ -(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NS case CPTScaleTypeLog: case CPTScaleTypeLogModulus: { - mutableNumbers = [self numericDataForNumbers:numbers]; + id theNumbers = numbers; + mutableNumbers = [self numericDataForNumbers:theNumbers]; sampleCount = mutableNumbers.numberOfSamples; if ( sampleCount > 0 ) { @@ -1070,11 +1115,11 @@ -(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NS case CPTScaleTypeCategory: { - CPTStringArray samples = (CPTStringArray)numbers; + CPTStringArray *samples = (CPTStringArray *)numbers; if ( [samples isKindOfClass:[NSArray class]] ) { sampleCount = samples.count; if ( sampleCount > 0 ) { - CPTMutableNumberArray indices = [[NSMutableArray alloc] initWithCapacity:sampleCount]; + CPTMutableNumberArray *indices = [[NSMutableArray alloc] initWithCapacity:sampleCount]; for ( NSString *category in samples ) { [thePlotSpace addCategory:category forCoordinate:coordinate]; @@ -1096,7 +1141,7 @@ -(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NS break; } - if ( mutableNumbers && (sampleCount > 0) ) { + if ( mutableNumbers && (sampleCount > 0)) { // Ensure the data cache exists and is the right size CPTMutableNumericData *cachedNumbers = (self.cachedData)[cacheKey]; if ( !cachedNumbers ) { @@ -1126,7 +1171,7 @@ -(void)cacheNumbers:(id)numbers forField:(NSUInteger)fieldEnum atRecordIndex:(NS /// @cond --(CPTMutableNumericData *)numericDataForNumbers:(id)numbers +-(nonnull CPTMutableNumericData *)numericDataForNumbers:(nonnull id)numbers { CPTMutableNumericData *mutableNumbers = nil; CPTNumericDataType loadedDataType; @@ -1135,7 +1180,7 @@ -(CPTMutableNumericData *)numericDataForNumbers:(id)numbers mutableNumbers = [numbers mutableCopy]; // ensure the numeric data is in a supported format; default to double if not already NSDecimal if ( !CPTDataTypeEqualToDataType(mutableNumbers.dataType, self.decimalDataType) && - !CPTDataTypeEqualToDataType(mutableNumbers.dataType, self.doubleDataType) ) { + !CPTDataTypeEqualToDataType(mutableNumbers.dataType, self.doubleDataType)) { mutableNumbers.dataType = self.doubleDataType; } } @@ -1144,10 +1189,10 @@ -(CPTMutableNumericData *)numericDataForNumbers:(id)numbers mutableNumbers = [[CPTMutableNumericData alloc] initWithData:numbers dataType:loadedDataType shape:nil]; } else if ( [numbers isKindOfClass:[NSArray class]] ) { - if ( ( (CPTNumberArray)numbers ).count == 0 ) { + if (((CPTNumberArray *)numbers).count == 0 ) { loadedDataType = self.doubleDataType; } - else if ( [( (NSArray < NSNumber * > *)numbers )[0] isKindOfClass :[NSDecimalNumber class]] ) { + else if ( [((NSArray *)numbers)[0] isKindOfClass:[NSDecimalNumber class]] ) { loadedDataType = self.decimalDataType; } else { @@ -1174,9 +1219,9 @@ -(BOOL)doublePrecisionCache { NSMutableDictionary *dataCache = self.cachedData; Class numberClass = [NSNumber class]; - for ( id key in [dataCache allKeys] ) { + for ( id key in dataCache.allKeys ) { if ( [key isKindOfClass:numberClass] ) { - result = CPTDataTypeEqualToDataType([(CPTMutableNumericData *)dataCache[key] dataType], self.doubleDataType); + result = CPTDataTypeEqualToDataType(((CPTMutableNumericData *)dataCache[key]).dataType, self.doubleDataType); break; } } @@ -1198,7 +1243,7 @@ -(BOOL)doublePrecisionCache * @param fieldEnum The field enumerator identifying the field. * @return The array of cached numbers. **/ --(CPTMutableNumericData *)cachedNumbersForField:(NSUInteger)fieldEnum +-(nullable CPTMutableNumericData *)cachedNumbersForField:(NSUInteger)fieldEnum { return (self.cachedData)[@(fieldEnum)]; } @@ -1208,7 +1253,7 @@ -(CPTMutableNumericData *)cachedNumbersForField:(NSUInteger)fieldEnum * @param idx The index of the desired data value. * @return The cached number. **/ --(NSNumber *)cachedNumberForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx +-(nullable NSNumber *)cachedNumberForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx { CPTMutableNumericData *numbers = [self cachedNumbersForField:fieldEnum]; @@ -1249,7 +1294,7 @@ -(double)cachedDoubleForField:(NSUInteger)fieldEnum recordIndex:(NSUInteger)idx break; } } - return NAN; + return (double)NAN; } /** @brief Retrieves a single number from the cache. @@ -1297,7 +1342,7 @@ -(void)setCachedDataType:(CPTNumericDataType)newDataType NSMutableDictionary *dataDictionary = self.cachedData; - for ( id key in [dataDictionary allKeys] ) { + for ( id key in dataDictionary.allKeys ) { if ( [key isKindOfClass:numberClass] ) { CPTMutableNumericData *numericData = dataDictionary[key]; numericData.dataType = newDataType; @@ -1313,7 +1358,7 @@ -(CPTNumericDataType)doubleDataType static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - dataType = CPTDataType( CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent() ); + dataType = CPTDataType(CPTFloatingPointDataType, sizeof(double), CFByteOrderGetCurrent()); }); return dataType; @@ -1325,7 +1370,7 @@ -(CPTNumericDataType)decimalDataType static dispatch_once_t onceToken = 0; dispatch_once(&onceToken, ^{ - dataType = CPTDataType( CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent() ); + dataType = CPTDataType(CPTDecimalDataType, sizeof(NSDecimal), CFByteOrderGetCurrent()); }); return dataType; @@ -1335,7 +1380,7 @@ -(CPTNumericDataType)decimalDataType * @param key The key identifying the field. * @return The array of cached values. **/ --(NSArray *)cachedArrayForKey:(NSString *)key +-(nullable NSArray *)cachedArrayForKey:(nonnull NSString *)key { return (self.cachedData)[key]; } @@ -1345,7 +1390,7 @@ -(NSArray *)cachedArrayForKey:(NSString *)key * @param idx The index of the desired data value. * @return The cached value or @nil if no data is cached for the requested key. **/ --(id)cachedValueForKey:(NSString *)key recordIndex:(NSUInteger)idx +-(nullable id)cachedValueForKey:(nonnull NSString *)key recordIndex:(NSUInteger)idx { return [self cachedArrayForKey:key][idx]; } @@ -1354,7 +1399,7 @@ -(id)cachedValueForKey:(NSString *)key recordIndex:(NSUInteger)idx * @param array An array of arbitrary values to cache. * @param key The key identifying the field. **/ --(void)cacheArray:(NSArray *)array forKey:(NSString *)key +-(void)cacheArray:(nullable NSArray *)array forKey:(nonnull NSString *)key { if ( array ) { NSUInteger sampleCount = array.count; @@ -1378,28 +1423,29 @@ -(void)cacheArray:(NSArray *)array forKey:(NSString *)key * @param key The key identifying the field. * @param idx The index of the first data point to replace. **/ --(void)cacheArray:(NSArray *)array forKey:(NSString *)key atRecordIndex:(NSUInteger)idx +-(void)cacheArray:(nullable NSArray *)array forKey:(nonnull NSString *)key atRecordIndex:(NSUInteger)idx { - if ( array ) { - NSUInteger sampleCount = array.count; - if ( sampleCount > 0 ) { - // Ensure the data cache exists and is the right size - id theDataSource = self.dataSource; - NSUInteger numberOfRecords = [theDataSource numberOfRecordsForPlot:self]; - NSMutableArray *cachedValues = (self.cachedData)[key]; - if ( !cachedValues ) { - cachedValues = [NSMutableArray arrayWithCapacity:numberOfRecords]; - NSNull *nullObject = [NSNull null]; - for ( NSUInteger i = 0; i < numberOfRecords; i++ ) { - [cachedValues addObject:nullObject]; - } - (self.cachedData)[key] = cachedValues; - } + NSUInteger sampleCount = array.count; - // Update the cache - self.cachedDataCount = numberOfRecords; - [cachedValues replaceObjectsInRange:NSMakeRange(idx, sampleCount) withObjectsFromArray:array]; + if ( sampleCount > 0 ) { + // Ensure the data cache exists and is the right size + id theDataSource = self.dataSource; + NSUInteger numberOfRecords = [theDataSource numberOfRecordsForPlot:self]; + NSMutableArray *cachedValues = (self.cachedData)[key]; + if ( !cachedValues ) { + cachedValues = [NSMutableArray arrayWithCapacity:numberOfRecords]; + NSNull *nullObject = [NSNull null]; + for ( NSUInteger i = 0; i < numberOfRecords; i++ ) { + [cachedValues addObject:nullObject]; + } + (self.cachedData)[key] = cachedValues; } + + // Update the cache + self.cachedDataCount = numberOfRecords; + + NSArray *dataArray = array; + [cachedValues replaceObjectsInRange:NSMakeRange(idx, sampleCount) withObjectsFromArray:dataArray]; } } @@ -1410,7 +1456,7 @@ -(void)cacheArray:(NSArray *)array forKey:(NSString *)key atRecordIndex:(NSUInte * @param fieldEnum The field enumerator identifying the field. * @return The plot range enclosing the data. **/ --(CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum +-(nullable CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum { if ( self.dataNeedsReloading ) { [self reloadData]; @@ -1421,31 +1467,21 @@ -(CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum NSUInteger numberOfSamples = numbers.numberOfSamples; if ( numberOfSamples > 0 ) { if ( self.doublePrecisionCache ) { - const double *doubles = (const double *)numbers.bytes; - - double min = INFINITY; - double max = -INFINITY; - - vDSP_minvD(doubles, 1, &min, (vDSP_Length)numberOfSamples); - vDSP_maxvD(doubles, 1, &max, (vDSP_Length)numberOfSamples); - - if ( isnan(min) || isnan(max) ) { - // vDSP functions may return NAN if any data in the array is NAN - min = INFINITY; - max = -INFINITY; + double min = (double)INFINITY; + double max = -(double)INFINITY; - const double *lastSample = doubles + numberOfSamples; + const double *doubles = (const double *)numbers.bytes; + const double *lastSample = doubles + numberOfSamples; - while ( doubles < lastSample ) { - double value = *doubles++; + while ( doubles < lastSample ) { + double value = *doubles++; - if ( !isnan(value) ) { - if ( value < min ) { - min = value; - } - if ( value > max ) { - max = value; - } + if ( !isnan(value)) { + if ( value < min ) { + min = value; + } + if ( value > max ) { + max = value; } } } @@ -1455,25 +1491,26 @@ -(CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum } } else { - NSDecimal min = [[NSDecimalNumber maximumDecimalNumber] decimalValue]; - NSDecimal max = [[NSDecimalNumber minimumDecimalNumber] decimalValue]; + NSDecimal min = [NSDecimalNumber maximumDecimalNumber].decimalValue; + NSDecimal max = [NSDecimalNumber minimumDecimalNumber].decimalValue; const NSDecimal *decimals = (const NSDecimal *)numbers.bytes; const NSDecimal *lastSample = decimals + numberOfSamples; + while ( decimals < lastSample ) { NSDecimal value = *decimals++; - if ( !NSDecimalIsNotANumber(&value) ) { - if ( CPTDecimalLessThan(value, min) ) { + if ( !NSDecimalIsNotANumber(&value)) { + if ( CPTDecimalLessThan(value, min)) { min = value; } - if ( CPTDecimalGreaterThan(value, max) ) { + if ( CPTDecimalGreaterThan(value, max)) { max = value; } } } - if ( CPTDecimalGreaterThanOrEqualTo(max, min) ) { + if ( CPTDecimalGreaterThanOrEqualTo(max, min)) { range = [CPTPlotRange plotRangeWithLocationDecimal:min lengthDecimal:CPTDecimalSubtract(max, min)]; } } @@ -1485,9 +1522,44 @@ -(CPTPlotRange *)plotRangeForField:(NSUInteger)fieldEnum * @param coord The coordinate identifier. * @return The plot range enclosing the data. **/ --(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord +-(nullable CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord +{ + CPTNumberArray *fields = [self fieldIdentifiersForCoordinate:coord]; + + if ( fields.count == 0 ) { + return nil; + } + + CPTMutablePlotRange *unionRange = nil; + for ( NSNumber *field in fields ) { + CPTPlotRange *currentRange = [self plotRangeForField:field.unsignedIntegerValue]; + if ( !unionRange ) { + unionRange = [currentRange mutableCopy]; + } + else { + [unionRange unionPlotRange:[self plotRangeForField:field.unsignedIntegerValue]]; + } + } + + return unionRange; +} + +/** @brief Determines the smallest plot range that fully encloses the entire plot for a particular field. + * @param fieldEnum The field enumerator identifying the field. + * @return The plot range enclosing the data. + **/ +-(nullable CPTPlotRange *)plotRangeEnclosingField:(NSUInteger)fieldEnum +{ + return [self plotRangeForField:fieldEnum]; +} + +/** @brief Determines the smallest plot range that fully encloses the entire plot for a particular coordinate. + * @param coord The coordinate identifier. + * @return The plot range enclosing the data. + **/ +-(nullable CPTPlotRange *)plotRangeEnclosingCoordinate:(CPTCoordinate)coord { - CPTNumberArray fields = [self fieldIdentifiersForCoordinate:coord]; + CPTNumberArray *fields = [self fieldIdentifiersForCoordinate:coord]; if ( fields.count == 0 ) { return nil; @@ -1495,12 +1567,12 @@ -(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coord CPTMutablePlotRange *unionRange = nil; for ( NSNumber *field in fields ) { - CPTPlotRange *currentRange = [self plotRangeForField:field.unsignedIntValue]; + CPTPlotRange *currentRange = [self plotRangeEnclosingField:field.unsignedIntegerValue]; if ( !unionRange ) { unionRange = [currentRange mutableCopy]; } else { - [unionRange unionPlotRange:[self plotRangeForField:field.unsignedIntValue]]; + [unionRange unionPlotRange:[self plotRangeEnclosingField:field.unsignedIntegerValue]]; } } @@ -1539,8 +1611,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; @@ -1548,7 +1620,7 @@ -(void)relabel } } - if ( !self.showLabels || (!hasCachedLabels && !plotProvidesLabels) ) { + if ( !self.showLabels || (!hasCachedLabels && !plotProvidesLabels)) { for ( CPTAnnotation *annotation in self.labelAnnotations ) { if ( [annotation isKindOfClass:annotationClass] ) { [self removeAnnotation:annotation]; @@ -1558,9 +1630,9 @@ -(void)relabel return; } - CPTDictionary textAttributes = [dataLabelTextStyle attributes]; - BOOL hasAttributedFormatter = ([dataLabelFormatter attributedStringForObjectValue:[NSDecimalNumber zero] - withDefaultAttributes:textAttributes] != nil); + CPTDictionary *textAttributes = dataLabelTextStyle.attributes; + BOOL hasAttributedFormatter = ([dataLabelFormatter attributedStringForObjectValue:[NSDecimalNumber zero] + withDefaultAttributes:textAttributes] != nil); NSUInteger sampleCount = self.cachedDataCount; NSRange indexRange = self.labelIndexRange; @@ -1570,11 +1642,11 @@ -(void)relabel self.labelAnnotations = [NSMutableArray arrayWithCapacity:sampleCount]; } - CPTPlotSpace *thePlotSpace = self.plotSpace; - CGFloat theRotation = self.labelRotation; - CPTMutableAnnotationArray labelArray = self.labelAnnotations; - NSUInteger oldLabelCount = labelArray.count; - id nilObject = [CPTPlot nilData]; + CPTPlotSpace *thePlotSpace = self.plotSpace; + CGFloat theRotation = self.labelRotation; + CPTMutableAnnotationArray *labelArray = self.labelAnnotations; + NSUInteger oldLabelCount = labelArray.count; + id nilObject = [CPTPlot nilData]; CPTMutableNumericData *labelFieldDataCache = [self cachedNumbersForField:self.labelField]; CPTShadow *theShadow = self.labelShadow; @@ -1583,13 +1655,13 @@ -(void)relabel NSNumber *dataValue = [labelFieldDataCache sampleValue:i]; CPTLayer *newLabelLayer; - if ( isnan([dataValue doubleValue]) ) { + if ( isnan([dataValue doubleValue])) { newLabelLayer = nil; } else { newLabelLayer = [self cachedValueForKey:CPTPlotBindingDataLabels recordIndex:i]; - if ( ( (newLabelLayer == nil) || (newLabelLayer == nilObject) ) && plotProvidesLabels ) { + if (((newLabelLayer == nil) || (newLabelLayer == nilObject)) && plotProvidesLabels ) { if ( hasAttributedFormatter ) { NSAttributedString *labelString = [dataLabelFormatter attributedStringForObjectValue:dataValue withDefaultAttributes:textAttributes]; newLabelLayer = [[CPTTextLayer alloc] initWithAttributedText:labelString]; @@ -1600,7 +1672,7 @@ -(void)relabel } } - if ( [newLabelLayer isKindOfClass:nullClass] || (newLabelLayer == nilObject) ) { + if ( [newLabelLayer isKindOfClass:nullClass] || (newLabelLayer == nilObject)) { newLabelLayer = nil; } } @@ -1664,18 +1736,18 @@ -(void)relabelIndexRange:(NSRange)indexRange /// @cond --(void)updateContentAnchorForLabel:(CPTPlotSpaceAnnotation *)label +-(void)updateContentAnchorForLabel:(nonnull CPTPlotSpaceAnnotation *)label { if ( label && self.adjustLabelAnchors ) { CGPoint displacement = label.displacement; - if ( CGPointEqualToPoint(displacement, CGPointZero) ) { + if ( CGPointEqualToPoint(displacement, CGPointZero)) { displacement.y = CPTFloat(1.0); // put the label above the data point if zero displacement } CGFloat angle = CPTFloat(M_PI) + atan2(displacement.y, displacement.x) - label.rotation; CGFloat newAnchorX = cos(angle); CGFloat newAnchorY = sin(angle); - if ( ABS(newAnchorX) <= ABS(newAnchorY) ) { + if ( ABS(newAnchorX) <= ABS(newAnchorY)) { newAnchorX /= ABS(newAnchorY); newAnchorY = signbit(newAnchorY) ? CPTFloat(-1.0) : CPTFloat(1.0); } @@ -1684,7 +1756,7 @@ -(void)updateContentAnchorForLabel:(CPTPlotSpaceAnnotation *)label newAnchorX = signbit(newAnchorX) ? CPTFloat(-1.0) : CPTFloat(1.0); } - label.contentAnchorPoint = CPTPointMake( ( newAnchorX + CPTFloat(1.0) ) / CPTFloat(2.0), ( newAnchorY + CPTFloat(1.0) ) / CPTFloat(2.0) ); + label.contentAnchorPoint = CPTPointMake((newAnchorX + CPTFloat(1.0)) / CPTFloat(2.0), (newAnchorY + CPTFloat(1.0)) / CPTFloat(2.0)); } } @@ -1695,9 +1767,9 @@ -(void)updateContentAnchorForLabel:(CPTPlotSpaceAnnotation *)label **/ -(void)repositionAllLabelAnnotations { - CPTAnnotationArray annotations = self.labelAnnotations; - NSUInteger labelCount = annotations.count; - Class annotationClass = [CPTAnnotation class]; + CPTAnnotationArray *annotations = self.labelAnnotations; + NSUInteger labelCount = annotations.count; + Class annotationClass = [CPTAnnotation class]; for ( NSUInteger i = 0; i < labelCount; i++ ) { CPTPlotSpaceAnnotation *annotation = annotations[i]; @@ -1723,7 +1795,7 @@ -(NSUInteger)numberOfLegendEntries * @param idx The index of the desired title. * @return The title of the legend entry at the requested index. **/ --(NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx +-(nullable NSString *)titleForLegendEntryAtIndex:(NSUInteger __unused)idx { NSString *legendTitle = self.title; @@ -1742,7 +1814,7 @@ -(NSString *)titleForLegendEntryAtIndex:(NSUInteger)idx * @param idx The index of the desired title. * @return The styled title of the legend entry at the requested index. **/ --(NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger)idx +-(nullable NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger __unused)idx { NSAttributedString *legendTitle = self.attributedTitle; @@ -1764,11 +1836,12 @@ -(NSAttributedString *)attributedTitleForLegendEntryAtIndex:(NSUInteger)idx * @param rect The bounding rectangle where the swatch should be drawn. * @param context The graphics context to draw into. **/ --(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(nonnull CGContextRef)context { id theDelegate = (id)self.delegate; CPTFill *theFill = nil; + if ( [theDelegate respondsToSelector:@selector(legend:fillForSwatchAtIndex:forPlot:)] ) { theFill = [theDelegate legend:legend fillForSwatchAtIndex:idx forPlot:self]; } @@ -1825,7 +1898,7 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { self.pointingDeviceDownLabelIndex = NSNotFound; @@ -1835,15 +1908,15 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact 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:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelWasSelectedAtRecordIndex:withEvent:)] ) { // Inform delegate if a label was hit - CPTMutableAnnotationArray labelArray = self.labelAnnotations; - NSUInteger labelCount = labelArray.count; - Class annotationClass = [CPTAnnotation class]; + CPTMutableAnnotationArray *labelArray = self.labelAnnotations; + NSUInteger labelCount = labelArray.count; + Class annotationClass = [CPTAnnotation class]; for ( NSUInteger idx = 0; idx < labelCount; idx++ ) { CPTPlotSpaceAnnotation *annotation = labelArray[idx]; @@ -1852,7 +1925,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact if ( labelLayer && !labelLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:labelLayer]; - if ( CGRectContainsPoint(labelLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(labelLayer.bounds, labelPoint)) { self.pointingDeviceDownLabelIndex = idx; BOOL handled = NO; @@ -1901,7 +1974,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { NSUInteger selectedDownIndex = self.pointingDeviceDownLabelIndex; @@ -1913,15 +1986,15 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio 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:)] || [theDelegate respondsToSelector:@selector(plot:dataLabelWasSelectedAtRecordIndex:withEvent:)] ) { // Inform delegate if a label was hit - CPTMutableAnnotationArray labelArray = self.labelAnnotations; - NSUInteger labelCount = labelArray.count; - Class annotationClass = [CPTAnnotation class]; + CPTMutableAnnotationArray *labelArray = self.labelAnnotations; + NSUInteger labelCount = labelArray.count; + Class annotationClass = [CPTAnnotation class]; for ( NSUInteger idx = 0; idx < labelCount; idx++ ) { CPTPlotSpaceAnnotation *annotation = labelArray[idx]; @@ -1930,7 +2003,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio if ( labelLayer && !labelLayer.hidden ) { CGPoint labelPoint = [theGraph convertPoint:interactionPoint toLayer:labelLayer]; - if ( CGRectContainsPoint(labelLayer.bounds, labelPoint) ) { + if ( CGRectContainsPoint(labelLayer.bounds, labelPoint)) { BOOL handled = NO; if ( [theDelegate respondsToSelector:@selector(plot:dataLabelTouchUpAtRecordIndex:)] ) { @@ -1974,18 +2047,18 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio /// @cond --(NSArray *)dataLabels +-(nullable CPTLayerArray *)dataLabels { return [self cachedArrayForKey:CPTPlotBindingDataLabels]; } --(void)setDataLabels:(NSArray *)newDataLabels +-(void)setDataLabels:(nullable CPTLayerArray *)newDataLabels { [self cacheArray:newDataLabels forKey:CPTPlotBindingDataLabels]; [self setNeedsRelabel]; } --(void)setTitle:(NSString *)newTitle +-(void)setTitle:(nullable NSString *)newTitle { if ( newTitle != title ) { title = [newTitle copy]; @@ -2000,7 +2073,7 @@ -(void)setTitle:(NSString *)newTitle } } --(void)setAttributedTitle:(NSAttributedString *)newTitle +-(void)setAttributedTitle:(nullable NSAttributedString *)newTitle { if ( newTitle != attributedTitle ) { attributedTitle = [newTitle copy]; @@ -2015,7 +2088,7 @@ -(void)setAttributedTitle:(NSAttributedString *)newTitle } } --(void)setDataSource:(id)newSource +-(void)setDataSource:(nullable id)newSource { if ( newSource != dataSource ) { dataSource = newSource; @@ -2033,7 +2106,7 @@ -(void)setDataNeedsReloading:(BOOL)newDataNeedsReloading } } --(CPTPlotArea *)plotArea +-(nullable CPTPlotArea *)plotArea { CPTGraph *theGraph = self.graph; @@ -2061,7 +2134,7 @@ -(void)setShowLabels:(BOOL)newShowLabels } } --(void)setLabelTextStyle:(CPTTextStyle *)newStyle +-(void)setLabelTextStyle:(nullable CPTTextStyle *)newStyle { if ( newStyle != labelTextStyle ) { labelTextStyle = [newStyle copy]; @@ -2101,7 +2174,7 @@ -(void)setLabelRotation:(CGFloat)newRotation } } --(void)setLabelFormatter:(NSFormatter *)newTickLabelFormatter +-(void)setLabelFormatter:(nullable NSFormatter *)newTickLabelFormatter { if ( newTickLabelFormatter != labelFormatter ) { labelFormatter = newTickLabelFormatter; @@ -2109,7 +2182,7 @@ -(void)setLabelFormatter:(NSFormatter *)newTickLabelFormatter } } --(void)setLabelShadow:(CPTShadow *)newLabelShadow +-(void)setLabelShadow:(nullable CPTShadow *)newLabelShadow { if ( newLabelShadow != labelShadow ) { labelShadow = newLabelShadow; @@ -2154,7 +2227,7 @@ -(void)setAlignsPointsToPixels:(BOOL)newAlignsPointsToPixels -(void)setHidden:(BOOL)newHidden { if ( newHidden != self.hidden ) { - [super setHidden:newHidden]; + super.hidden = newHidden; [self setNeedsRelabel]; } } @@ -2181,7 +2254,7 @@ -(NSUInteger)numberOfFields /** @brief Identifiers (enum values) identifying the fields. * @return Array of NSNumber objects for the various field identifiers. **/ --(CPTNumberArray)fieldIdentifiers +-(nonnull CPTNumberArray *)fieldIdentifiers { return @[]; } @@ -2190,7 +2263,7 @@ -(CPTNumberArray)fieldIdentifiers * @param coord The coordinate for which the corresponding field identifiers are desired. * @return Array of NSNumber objects for the field identifiers. **/ --(CPTNumberArray)fieldIdentifiersForCoordinate:(CPTCoordinate)coord +-(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate __unused)coord { return @[]; } @@ -2199,7 +2272,7 @@ -(CPTNumberArray)fieldIdentifiersForCoordinate:(CPTCoordinate)coord * @param field The field identifier for which the corresponding coordinate is desired. * @return The coordinate that corresponds to a particular field identifier or #CPTCoordinateNone if there is no matching coordinate. */ --(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field +-(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger __unused)field { return CPTCoordinateNone; } @@ -2211,7 +2284,7 @@ -(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field * @param label The annotation for the data label. * @param idx The data index for the label. **/ --(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx +-(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *__unused)label forIndex:(NSUInteger __unused)idx { // do nothing--implementation provided by subclasses } @@ -2224,7 +2297,7 @@ -(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInte * @param point The coordinates of the interaction. * @return The index of the data point that is under the given point or @ref NSNotFound if none was found. */ --(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point +-(NSUInteger)dataIndexFromInteractionPoint:(CGPoint __unused)point { return NSNotFound; } diff --git a/framework/Source/CPTPlotArea.h b/framework/Source/CPTPlotArea.h index e98181fa7..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 @@ -85,7 +85,7 @@ /// @name Layer Ordering /// @{ -@property (nonatomic, readwrite, strong, nullable) CPTNumberArray topDownLayerOrder; +@property (nonatomic, readwrite, strong, nullable) CPTNumberArray *topDownLayerOrder; /// @} /// @name Decorations diff --git a/framework/Source/CPTPlotArea.m b/framework/Source/CPTPlotArea.m index 56ae066fa..34f04616d 100644 --- a/framework/Source/CPTPlotArea.m +++ b/framework/Source/CPTPlotArea.m @@ -14,7 +14,7 @@ /// @cond @interface CPTPlotArea() -@property (nonatomic, readwrite, assign) CPTGraphLayerType *bottomUpLayerOrder; +@property (nonatomic, readwrite, assign, nonnull) CPTGraphLayerType *bottomUpLayerOrder; @property (nonatomic, readwrite, assign, getter = isUpdatingLayers) BOOL updatingLayers; @property (nonatomic, readwrite) CGPoint touchedPoint; @property (nonatomic, readwrite) NSDecimal widthDecimal; @@ -44,37 +44,37 @@ -(unsigned)indexForLayerType:(CPTGraphLayerType)layerType; **/ @implementation CPTPlotArea -/** @property CPTGridLineGroup *minorGridLineGroup +/** @property nullable CPTGridLineGroup *minorGridLineGroup * @brief The parent layer for all minor grid lines. **/ @synthesize minorGridLineGroup; -/** @property CPTGridLineGroup *majorGridLineGroup +/** @property nullable CPTGridLineGroup *majorGridLineGroup * @brief The parent layer for all major grid lines. **/ @synthesize majorGridLineGroup; -/** @property CPTAxisSet *axisSet +/** @property nullable CPTAxisSet *axisSet * @brief The axis set. **/ @synthesize axisSet; -/** @property CPTPlotGroup *plotGroup +/** @property nullable CPTPlotGroup *plotGroup * @brief The plot group. **/ @synthesize plotGroup; -/** @property CPTAxisLabelGroup *axisLabelGroup +/** @property nullable CPTAxisLabelGroup *axisLabelGroup * @brief The parent layer for all axis labels. **/ @synthesize axisLabelGroup; -/** @property CPTAxisLabelGroup *axisTitleGroup +/** @property nullable CPTAxisLabelGroup *axisTitleGroup * @brief The parent layer for all axis titles. **/ @synthesize axisTitleGroup; -/** @property CPTNumberArray topDownLayerOrder +/** @property nullable CPTNumberArray *topDownLayerOrder * @brief An array of graph layers to be drawn in an order other than the default. * * The array should reference the layers using the constants defined in #CPTGraphLayerType. @@ -100,13 +100,13 @@ @implementation CPTPlotArea **/ @synthesize topDownLayerOrder; -/** @property CPTLineStyle *borderLineStyle +/** @property nullable CPTLineStyle *borderLineStyle * @brief The line style for the layer border. * If @nil, the border is not drawn. **/ @dynamic borderLineStyle; -/** @property CPTFill *fill +/** @property nullable CPTFill *fill * @brief The fill for the layer background. * If @nil, the layer background is not filled. **/ @@ -150,9 +150,9 @@ @implementation CPTPlotArea * @param newFrame The frame rectangle. * @return The initialized CPTPlotArea object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { minorGridLineGroup = nil; majorGridLineGroup = nil; axisSet = nil; @@ -160,9 +160,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame axisLabelGroup = nil; axisTitleGroup = nil; fill = nil; - touchedPoint = CGPointMake(NAN, NAN); + touchedPoint = CPTPointMake(NAN, NAN); topDownLayerOrder = nil; - bottomUpLayerOrder = malloc( kCPTNumberOfLayers * sizeof(CPTGraphLayerType) ); + bottomUpLayerOrder = calloc(kCPTNumberOfLayers, sizeof(CPTGraphLayerType)); [self updateLayerOrder]; CPTPlotGroup *newPlotGroup = [[CPTPlotGroup alloc] initWithFrame:newFrame]; @@ -181,9 +181,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTPlotArea *theLayer = (CPTPlotArea *)layer; minorGridLineGroup = theLayer->minorGridLineGroup; @@ -195,8 +195,8 @@ -(instancetype)initWithLayer:(id)layer fill = theLayer->fill; touchedPoint = theLayer->touchedPoint; topDownLayerOrder = theLayer->topDownLayerOrder; - bottomUpLayerOrder = malloc( kCPTNumberOfLayers * sizeof(CPTGraphLayerType) ); - memcpy( bottomUpLayerOrder, theLayer->bottomUpLayerOrder, kCPTNumberOfLayers * sizeof(CPTGraphLayerType) ); + bottomUpLayerOrder = calloc(kCPTNumberOfLayers, sizeof(CPTGraphLayerType)); + memcpy(bottomUpLayerOrder, theLayer->bottomUpLayerOrder, kCPTNumberOfLayers * sizeof(CPTGraphLayerType)); widthDecimal = theLayer->widthDecimal; heightDecimal = theLayer->heightDecimal; } @@ -215,7 +215,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -236,22 +236,30 @@ -(void)encodeWithCoder:(NSCoder *)coder // heightDecimal } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - minorGridLineGroup = [coder decodeObjectForKey:@"CPTPlotArea.minorGridLineGroup"]; - majorGridLineGroup = [coder decodeObjectForKey:@"CPTPlotArea.majorGridLineGroup"]; - axisSet = [coder decodeObjectForKey:@"CPTPlotArea.axisSet"]; - plotGroup = [coder decodeObjectForKey:@"CPTPlotArea.plotGroup"]; - axisLabelGroup = [coder decodeObjectForKey:@"CPTPlotArea.axisLabelGroup"]; - axisTitleGroup = [coder decodeObjectForKey:@"CPTPlotArea.axisTitleGroup"]; - fill = [[coder decodeObjectForKey:@"CPTPlotArea.fill"] copy]; - topDownLayerOrder = [coder decodeObjectForKey:@"CPTPlotArea.topDownLayerOrder"]; - - bottomUpLayerOrder = malloc( kCPTNumberOfLayers * sizeof(CPTGraphLayerType) ); + if ((self = [super initWithCoder:coder])) { + minorGridLineGroup = [coder decodeObjectOfClass:[CPTGridLineGroup class] + forKey:@"CPTPlotArea.minorGridLineGroup"]; + majorGridLineGroup = [coder decodeObjectOfClass:[CPTGridLineGroup class] + forKey:@"CPTPlotArea.majorGridLineGroup"]; + axisSet = [coder decodeObjectOfClass:[CPTAxisSet class] + forKey:@"CPTPlotArea.axisSet"]; + plotGroup = [coder decodeObjectOfClass:[CPTPlotGroup class] + forKey:@"CPTPlotArea.plotGroup"]; + axisLabelGroup = [coder decodeObjectOfClass:[CPTAxisLabelGroup class] + forKey:@"CPTPlotArea.axisLabelGroup"]; + axisTitleGroup = [coder decodeObjectOfClass:[CPTAxisLabelGroup class] + forKey:@"CPTPlotArea.axisTitleGroup"]; + fill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTPlotArea.fill"] copy]; + topDownLayerOrder = [coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTPlotArea.topDownLayerOrder"]; + + bottomUpLayerOrder = calloc(kCPTNumberOfLayers, sizeof(CPTGraphLayerType)); [self updateLayerOrder]; - touchedPoint = CGPointMake(NAN, NAN); + touchedPoint = CPTPointMake(NAN, NAN); CGSize boundsSize = self.bounds.size; widthDecimal = CPTDecimalFromCGFloat(boundsSize.width); @@ -262,12 +270,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -288,7 +308,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context [self.fill fillRect:self.bounds inContext:context]; - CPTAxisArray theAxes = self.axisSet.axes; + CPTAxisArray *theAxes = self.axisSet.axes; for ( CPTAxis *axis in theAxes ) { [axis drawBackgroundBandsInContext:context]; @@ -353,7 +373,11 @@ -(void)layoutSublayers } } --(CPTSublayerSet)sublayersExcludedFromAutomaticLayout +/// @} + +/// @cond + +-(nullable CPTSublayerSet *)sublayersExcludedFromAutomaticLayout { CPTGridLineGroup *minorGrid = self.minorGridLineGroup; CPTGridLineGroup *majorGrid = self.majorGridLineGroup; @@ -363,7 +387,7 @@ -(CPTSublayerSet)sublayersExcludedFromAutomaticLayout CPTAxisLabelGroup *titles = self.axisTitleGroup; if ( minorGrid || majorGrid || theAxisSet || thePlotGroup || labels || titles ) { - CPTMutableSublayerSet excludedSublayers = [[super sublayersExcludedFromAutomaticLayout] mutableCopy]; + CPTMutableSublayerSet *excludedSublayers = [super.sublayersExcludedFromAutomaticLayout mutableCopy]; if ( !excludedSublayers ) { excludedSublayers = [NSMutableSet set]; } @@ -390,11 +414,11 @@ -(CPTSublayerSet)sublayersExcludedFromAutomaticLayout return excludedSublayers; } else { - return [super sublayersExcludedFromAutomaticLayout]; + return super.sublayersExcludedFromAutomaticLayout; } } -/// @} +/// @endcond #pragma mark - #pragma mark Layer ordering @@ -409,12 +433,12 @@ -(void)updateLayerOrder *(buLayerOrder++) = (CPTGraphLayerType)i; } - CPTNumberArray tdLayerOrder = self.topDownLayerOrder; + CPTNumberArray *tdLayerOrder = self.topDownLayerOrder; if ( tdLayerOrder ) { buLayerOrder = self.bottomUpLayerOrder; - for ( NSUInteger layerIndex = 0; layerIndex < [tdLayerOrder count]; layerIndex++ ) { - CPTGraphLayerType layerType = (CPTGraphLayerType)[tdLayerOrder[layerIndex] intValue]; + for ( NSUInteger layerIndex = 0; layerIndex < tdLayerOrder.count; layerIndex++ ) { + CPTGraphLayerType layerType = (CPTGraphLayerType)tdLayerOrder[layerIndex].intValue; NSUInteger i = kCPTNumberOfLayers - layerIndex - 1; while ( buLayerOrder[i] != layerType ) { if ( i == 0 ) { @@ -606,7 +630,7 @@ -(void)setAxisSetLayersForType:(CPTGraphLayerType)layerType * @param layerType The layer type being updated. * @return The sublayer index for the given layer type. **/ --(unsigned)sublayerIndexForAxis:(CPTAxis *)axis layerType:(CPTGraphLayerType)layerType +-(unsigned)sublayerIndexForAxis:(nonnull CPTAxis *)axis layerType:(CPTGraphLayerType)layerType { unsigned idx = 0; @@ -670,7 +694,7 @@ -(unsigned)sublayerIndexForAxis:(CPTAxis *)axis layerType:(CPTGraphLayerType)lay * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTGraph *theGraph = self.graph; @@ -678,7 +702,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact 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:)] || @@ -686,7 +710,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact // Inform delegate if a point was hit CGPoint plotAreaPoint = [theGraph convertPoint:interactionPoint toLayer:self]; - if ( CGRectContainsPoint(self.bounds, plotAreaPoint) ) { + if ( CGRectContainsPoint(self.bounds, plotAreaPoint)) { self.touchedPoint = plotAreaPoint; if ( [theDelegate respondsToSelector:@selector(plotAreaTouchDown:)] ) { @@ -721,7 +745,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTGraph *theGraph = self.graph; @@ -730,9 +754,9 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio } CGPoint lastPoint = self.touchedPoint; - self.touchedPoint = CGPointMake(NAN, NAN); + 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:)] || @@ -740,9 +764,9 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio // Inform delegate if a point was hit CGPoint plotAreaPoint = [theGraph convertPoint:interactionPoint toLayer:self]; - if ( CGRectContainsPoint(self.bounds, plotAreaPoint) ) { + if ( CGRectContainsPoint(self.bounds, plotAreaPoint)) { CGVector offset = CGVectorMake(plotAreaPoint.x - lastPoint.x, plotAreaPoint.y - lastPoint.y); - if ( (offset.dx * offset.dx + offset.dy * offset.dy) <= CPTFloat(25.0) ) { + if ((offset.dx * offset.dx + offset.dy * offset.dy) <= CPTFloat(25.0)) { if ( [theDelegate respondsToSelector:@selector(plotAreaTouchUp:)] ) { [theDelegate plotAreaTouchUp:self]; } @@ -774,17 +798,17 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio /// @cond --(CPTLineStyle *)borderLineStyle +-(nullable CPTLineStyle *)borderLineStyle { return self.axisSet.borderLineStyle; } --(void)setBorderLineStyle:(CPTLineStyle *)newLineStyle +-(void)setBorderLineStyle:(nullable CPTLineStyle *)newLineStyle { self.axisSet.borderLineStyle = newLineStyle; } --(void)setFill:(CPTFill *)newFill +-(void)setFill:(nullable CPTFill *)newFill { if ( newFill != fill ) { fill = [newFill copy]; @@ -792,37 +816,41 @@ -(void)setFill:(CPTFill *)newFill } } --(void)setMinorGridLineGroup:(CPTGridLineGroup *)newGridLines +-(void)setMinorGridLineGroup:(nullable CPTGridLineGroup *)newGridLines { - if ( (newGridLines != minorGridLineGroup) || self.isUpdatingLayers ) { + if ((newGridLines != minorGridLineGroup) || self.isUpdatingLayers ) { [minorGridLineGroup removeFromSuperlayer]; minorGridLineGroup = newGridLines; if ( newGridLines ) { - newGridLines.plotArea = self; - newGridLines.major = NO; - [self insertSublayer:newGridLines atIndex:[self indexForLayerType:CPTGraphLayerTypeMinorGridLines]]; + CPTGridLineGroup *gridLines = newGridLines; + + gridLines.plotArea = self; + gridLines.major = NO; + [self insertSublayer:gridLines atIndex:[self indexForLayerType:CPTGraphLayerTypeMinorGridLines]]; } [self setNeedsLayout]; } } --(void)setMajorGridLineGroup:(CPTGridLineGroup *)newGridLines +-(void)setMajorGridLineGroup:(nullable CPTGridLineGroup *)newGridLines { - if ( (newGridLines != majorGridLineGroup) || self.isUpdatingLayers ) { + if ((newGridLines != majorGridLineGroup) || self.isUpdatingLayers ) { [majorGridLineGroup removeFromSuperlayer]; majorGridLineGroup = newGridLines; if ( newGridLines ) { - newGridLines.plotArea = self; - newGridLines.major = YES; - [self insertSublayer:newGridLines atIndex:[self indexForLayerType:CPTGraphLayerTypeMajorGridLines]]; + CPTGridLineGroup *gridLines = newGridLines; + + gridLines.plotArea = self; + gridLines.major = YES; + [self insertSublayer:gridLines atIndex:[self indexForLayerType:CPTGraphLayerTypeMajorGridLines]]; } [self setNeedsLayout]; } } --(void)setAxisSet:(CPTAxisSet *)newAxisSet +-(void)setAxisSet:(nullable CPTAxisSet *)newAxisSet { - if ( (newAxisSet != axisSet) || self.isUpdatingLayers ) { + if ((newAxisSet != axisSet) || self.isUpdatingLayers ) { [axisSet removeFromSuperlayer]; for ( CPTAxis *axis in axisSet.axes ) { axis.plotArea = nil; @@ -835,9 +863,11 @@ -(void)setAxisSet:(CPTAxisSet *)newAxisSet [self updateAxisSetLayersForType:CPTGraphLayerTypeAxisTitles]; if ( newAxisSet ) { - CPTGraph *theGraph = self.graph; - [self insertSublayer:newAxisSet atIndex:[self indexForLayerType:CPTGraphLayerTypeAxisLines]]; - for ( CPTAxis *axis in newAxisSet.axes ) { + CPTGraph *theGraph = self.graph; + CPTAxisSet *theAxisSet = newAxisSet; + + [self insertSublayer:theAxisSet atIndex:[self indexForLayerType:CPTGraphLayerTypeAxisLines]]; + for ( CPTAxis *axis in theAxisSet.axes ) { axis.plotArea = self; axis.graph = theGraph; } @@ -846,43 +876,49 @@ -(void)setAxisSet:(CPTAxisSet *)newAxisSet } } --(void)setPlotGroup:(CPTPlotGroup *)newPlotGroup +-(void)setPlotGroup:(nullable CPTPlotGroup *)newPlotGroup { - if ( (newPlotGroup != plotGroup) || self.isUpdatingLayers ) { + if ((newPlotGroup != plotGroup) || self.isUpdatingLayers ) { [plotGroup removeFromSuperlayer]; plotGroup = newPlotGroup; if ( newPlotGroup ) { - [self insertSublayer:newPlotGroup atIndex:[self indexForLayerType:CPTGraphLayerTypePlots]]; + CPTPlotGroup *group = newPlotGroup; + + [self insertSublayer:group atIndex:[self indexForLayerType:CPTGraphLayerTypePlots]]; } [self setNeedsLayout]; } } --(void)setAxisLabelGroup:(CPTAxisLabelGroup *)newAxisLabelGroup +-(void)setAxisLabelGroup:(nullable CPTAxisLabelGroup *)newAxisLabelGroup { - if ( (newAxisLabelGroup != axisLabelGroup) || self.isUpdatingLayers ) { + if ((newAxisLabelGroup != axisLabelGroup) || self.isUpdatingLayers ) { [axisLabelGroup removeFromSuperlayer]; axisLabelGroup = newAxisLabelGroup; if ( newAxisLabelGroup ) { - [self insertSublayer:newAxisLabelGroup atIndex:[self indexForLayerType:CPTGraphLayerTypeAxisLabels]]; + CPTAxisLabelGroup *group = newAxisLabelGroup; + + [self insertSublayer:group atIndex:[self indexForLayerType:CPTGraphLayerTypeAxisLabels]]; } [self setNeedsLayout]; } } --(void)setAxisTitleGroup:(CPTAxisLabelGroup *)newAxisTitleGroup +-(void)setAxisTitleGroup:(nullable CPTAxisLabelGroup *)newAxisTitleGroup { - if ( (newAxisTitleGroup != axisTitleGroup) || self.isUpdatingLayers ) { + if ((newAxisTitleGroup != axisTitleGroup) || self.isUpdatingLayers ) { [axisTitleGroup removeFromSuperlayer]; axisTitleGroup = newAxisTitleGroup; if ( newAxisTitleGroup ) { - [self insertSublayer:newAxisTitleGroup atIndex:[self indexForLayerType:CPTGraphLayerTypeAxisTitles]]; + CPTAxisLabelGroup *group = newAxisTitleGroup; + + [self insertSublayer:group atIndex:[self indexForLayerType:CPTGraphLayerTypeAxisTitles]]; } [self setNeedsLayout]; } } --(void)setTopDownLayerOrder:(CPTNumberArray)newArray +-(void)setTopDownLayerOrder:(nullable CPTNumberArray *)newArray { if ( newArray != topDownLayerOrder ) { topDownLayerOrder = newArray; @@ -890,10 +926,10 @@ -(void)setTopDownLayerOrder:(CPTNumberArray)newArray } } --(void)setGraph:(CPTGraph *)newGraph +-(void)setGraph:(nullable CPTGraph *)newGraph { if ( newGraph != self.graph ) { - [super setGraph:newGraph]; + super.graph = newGraph; for ( CPTAxis *axis in self.axisSet.axes ) { axis.graph = newGraph; @@ -903,11 +939,11 @@ -(void)setGraph:(CPTGraph *)newGraph -(void)setBounds:(CGRect)newBounds { - if ( !CGRectEqualToRect(self.bounds, newBounds) ) { - [super setBounds:newBounds]; - + if ( !CGRectEqualToRect(self.bounds, newBounds)) { self.widthDecimal = CPTDecimalFromCGFloat(newBounds.size.width); self.heightDecimal = CPTDecimalFromCGFloat(newBounds.size.height); + + super.bounds = newBounds; } } diff --git a/framework/Source/CPTPlotAreaFrame.m b/framework/Source/CPTPlotAreaFrame.m index 9102b3392..c5723c6a0 100644 --- a/framework/Source/CPTPlotAreaFrame.m +++ b/framework/Source/CPTPlotAreaFrame.m @@ -7,7 +7,7 @@ /// @cond @interface CPTPlotAreaFrame() -@property (nonatomic, readwrite, strong) CPTPlotArea *plotArea; +@property (nonatomic, readwrite, strong, nullable) CPTPlotArea *plotArea; @end @@ -23,17 +23,17 @@ @interface CPTPlotAreaFrame() **/ @implementation CPTPlotAreaFrame -/** @property CPTPlotArea *plotArea +/** @property nullable CPTPlotArea *plotArea * @brief The plot area. **/ @synthesize plotArea; -/** @property CPTAxisSet *axisSet +/** @property nullable CPTAxisSet *axisSet * @brief The axis set. **/ @dynamic axisSet; -/** @property CPTPlotGroup *plotGroup +/** @property nullable CPTPlotGroup *plotGroup * @brief The plot group. **/ @dynamic plotGroup; @@ -54,9 +54,9 @@ @implementation CPTPlotAreaFrame * @param newFrame The frame rectangle. * @return The initialized CPTPlotAreaFrame object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plotArea = nil; CPTPlotArea *newPlotArea = [[CPTPlotArea alloc] initWithFrame:newFrame]; @@ -72,9 +72,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTPlotAreaFrame *theLayer = (CPTPlotAreaFrame *)layer; plotArea = theLayer->plotArea; @@ -89,23 +89,36 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeObject:self.plotArea forKey:@"CPTPlotAreaFrame.plotArea"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - plotArea = [coder decodeObjectForKey:@"CPTPlotAreaFrame.plotArea"]; + if ((self = [super initWithCoder:coder])) { + plotArea = [coder decodeObjectOfClass:[CPTPlotArea class] + forKey:@"CPTPlotAreaFrame.plotArea"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Event Handling @@ -121,7 +134,7 @@ -(instancetype)initWithCoder:(NSCoder *)coder * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { if ( [self.plotArea pointingDeviceDownEvent:event atPoint:interactionPoint] ) { return YES; @@ -140,7 +153,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { if ( [self.plotArea pointingDeviceUpEvent:event atPoint:interactionPoint] ) { return YES; @@ -159,7 +172,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { if ( [self.plotArea pointingDeviceDraggedEvent:event atPoint:interactionPoint] ) { return YES; @@ -178,7 +191,7 @@ -(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)inter * @param event The OS event. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event +-(BOOL)pointingDeviceCancelledEvent:(nonnull CPTNativeEvent *)event { if ( [self.plotArea pointingDeviceCancelledEvent:event] ) { return YES; @@ -195,45 +208,47 @@ -(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event /// @cond --(void)setPlotArea:(CPTPlotArea *)newPlotArea +-(void)setPlotArea:(nullable CPTPlotArea *)newPlotArea { if ( newPlotArea != plotArea ) { [plotArea removeFromSuperlayer]; plotArea = newPlotArea; if ( newPlotArea ) { - [self insertSublayer:newPlotArea atIndex:0]; - newPlotArea.graph = self.graph; + CPTPlotArea *theArea = newPlotArea; + + [self insertSublayer:theArea atIndex:0]; + theArea.graph = self.graph; } [self setNeedsLayout]; } } --(CPTAxisSet *)axisSet +-(nullable CPTAxisSet *)axisSet { return self.plotArea.axisSet; } --(void)setAxisSet:(CPTAxisSet *)newAxisSet +-(void)setAxisSet:(nullable CPTAxisSet *)newAxisSet { self.plotArea.axisSet = newAxisSet; } --(CPTPlotGroup *)plotGroup +-(nullable CPTPlotGroup *)plotGroup { return self.plotArea.plotGroup; } --(void)setPlotGroup:(CPTPlotGroup *)newPlotGroup +-(void)setPlotGroup:(nullable CPTPlotGroup *)newPlotGroup { self.plotArea.plotGroup = newPlotGroup; } --(void)setGraph:(CPTGraph *)newGraph +-(void)setGraph:(nullable CPTGraph *)newGraph { if ( newGraph != self.graph ) { - [super setGraph:newGraph]; + super.graph = newGraph; self.plotArea.graph = newGraph; } diff --git a/framework/Source/CPTPlotGroup.m b/framework/Source/CPTPlotGroup.m index d80b7ab82..4a224e691 100644 --- a/framework/Source/CPTPlotGroup.m +++ b/framework/Source/CPTPlotGroup.m @@ -12,12 +12,13 @@ @implementation CPTPlotGroup /// @cond --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { // support old archives if ( [coder containsValueForKey:@"CPTPlotGroup.identifier"] ) { - self.identifier = [coder decodeObjectForKey:@"CPTPlotGroup.identifier"]; + self.identifier = [coder decodeObjectOfClass:[NSObject class] + forKey:@"CPTPlotGroup.identifier"]; } } return self; @@ -25,13 +26,25 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Organizing Plots /** @brief Add a plot to this plot group. * @param plot The plot. **/ --(void)addPlot:(CPTPlot *)plot +-(void)addPlot:(nonnull CPTPlot *)plot { NSParameterAssert(plot); @@ -42,7 +55,7 @@ -(void)addPlot:(CPTPlot *)plot * @param plot The plot. * @param idx The index at which to insert the plot. This value must not be greater than the count of elements in the sublayer array. **/ --(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx +-(void)insertPlot:(nonnull CPTPlot *)plot atIndex:(NSUInteger)idx { NSParameterAssert(plot); NSParameterAssert(idx <= [[self sublayers] count]); @@ -53,9 +66,9 @@ -(void)insertPlot:(CPTPlot *)plot atIndex:(NSUInteger)idx /** @brief Remove a plot from this plot group. * @param plot The plot to remove. **/ --(void)removePlot:(CPTPlot *)plot +-(void)removePlot:(nullable CPTPlot *)plot { - if ( self == [plot superlayer] ) { + if ( self == plot.superlayer ) { [plot removeFromSuperlayer]; } } @@ -70,7 +83,7 @@ -(void)display // nothing to draw } --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef __unused)context { // nothing to draw } diff --git a/framework/Source/CPTPlotRange.h b/framework/Source/CPTPlotRange.h index ef2c1aa81..9a3460e96 100644 --- a/framework/Source/CPTPlotRange.h +++ b/framework/Source/CPTPlotRange.h @@ -7,23 +7,24 @@ /** * @brief Enumeration of possible results of a plot range comparison. **/ -typedef NS_ENUM (NSInteger, CPTPlotRangeComparisonResult) { +typedef NS_CLOSED_ENUM(NSInteger, CPTPlotRangeComparisonResult) { CPTPlotRangeComparisonResultNumberBelowRange, ///< Number is below the range. CPTPlotRangeComparisonResultNumberInRange, ///< Number is in the range. - CPTPlotRangeComparisonResultNumberAboveRange ///< Number is above the range. + CPTPlotRangeComparisonResultNumberAboveRange, ///< Number is above the range. + CPTPlotRangeComparisonResultNumberUndefined ///< Number is undefined (e.g., @NAN). }; /** * @brief An array of plot ranges. **/ -typedef NSArray *CPTPlotRangeArray; +typedef NSArray CPTPlotRangeArray; /** * @brief A mutable array of plot ranges. **/ -typedef NSMutableArray *CPTMutablePlotRangeArray; +typedef NSMutableArray CPTMutablePlotRangeArray; -@interface CPTPlotRange : NSObject +@interface CPTPlotRange : NSObject /// @name Range Limits /// @{ @@ -46,6 +47,9 @@ typedef NSMutableArray *CPTMutablePlotRangeArray; @property (nonatomic, readonly) double minLimitDouble; @property (nonatomic, readonly) double midPointDouble; @property (nonatomic, readonly) double maxLimitDouble; + +@property (nonatomic, readonly) BOOL isInfinite; +@property (nonatomic, readonly) CPTSign lengthSign; /// @} /// @name Factory Methods @@ -56,9 +60,9 @@ typedef NSMutableArray *CPTMutablePlotRangeArray; /// @name Initialization /// @{ --(nonnull instancetype)initWithLocation:(nonnull NSNumber *)loc length:(nonnull NSNumber *)len; --(nonnull instancetype)initWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithLocation:(nonnull NSNumber *)loc length:(nonnull NSNumber *)len NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} /// @name Checking Ranges diff --git a/framework/Source/CPTPlotRange.m b/framework/Source/CPTPlotRange.m index a38bde557..c83c432e6 100644 --- a/framework/Source/CPTPlotRange.m +++ b/framework/Source/CPTPlotRange.m @@ -12,6 +12,9 @@ @interface CPTPlotRange() @property (nonatomic, readwrite) double locationDouble; @property (nonatomic, readwrite) double lengthDouble; +@property (nonatomic, readwrite) BOOL isInfinite; +@property (nonatomic, readwrite) CPTSign lengthSign; + @property (nonatomic, readwrite) BOOL inValueUpdate; @end @@ -25,19 +28,19 @@ @interface CPTPlotRange() **/ @implementation CPTPlotRange -/** @property NSNumber *location +/** @property nonnull NSNumber *location * @brief The starting value of the range. * @see @ref locationDecimal, @ref locationDouble **/ @dynamic location; -/** @property NSNumber *length +/** @property nonnull NSNumber *length * @brief The length of the range. * @see @ref lengthDecimal, @ref lengthDouble **/ @dynamic length; -/** @property NSNumber *end; +/** @property nonnull NSNumber *end; * @brief The ending value of the range, equivalent to @ref location + @ref length. **/ @dynamic end; @@ -76,7 +79,7 @@ @implementation CPTPlotRange **/ @dynamic endDouble; -/** @property NSNumber *minLimit +/** @property nonnull NSNumber *minLimit * @brief The minimum extreme value of the range. **/ @dynamic minLimit; @@ -91,7 +94,7 @@ @implementation CPTPlotRange **/ @dynamic minLimitDouble; -/** @property NSNumber *midPoint +/** @property nonnull NSNumber *midPoint * @brief The middle value of the range. **/ @dynamic midPoint; @@ -106,7 +109,7 @@ @implementation CPTPlotRange **/ @dynamic midPointDouble; -/** @property NSNumber *maxLimit +/** @property nonnull NSNumber *maxLimit * @brief The maximum extreme value of the range. **/ @dynamic maxLimit; @@ -121,6 +124,16 @@ @implementation CPTPlotRange **/ @dynamic maxLimitDouble; +/** @property BOOL isInfinite + * @brief @YES if the length of the range is infinite. + **/ +@synthesize isInfinite; + +/** @property CPTSign lengthSign + * @brief The direction (positive or negative) if the length of the range is infinite. + **/ +@synthesize lengthSign; + @synthesize inValueUpdate; #pragma mark - @@ -131,7 +144,7 @@ @implementation CPTPlotRange * @param len The length of the range. * @return A new CPTPlotRange instance initialized with the provided location and length. **/ -+(instancetype)plotRangeWithLocation:(NSNumber *)loc length:(NSNumber *)len ++(nonnull instancetype)plotRangeWithLocation:(nonnull NSNumber *)loc length:(nonnull NSNumber *)len { return [[self alloc] initWithLocation:loc length:len]; } @@ -141,7 +154,7 @@ +(instancetype)plotRangeWithLocation:(NSNumber *)loc length:(NSNumber *)len * @param len The length of the range. * @return A new CPTPlotRange instance initialized with the provided location and length. **/ -+(instancetype)plotRangeWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len ++(nonnull instancetype)plotRangeWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len { return [[self alloc] initWithLocationDecimal:loc lengthDecimal:len]; } @@ -151,13 +164,29 @@ +(instancetype)plotRangeWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDeci * @param len The length of the range. * @return The initialized CPTPlotRange object. **/ --(instancetype)initWithLocation:(NSNumber *)loc length:(NSNumber *)len +-(nonnull instancetype)initWithLocation:(nonnull NSNumber *)loc length:(nonnull NSNumber *)len { NSParameterAssert(loc); NSParameterAssert(len); - return [self initWithLocationDecimal:loc.decimalValue - lengthDecimal:len.decimalValue]; + if ((self = [super init])) { + locationDecimal = loc.decimalValue; + locationDouble = loc.doubleValue; + + lengthDecimal = len.decimalValue; + lengthDouble = len.doubleValue; + + if ( isnan(lengthDouble)) { + isInfinite = NO; + lengthSign = CPTSignNone; + } + else { + isInfinite = (BOOL)isinf(lengthDouble); + lengthSign = signbit(lengthDouble) ? CPTSignNegative : CPTSignPositive; + } + } + + return self; } /** @brief Initializes a newly allocated CPTPlotRange object with the provided location and length. @@ -165,13 +194,10 @@ -(instancetype)initWithLocation:(NSNumber *)loc length:(NSNumber *)len * @param len The length of the range. * @return The initialized CPTPlotRange object. **/ --(instancetype)initWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len +-(nonnull instancetype)initWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)len { - if ( (self = [super init]) ) { - self.locationDecimal = loc; - self.lengthDecimal = len; - } - return self; + return [self initWithLocation:[NSDecimalNumber decimalNumberWithDecimal:loc] + length:[NSDecimalNumber decimalNumberWithDecimal:len]]; } /// @name Initialization @@ -185,7 +211,7 @@ -(instancetype)initWithLocationDecimal:(NSDecimal)loc lengthDecimal:(NSDecimal)l * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { return [self initWithLocation:@0.0 length:@0.0]; } @@ -204,11 +230,15 @@ -(NSNumber *)location -(void)setLocationDecimal:(NSDecimal)newLocation { - if ( !CPTDecimalEquals(locationDecimal, newLocation) ) { + if ( !CPTDecimalEquals(locationDecimal, newLocation)) { locationDecimal = newLocation; if ( !self.inValueUpdate ) { - self.locationDouble = [[NSDecimalNumber decimalNumberWithDecimal:newLocation] doubleValue]; + self.inValueUpdate = YES; + + self.locationDouble = CPTDecimalDoubleValue(newLocation); + + self.inValueUpdate = NO; } } } @@ -219,7 +249,11 @@ -(void)setLocationDouble:(double)newLocation locationDouble = newLocation; if ( !self.inValueUpdate ) { - self.locationDecimal = @(newLocation).decimalValue; + self.inValueUpdate = YES; + + self.locationDecimal = CPTDecimalFromDouble(newLocation); + + self.inValueUpdate = NO; } } } @@ -231,11 +265,15 @@ -(NSNumber *)length -(void)setLengthDecimal:(NSDecimal)newLength { - if ( !CPTDecimalEquals(lengthDecimal, newLength) ) { + if ( !CPTDecimalEquals(lengthDecimal, newLength)) { lengthDecimal = newLength; if ( !self.inValueUpdate ) { - self.lengthDouble = [[NSDecimalNumber decimalNumberWithDecimal:newLength] doubleValue]; + self.inValueUpdate = YES; + + self.lengthDouble = CPTDecimalDoubleValue(newLength); + + self.inValueUpdate = NO; } } } @@ -245,8 +283,21 @@ -(void)setLengthDouble:(double)newLength if ( lengthDouble != newLength ) { lengthDouble = newLength; + if ( isnan(newLength)) { + self.isInfinite = NO; + self.lengthSign = CPTSignNone; + } + else { + self.isInfinite = (BOOL)isinf(newLength); + self.lengthSign = signbit(newLength) ? CPTSignNegative : CPTSignPositive; + } + if ( !self.inValueUpdate ) { - self.lengthDecimal = @(newLength).decimalValue; + self.inValueUpdate = YES; + + self.lengthDecimal = CPTDecimalFromDouble(newLength); + + self.inValueUpdate = NO; } } } @@ -276,7 +327,10 @@ -(NSDecimal)minLimitDecimal NSDecimal loc = self.locationDecimal; NSDecimal len = self.lengthDecimal; - if ( CPTDecimalLessThan( len, CPTDecimalFromInteger(0) ) ) { + if ( NSDecimalIsNotANumber(&len)) { + return loc; + } + else if ( CPTDecimalLessThan(len, CPTDecimalFromInteger(0))) { return CPTDecimalAdd(loc, len); } else { @@ -304,7 +358,7 @@ -(NSNumber *)midPoint -(NSDecimal)midPointDecimal { - return CPTDecimalAdd( self.locationDecimal, CPTDecimalDivide( self.lengthDecimal, CPTDecimalFromInteger(2) ) ); + return CPTDecimalAdd(self.locationDecimal, CPTDecimalDivide(self.lengthDecimal, CPTDecimalFromInteger(2))); } -(double)midPointDouble @@ -322,7 +376,10 @@ -(NSDecimal)maxLimitDecimal NSDecimal loc = self.locationDecimal; NSDecimal len = self.lengthDecimal; - if ( CPTDecimalGreaterThan( len, CPTDecimalFromInteger(0) ) ) { + if ( NSDecimalIsNotANumber(&len)) { + return loc; + } + else if ( CPTDecimalGreaterThan(len, CPTDecimalFromInteger(0))) { return CPTDecimalAdd(loc, len); } else { @@ -350,15 +407,20 @@ -(double)maxLimitDouble /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTPlotRange *newRange = [[CPTPlotRange allocWithZone:zone] init]; if ( newRange ) { + newRange.inValueUpdate = YES; + newRange.locationDecimal = self.locationDecimal; - newRange.lengthDecimal = self.lengthDecimal; newRange.locationDouble = self.locationDouble; - newRange.lengthDouble = self.lengthDouble; + + newRange.lengthDecimal = self.lengthDecimal; + newRange.lengthDouble = self.lengthDouble; + + newRange.inValueUpdate = NO; } return newRange; } @@ -370,15 +432,20 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(id)mutableCopyWithZone:(NSZone *)zone +-(nonnull id)mutableCopyWithZone:(nullable NSZone *)zone { CPTPlotRange *newRange = [[CPTMutablePlotRange allocWithZone:zone] init]; if ( newRange ) { + newRange.inValueUpdate = YES; + newRange.locationDecimal = self.locationDecimal; - newRange.lengthDecimal = self.lengthDecimal; newRange.locationDouble = self.locationDouble; - newRange.lengthDouble = self.lengthDouble; + + newRange.lengthDecimal = self.lengthDecimal; + newRange.lengthDouble = self.lengthDouble; + + newRange.inValueUpdate = NO; } return newRange; } @@ -390,10 +457,12 @@ -(id)mutableCopyWithZone:(NSZone *)zone /// @cond --(void)encodeWithCoder:(NSCoder *)encoder +-(void)encodeWithCoder:(nonnull NSCoder *)encoder { [encoder encodeDecimal:self.locationDecimal forKey:@"CPTPlotRange.location"]; [encoder encodeDecimal:self.lengthDecimal forKey:@"CPTPlotRange.length"]; + [encoder encodeBool:self.isInfinite forKey:@"CPTPlotRange.isInfinite"]; + [encoder encodeInteger:self.lengthSign forKey:@"CPTPlotRange.lengthSign"]; } /// @endcond @@ -402,16 +471,31 @@ -(void)encodeWithCoder:(NSCoder *)encoder * @param decoder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)decoder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.locationDecimal = [decoder decodeDecimalForKey:@"CPTPlotRange.location"]; self.lengthDecimal = [decoder decodeDecimalForKey:@"CPTPlotRange.length"]; + + isInfinite = [decoder decodeBoolForKey:@"CPTPlotRange.isInfinite"]; + lengthSign = [decoder decodeIntegerForKey:@"CPTPlotRange.lengthSign"]; } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Checking Containership @@ -421,7 +505,27 @@ -(instancetype)initWithCoder:(NSCoder *)decoder **/ -(BOOL)contains:(NSDecimal)number { - return CPTDecimalGreaterThanOrEqualTo(number, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(number, self.maxLimitDecimal); + BOOL result = NO; + + if ( self.isInfinite ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + result = CPTDecimalGreaterThanOrEqualTo(number, self.minLimitDecimal); + break; + + case CPTSignNegative: + result = CPTDecimalLessThanOrEqualTo(number, self.maxLimitDecimal); + break; + + default: + break; + } + } + else { + result = CPTDecimalGreaterThanOrEqualTo(number, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(number, self.maxLimitDecimal); + } + + return result; } /** @brief Determines whether a given number is inside the range. @@ -437,15 +541,13 @@ -(BOOL)containsDouble:(double)number * @param number The number to check. * @return @YES if @ref location ≤ @par{number} ≤ @ref end. **/ --(BOOL)containsNumber:(NSNumber *)number +-(BOOL)containsNumber:(nullable NSNumber *)number { if ( [number isKindOfClass:[NSDecimalNumber class]] ) { - NSDecimal numericValue = number.decimalValue; - return CPTDecimalGreaterThanOrEqualTo(numericValue, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(numericValue, self.maxLimitDecimal); + return [self contains:number.decimalValue]; } else { - double numericValue = number.doubleValue; - return (numericValue >= self.minLimitDouble) && (numericValue <= self.maxLimitDouble); + return [self containsDouble:number.doubleValue]; } } @@ -453,10 +555,13 @@ -(BOOL)containsNumber:(NSNumber *)number * @param otherRange The range to check. * @return @YES if the ranges both have the same location and length. **/ --(BOOL)isEqualToRange:(CPTPlotRange *)otherRange +-(BOOL)isEqualToRange:(nullable CPTPlotRange *)otherRange { if ( otherRange ) { - return CPTDecimalEquals(self.locationDecimal, otherRange.locationDecimal) && CPTDecimalEquals(self.lengthDecimal, otherRange.lengthDecimal); + return CPTDecimalEquals(self.locationDecimal, otherRange.locationDecimal) && + CPTDecimalEquals(self.lengthDecimal, otherRange.lengthDecimal) && + (self.isInfinite == otherRange.isInfinite) && + (self.lengthSign == otherRange.lengthSign); } else { return NO; @@ -467,42 +572,100 @@ -(BOOL)isEqualToRange:(CPTPlotRange *)otherRange * @param otherRange The range to check. * @return @YES if the other range fits entirely within the range of the receiver. **/ --(BOOL)containsRange:(CPTPlotRange *)otherRange +-(BOOL)containsRange:(nullable CPTPlotRange *)otherRange { + BOOL result = NO; + if ( otherRange ) { - return CPTDecimalGreaterThanOrEqualTo(otherRange.minLimitDecimal, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(otherRange.maxLimitDecimal, self.maxLimitDecimal); - } - else { - return NO; + if ( self.isInfinite ) { + if ( !otherRange.isInfinite || (otherRange.lengthSign == self.lengthSign)) { + switch ( self.lengthSign ) { + case CPTSignPositive: + result = CPTDecimalGreaterThanOrEqualTo(otherRange.minLimitDecimal, self.minLimitDecimal); + break; + + case CPTSignNegative: + result = CPTDecimalLessThanOrEqualTo(otherRange.maxLimitDecimal, self.maxLimitDecimal); + break; + + default: + break; + } + } + } + else { + result = CPTDecimalGreaterThanOrEqualTo(otherRange.minLimitDecimal, self.minLimitDecimal) && CPTDecimalLessThanOrEqualTo(otherRange.maxLimitDecimal, self.maxLimitDecimal); + } } + + return result; } /** @brief Determines whether a given range intersects the receiver. * @param otherRange The range to check. * @return @YES if the ranges intersect. **/ --(BOOL)intersectsRange:(CPTPlotRange *)otherRange +-(BOOL)intersectsRange:(nullable CPTPlotRange *)otherRange { - if ( !otherRange ) { - return NO; - } - - NSDecimal min1 = self.minLimitDecimal; - NSDecimal min2 = otherRange.minLimitDecimal; - NSDecimal minimum = CPTDecimalGreaterThan(min1, min2) ? min1 : min2; + BOOL result = NO; - NSDecimal max1 = self.maxLimitDecimal; - NSDecimal max2 = otherRange.maxLimitDecimal; - NSDecimal maximum = CPTDecimalLessThan(max1, max2) ? max1 : max2; + if ( otherRange ) { + if ( self.isInfinite ) { + if ( otherRange.isInfinite ) { + result = (otherRange.lengthSign == self.lengthSign); + } + if ( !result ) { + switch ( self.lengthSign ) { + case CPTSignPositive: + result = CPTDecimalGreaterThanOrEqualTo(otherRange.maxLimitDecimal, self.minLimitDecimal); + break; + + case CPTSignNegative: + result = CPTDecimalLessThanOrEqualTo(otherRange.minLimitDecimal, self.maxLimitDecimal); + break; + + default: + break; + } + } + } + else { + if ( otherRange.isInfinite ) { + switch ( otherRange.lengthSign ) { + case CPTSignPositive: + result = CPTDecimalLessThanOrEqualTo(otherRange.minLimitDecimal, self.maxLimitDecimal); + break; + + case CPTSignNegative: + result = CPTDecimalLessThanOrEqualTo(otherRange.maxLimitDecimal, self.minLimitDecimal); + break; + + default: + break; + } + } + else { + NSDecimal min1 = self.minLimitDecimal; + NSDecimal min2 = otherRange.minLimitDecimal; + NSDecimal minimum = CPTDecimalMax(min1, min2); + + NSDecimal max1 = self.maxLimitDecimal; + NSDecimal max2 = otherRange.maxLimitDecimal; + NSDecimal maximum = CPTDecimalMin(max1, max2); + + result = CPTDecimalGreaterThanOrEqualTo(maximum, minimum); + } + } + } - return CPTDecimalGreaterThanOrEqualTo(maximum, minimum); + return result; } /** @brief Compares a number to the range, determining if it is in the range, or above or below it. * @param number The number to check. * @return The comparison result. **/ --(CPTPlotRangeComparisonResult)compareToNumber:(NSNumber *)number +-(CPTPlotRangeComparisonResult)compareToNumber:(nonnull NSNumber *)number { CPTPlotRangeComparisonResult result; @@ -523,10 +686,13 @@ -(CPTPlotRangeComparisonResult)compareToDecimal:(NSDecimal)number { CPTPlotRangeComparisonResult result; - if ( [self contains:number] ) { + if ( NSDecimalIsNotANumber(&number)) { + result = CPTPlotRangeComparisonResultNumberUndefined; + } + else if ( [self contains:number] ) { result = CPTPlotRangeComparisonResultNumberInRange; } - else if ( CPTDecimalLessThan(number, self.minLimitDecimal) ) { + else if ( CPTDecimalLessThan(number, self.minLimitDecimal)) { result = CPTPlotRangeComparisonResultNumberBelowRange; } else { @@ -543,7 +709,10 @@ -(CPTPlotRangeComparisonResult)compareToDouble:(double)number { CPTPlotRangeComparisonResult result; - if ( number < self.minLimitDouble ) { + if ( isnan(number)) { + result = CPTPlotRangeComparisonResultNumberUndefined; + } + else if ( number < self.minLimitDouble ) { result = CPTPlotRangeComparisonResultNumberBelowRange; } else if ( number > self.maxLimitDouble ) { @@ -560,7 +729,7 @@ -(CPTPlotRangeComparisonResult)compareToDouble:(double)number /// @cond --(BOOL)isEqual:(id)object +-(BOOL)isEqual:(nullable id)object { if ( self == object ) { return YES; @@ -588,15 +757,15 @@ -(NSUInteger)hash /// @cond --(NSString *)description +-(nullable NSString *)description { NSDecimal myLocation = self.locationDecimal; NSDecimal myLength = self.lengthDecimal; return [NSString stringWithFormat:@"<%@ {%@, %@}>", - [super description], + super.description, NSDecimalString(&myLocation, [NSLocale currentLocale]), - NSDecimalString(&myLength, [NSLocale currentLocale])]; + self.isInfinite ? (self.lengthSign == CPTSignPositive ? @"+INF" : @"-INF") : NSDecimalString(&myLength, [NSLocale currentLocale])]; } /// @endcond @@ -606,14 +775,14 @@ -(NSString *)description /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { NSDecimal myLocation = self.locationDecimal; NSDecimal myLength = self.lengthDecimal; return [NSString stringWithFormat:@"Location: %@\nLength: %@", NSDecimalString(&myLocation, [NSLocale currentLocale]), - NSDecimalString(&myLength, [NSLocale currentLocale])]; + self.isInfinite ? (self.lengthSign == CPTSignPositive ? @"+INF" : @"-INF") : NSDecimalString(&myLength, [NSLocale currentLocale])]; } /// @endcond diff --git a/framework/Source/CPTPlotRangeTests.m b/framework/Source/CPTPlotRangeTests.m index 304405f39..c5cfeabd0 100644 --- a/framework/Source/CPTPlotRangeTests.m +++ b/framework/Source/CPTPlotRangeTests.m @@ -37,6 +37,17 @@ -(void)testContains XCTAssertFalse([self.plotRange contains:CPTDecimalFromDouble(3.001)], @"Test contains:3.001"); } +-(void)testContainsInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertFalse([self.plotRange contains:CPTDecimalFromDouble(0.999)], @"Test contains:0.999"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(1.0)], @"Test contains:1.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(2.0)], @"Test contains:2.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(3.0)], @"Test contains:3.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(3.001)], @"Test contains:3.001"); +} + -(void)testContainsNegative { self.plotRange.lengthDouble = -2.0; @@ -48,6 +59,17 @@ -(void)testContainsNegative XCTAssertFalse([self.plotRange contains:CPTDecimalFromDouble(1.001)], @"Test contains:1.001"); } +-(void)testContainsNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(-1.001)], @"Test contains:-1.001"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(-1.0)], @"Test contains:-1.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(0.0)], @"Test contains:0.0"); + XCTAssertTrue([self.plotRange contains:CPTDecimalFromDouble(1.0)], @"Test contains:1.0"); + XCTAssertFalse([self.plotRange contains:CPTDecimalFromDouble(1.001)], @"Test contains:1.001"); +} + -(void)testContainsDouble { XCTAssertFalse([self.plotRange containsDouble:0.999], @"Test contains:0.999"); @@ -57,6 +79,17 @@ -(void)testContainsDouble XCTAssertFalse([self.plotRange containsDouble:3.001], @"Test contains:3.001"); } +-(void)testContainsDoubleInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertFalse([self.plotRange containsDouble:0.999], @"Test contains:0.999"); + XCTAssertTrue([self.plotRange containsDouble:1.0], @"Test contains:1.0"); + XCTAssertTrue([self.plotRange containsDouble:2.0], @"Test contains:2.0"); + XCTAssertTrue([self.plotRange containsDouble:3.0], @"Test contains:3.0"); + XCTAssertTrue([self.plotRange containsDouble:3.001], @"Test contains:3.001"); +} + -(void)testContainsNumber { XCTAssertFalse([self.plotRange containsNumber:@(0.999)], @"Test contains:0.999"); @@ -66,6 +99,17 @@ -(void)testContainsNumber XCTAssertFalse([self.plotRange containsNumber:@(3.001)], @"Test contains:3.001"); } +-(void)testContainsNumberInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertFalse([self.plotRange containsNumber:@(0.999)], @"Test contains:0.999"); + XCTAssertTrue([self.plotRange containsNumber:[NSDecimalNumber one]], @"Test contains:1.0"); + XCTAssertTrue([self.plotRange containsNumber:@(2.0)], @"Test contains:2.0"); + XCTAssertTrue([self.plotRange containsNumber:@(3.0)], @"Test contains:3.0"); + XCTAssertTrue([self.plotRange containsNumber:@(3.001)], @"Test contains:3.001"); +} + -(void)testContainsDoubleNegative { self.plotRange.lengthDouble = -2.0; @@ -77,6 +121,17 @@ -(void)testContainsDoubleNegative XCTAssertFalse([self.plotRange containsDouble:1.001], @"Test contains:1.001"); } +-(void)testContainsDoubleNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + XCTAssertTrue([self.plotRange containsDouble:-1.001], @"Test contains:-1.001"); + XCTAssertTrue([self.plotRange containsDouble:-1.0], @"Test contains:-1.0"); + XCTAssertTrue([self.plotRange containsDouble:0.0], @"Test contains:0.0"); + XCTAssertTrue([self.plotRange containsDouble:1.0], @"Test contains:1.0"); + XCTAssertFalse([self.plotRange containsDouble:1.001], @"Test contains:1.001"); +} + -(void)testContainsRange { CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; @@ -96,6 +151,48 @@ -(void)testContainsRange XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); } +-(void)testContainsRangeInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; + + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@2.0]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@1.0]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@4.0]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@2.0]; + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); +} + +-(void)testContainsRangeNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; + + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@(-2.0)]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@(-1.0)]; + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@2.0 length:@4.0]; + XCTAssertFalse([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + + otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(-2.0)]; + XCTAssertTrue([self.plotRange containsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); +} + #pragma mark - #pragma mark Union @@ -120,6 +217,32 @@ -(void)testUnionRange [self checkRangeWithLocation:-5.0 length:12.0]; } +-(void)testUnionRangeInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]]; + [self checkRangeWithLocation:0.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@(-1.0) length:@1.0]]; + [self checkRangeWithLocation:-1.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@2.0]]; + [self checkRangeWithLocation:-1.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@0.0 length:@(-4.0)]]; + [self checkRangeWithLocation:-4.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@(-1.0) length:@(-4.0)]]; + [self checkRangeWithLocation:-5.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@(HUGE_VAL)]]; + [self checkRangeWithLocation:-5.0 length:HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@(-HUGE_VAL)]]; + [self checkRangeWithLocation:-HUGE_VAL length:HUGE_VAL]; +} + -(void)testUnionRangeNegative { self.plotRange.lengthDouble = -2.0; @@ -143,6 +266,32 @@ -(void)testUnionRangeNegative [self checkRangeWithLocation:7.0 length:-12.0]; } +-(void)testUnionRangeNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]]; + [self checkRangeWithLocation:4.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@(-1.0) length:@1.0]]; + [self checkRangeWithLocation:4.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@2.0]]; + [self checkRangeWithLocation:7.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@0.0 length:@(-4.0)]]; + [self checkRangeWithLocation:7.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@(-1.0) length:@(-4.0)]]; + [self checkRangeWithLocation:7.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@10.0 length:@(-HUGE_VAL)]]; + [self checkRangeWithLocation:10.0 length:-HUGE_VAL]; + + [self.plotRange unionPlotRange:[CPTPlotRange plotRangeWithLocation:@5.0 length:@(HUGE_VAL)]]; + [self checkRangeWithLocation:-HUGE_VAL length:HUGE_VAL]; +} + #pragma mark - #pragma mark Intersection @@ -162,7 +311,7 @@ -(void)testIntersectRange otherRange = [CPTPlotRange plotRangeWithLocation:@(-1.0) length:@1.0]; XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); [self.plotRange intersectionPlotRange:otherRange]; - [self checkRangeWithLocation:1.0 length:0.0]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; } -(void)testIntersectRange2 @@ -181,7 +330,7 @@ -(void)testIntersectRange2 otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(-4.0)]; XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); [self.plotRange intersectionPlotRange:otherRange]; - [self checkRangeWithLocation:1.0 length:0.0]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; } -(void)testIntersectRangeNegative @@ -201,7 +350,7 @@ -(void)testIntersectRangeNegative otherRange = [CPTPlotRange plotRangeWithLocation:@5.0 length:@2.0]; XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); [self.plotRange intersectionPlotRange:otherRange]; - [self checkRangeWithLocation:1.0 length:0.0]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; } -(void)testIntersectRangeNegative2 @@ -221,7 +370,67 @@ -(void)testIntersectRangeNegative2 otherRange = [CPTPlotRange plotRangeWithLocation:@5.0 length:@(-4.0)]; XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); [self.plotRange intersectionPlotRange:otherRange]; - [self checkRangeWithLocation:0.0 length:0.0]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; +} + +-(void)testIntersectRangeInfinite1 +{ + self.plotRange.lengthDouble = HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; + XCTAssertTrue([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:1.0 length:3.0]; +} + +-(void)testIntersectRangeInfinite2 +{ + self.plotRange.lengthDouble = HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(HUGE_VAL)]; + XCTAssertTrue([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:1.0 length:HUGE_VAL]; +} + +-(void)testIntersectRangeInfinite3 +{ + self.plotRange.lengthDouble = HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(-4.0)]; + XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; +} + +-(void)testIntersectRangeNegativeInfinite1 +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@4.0]; + XCTAssertTrue([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:1.0 length:-1.0]; +} + +-(void)testIntersectRangeNegativeInfinite2 +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@(-HUGE_VAL)]; + XCTAssertTrue([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:0.0 length:-HUGE_VAL]; +} + +-(void)testIntersectRangeNegativeInfinite3 +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + CPTPlotRange *otherRange = [CPTPlotRange plotRangeWithLocation:@10.0 length:@(-4.0)]; + XCTAssertFalse([self.plotRange intersectsRange:otherRange], @"otherRange was {%g, %g}", otherRange.locationDouble, otherRange.lengthDouble); + [self.plotRange intersectionPlotRange:otherRange]; + [self checkRangeWithLocation:(double)NAN length:(double)NAN]; } #pragma mark - @@ -370,6 +579,19 @@ -(void)testCompareToDecimal XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(2.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:2.0"); XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(3.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.0"); XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(3.001)], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:3.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalNaN()], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); +} + +-(void)testCompareToDecimalInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(0.999)], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:0.999"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(2.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:2.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(3.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(3.001)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalNaN()], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); } -(void)testCompareToDecimalNegative @@ -381,6 +603,19 @@ -(void)testCompareToDecimalNegative XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(0.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:0.0"); XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.001)], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:1.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalNaN()], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); +} + +-(void)testCompareToDecimalNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(-1.001)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-1.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(-1.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-1.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(0.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:0.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.0)], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalFromDouble(1.001)], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:1.001"); + XCTAssertEqual([self.plotRange compareToDecimal:CPTDecimalNaN()], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); } -(void)testCompareToDouble @@ -390,6 +625,23 @@ -(void)testCompareToDouble XCTAssertEqual([self.plotRange compareToDouble:2.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:2.0"); XCTAssertEqual([self.plotRange compareToDouble:3.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.0"); XCTAssertEqual([self.plotRange compareToDouble:3.001], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:3.001"); + XCTAssertEqual([self.plotRange compareToDouble:HUGE_VAL], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:+INF"); + XCTAssertEqual([self.plotRange compareToDouble:-HUGE_VAL], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:-INF"); + XCTAssertEqual([self.plotRange compareToDouble:(double)NAN], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); +} + +-(void)testCompareToDoubleInfinite +{ + self.plotRange.lengthDouble = HUGE_VAL; + + XCTAssertEqual([self.plotRange compareToDouble:0.999], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:0.999"); + XCTAssertEqual([self.plotRange compareToDouble:1.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); + XCTAssertEqual([self.plotRange compareToDouble:2.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:2.0"); + XCTAssertEqual([self.plotRange compareToDouble:3.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.0"); + XCTAssertEqual([self.plotRange compareToDouble:3.001], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:3.001"); + XCTAssertEqual([self.plotRange compareToDouble:HUGE_VAL], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:+INF"); + XCTAssertEqual([self.plotRange compareToDouble:-HUGE_VAL], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:-INF"); + XCTAssertEqual([self.plotRange compareToDouble:(double)NAN], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); } -(void)testCompareToDoubleNegative @@ -401,6 +653,23 @@ -(void)testCompareToDoubleNegative XCTAssertEqual([self.plotRange compareToDouble:0.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:0.0"); XCTAssertEqual([self.plotRange compareToDouble:1.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); XCTAssertEqual([self.plotRange compareToDouble:1.001], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:1.001"); + XCTAssertEqual([self.plotRange compareToDouble:HUGE_VAL], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:+INF"); + XCTAssertEqual([self.plotRange compareToDouble:-HUGE_VAL], CPTPlotRangeComparisonResultNumberBelowRange, @"Test compareTo:-INF"); + XCTAssertEqual([self.plotRange compareToDouble:(double)NAN], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); +} + +-(void)testCompareToDoubleNegativeInfinite +{ + self.plotRange.lengthDouble = -HUGE_VAL; + + XCTAssertEqual([self.plotRange compareToDouble:-1.001], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-1.001"); + XCTAssertEqual([self.plotRange compareToDouble:-1.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-1.0"); + XCTAssertEqual([self.plotRange compareToDouble:0.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:0.0"); + XCTAssertEqual([self.plotRange compareToDouble:1.0], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:1.0"); + XCTAssertEqual([self.plotRange compareToDouble:1.001], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:1.001"); + XCTAssertEqual([self.plotRange compareToDouble:HUGE_VAL], CPTPlotRangeComparisonResultNumberAboveRange, @"Test compareTo:+INF"); + XCTAssertEqual([self.plotRange compareToDouble:-HUGE_VAL], CPTPlotRangeComparisonResultNumberInRange, @"Test compareTo:-INF"); + XCTAssertEqual([self.plotRange compareToDouble:(double)NAN], CPTPlotRangeComparisonResultNumberUndefined, @"Test compareTo:NAN"); } #pragma mark - @@ -408,7 +677,7 @@ -(void)testCompareToDoubleNegative -(void)testKeyedArchivingRoundTrip { - CPTPlotRange *newRange = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:self.plotRange]]; + CPTPlotRange *newRange = [self archiveRoundTrip:self.plotRange]; XCTAssertTrue([self.plotRange isEqualToRange:newRange], @"Ranges equal"); } @@ -423,11 +692,11 @@ -(void)checkRangeWithLocation:(double)loc length:(double)len NSDecimal newLocation = self.plotRange.locationDecimal; errMessage = [NSString stringWithFormat:@"expected location = %g, was %@", loc, NSDecimalString(&newLocation, nil)]; - XCTAssertTrue(CPTDecimalEquals( newLocation, CPTDecimalFromDouble(loc) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(newLocation, CPTDecimalFromDouble(loc)), @"%@", errMessage); NSDecimal newLength = self.plotRange.lengthDecimal; errMessage = [NSString stringWithFormat:@"expected location = %g, was %@", loc, NSDecimalString(&newLength, nil)]; - XCTAssertTrue(CPTDecimalEquals( newLength, CPTDecimalFromDouble(len) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(newLength, CPTDecimalFromDouble(len)), @"%@", errMessage); } @end diff --git a/framework/Source/CPTPlotSpace.h b/framework/Source/CPTPlotSpace.h index 8dd84ec78..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; /// @} @@ -135,7 +145,7 @@ extern NSString *__nonnull const CPTPlotSpaceDisplacementKey; **/ -(BOOL)plotSpace:(nonnull CPTPlotSpace *)space shouldHandlePointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)point; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else /** @brief @optional Notifies that plot space intercepted a scroll wheel event. @@ -156,22 +166,22 @@ extern NSString *__nonnull const CPTPlotSpaceDisplacementKey; /** * @brief An array of plot spaces. **/ -typedef NSArray<__kindof CPTPlotSpace *> *CPTPlotSpaceArray; +typedef NSArray<__kindof CPTPlotSpace *> CPTPlotSpaceArray; /** * @brief A mutable array of plot spaces. **/ -typedef NSMutableArray<__kindof CPTPlotSpace *> *CPTMutablePlotSpaceArray; +typedef NSMutableArray<__kindof CPTPlotSpace *> CPTMutablePlotSpaceArray; #pragma mark - -@interface CPTPlotSpace : NSObject +@interface CPTPlotSpace : NSObject @property (nonatomic, readwrite, copy, nullable) id identifier; @property (nonatomic, readwrite) BOOL allowsUserInteraction; @property (nonatomic, readonly) BOOL isDragging; -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak CPTGraph *graph; -@property (nonatomic, readwrite, cpt_weak_property, nullable) cpt_weak id delegate; +@property (nonatomic, readwrite, cpt_weak_property, nullable) CPTGraph *graph; +@property (nonatomic, readwrite, cpt_weak_property, nullable) id delegate; @property (nonatomic, readonly) NSUInteger numberOfCoordinates; @@ -180,10 +190,10 @@ typedef NSMutableArray<__kindof CPTPlotSpace *> *CPTMutablePlotSpaceArray; -(void)addCategory:(nonnull NSString *)category forCoordinate:(CPTCoordinate)coordinate; -(void)removeCategory:(nonnull NSString *)category forCoordinate:(CPTCoordinate)coordinate; -(void)insertCategory:(nonnull NSString *)category forCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx; --(void)setCategories:(nullable CPTStringArray)newCategories forCoordinate:(CPTCoordinate)coordinate; +-(void)setCategories:(nullable CPTStringArray *)newCategories forCoordinate:(CPTCoordinate)coordinate; -(void)removeAllCategories; --(nonnull CPTStringArray)categoriesForCoordinate:(CPTCoordinate)coordinate; +-(nonnull CPTStringArray *)categoriesForCoordinate:(CPTCoordinate)coordinate; -(nullable NSString *)categoryForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx; -(NSUInteger)indexOfCategory:(nonnull NSString *)category forCoordinate:(CPTCoordinate)coordinate; /// @} @@ -191,7 +201,7 @@ typedef NSMutableArray<__kindof CPTPlotSpace *> *CPTMutablePlotSpaceArray; /// @name Initialization /// @{ -(nonnull instancetype)init NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} @end @@ -205,17 +215,17 @@ typedef NSMutableArray<__kindof CPTPlotSpace *> *CPTMutablePlotSpaceArray; /// @name Coordinate Space Conversions /// @{ --(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray)plotPoint; +-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *)plotPoint; -(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count; -(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count; --(nullable CPTNumberArray)plotPointForPlotAreaViewPoint:(CGPoint)point; +-(nullable CPTNumberArray *)plotPointForPlotAreaViewPoint:(CGPoint)point; -(void)plotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point; -(void)doublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point; -(CGPoint)plotAreaViewPointForEvent:(nonnull CPTNativeEvent *)event; --(nullable CPTNumberArray)plotPointForEvent:(nonnull CPTNativeEvent *)event; +-(nullable CPTNumberArray *)plotPointForEvent:(nonnull CPTNativeEvent *)event; -(void)plotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(nonnull CPTNativeEvent *)event; -(void)doublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(nonnull CPTNativeEvent *)event; /// @} @@ -234,8 +244,10 @@ typedef NSMutableArray<__kindof CPTPlotSpace *> *CPTMutablePlotSpaceArray; /// @name Adjusting Ranges /// @{ --(void)scaleToFitPlots:(nullable CPTPlotArray)plots; --(void)scaleToFitPlots:(nullable CPTPlotArray)plots forCoordinate:(CPTCoordinate)coordinate; +-(void)scaleToFitPlots:(nullable CPTPlotArray *)plots; +-(void)scaleToFitPlots:(nullable CPTPlotArray *)plots forCoordinate:(CPTCoordinate)coordinate; +-(void)scaleToFitEntirePlots:(nullable CPTPlotArray *)plots; +-(void)scaleToFitEntirePlots:(nullable CPTPlotArray *)plots forCoordinate:(CPTCoordinate)coordinate; -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint; /// @} diff --git a/framework/Source/CPTPlotSpace.m b/framework/Source/CPTPlotSpace.m index 5099be368..644b1df79 100644 --- a/framework/Source/CPTPlotSpace.m +++ b/framework/Source/CPTPlotSpace.m @@ -1,25 +1,26 @@ #import "CPTPlotSpace.h" +#import "CPTGraph.h" #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 -typedef NSMutableOrderedSet *CPTMutableCategorySet; +typedef NSMutableOrderedSet CPTMutableCategorySet; @interface CPTPlotSpace() -@property (nonatomic, readwrite, strong) NSMutableDictionary *categoryNames; +@property (nonatomic, readwrite, strong, nullable) NSMutableDictionary *categoryNames; @property (nonatomic, readwrite) BOOL isDragging; --(CPTMutableCategorySet)orderedSetForCoordinate:(CPTCoordinate)coordinate; +-(nonnull CPTMutableCategorySet *)orderedSetForCoordinate:(CPTCoordinate)coordinate; @end @@ -35,7 +36,7 @@ -(CPTMutableCategorySet)orderedSetForCoordinate:(CPTCoordinate)coordinate; **/ @implementation CPTPlotSpace -/** @property id identifier +/** @property nullable id identifier * @brief An object used to identify the plot in collections. **/ @synthesize identifier; @@ -50,12 +51,12 @@ @implementation CPTPlotSpace **/ @synthesize isDragging; -/** @property cpt_weak CPTGraph *graph +/** @property nullable CPTGraph *graph * @brief The graph of the space. **/ @synthesize graph; -/** @property cpt_weak id delegate +/** @property nullable id delegate * @brief The plot space delegate. **/ @synthesize delegate; @@ -66,7 +67,7 @@ @implementation CPTPlotSpace @dynamic numberOfCoordinates; /** @internal - * @property NSMutableDictionary *categoryNames + * @property nullable NSMutableDictionary *categoryNames * @brief The names of the data categories for each coordinate with a #CPTScaleTypeCategory scale type. * The keys are the CPTCoordinate enumeration values and the values are arrays of strings. **/ @@ -89,9 +90,9 @@ @implementation CPTPlotSpace * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { identifier = nil; allowsUserInteraction = NO; isDragging = NO; @@ -119,7 +120,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeConditionalObject:self.graph forKey:@"CPTPlotSpace.graph"]; [coder encodeObject:self.identifier forKey:@"CPTPlotSpace.identifier"]; @@ -140,31 +141,49 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder -{ - if ( (self = [super init]) ) { - graph = [coder decodeObjectForKey:@"CPTPlotSpace.graph"]; - identifier = [[coder decodeObjectForKey:@"CPTPlotSpace.identifier"] copy]; - delegate = [coder decodeObjectForKey:@"CPTPlotSpace.delegate"]; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder +{ + if ((self = [super init])) { + graph = [coder decodeObjectOfClass:[CPTGraph class] + forKey:@"CPTPlotSpace.graph"]; + identifier = [[coder decodeObjectOfClass:[NSObject class] + forKey:@"CPTPlotSpace.identifier"] copy]; + delegate = [coder decodeObjectOfClass:[NSObject class] + forKey:@"CPTPlotSpace.delegate"]; allowsUserInteraction = [coder decodeBoolForKey:@"CPTPlotSpace.allowsUserInteraction"]; - categoryNames = [[coder decodeObjectForKey:@"CPTPlotSpace.categoryNames"] mutableCopy]; + categoryNames = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSDictionary class], [NSString class], [NSNumber class]]] + forKey:@"CPTPlotSpace.categoryNames"] mutableCopy]; isDragging = NO; } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Categorical Data +/// @cond + /** @internal * @brief Gets the ordered set of categories for the given coordinate, creating it if necessary. * @param coordinate The axis coordinate. * @return The ordered set of categories for the given coordinate. */ --(CPTMutableCategorySet)orderedSetForCoordinate:(CPTCoordinate)coordinate +-(nonnull CPTMutableCategorySet *)orderedSetForCoordinate:(CPTCoordinate)coordinate { - NSMutableDictionary *names = self.categoryNames; + NSMutableDictionary *names = self.categoryNames; if ( !names ) { names = [[NSMutableDictionary alloc] init]; @@ -174,7 +193,7 @@ -(CPTMutableCategorySet)orderedSetForCoordinate:(CPTCoordinate)coordinate NSNumber *cacheKey = @(coordinate); - CPTMutableCategorySet categories = names[cacheKey]; + CPTMutableCategorySet *categories = names[cacheKey]; if ( !categories ) { categories = [[NSMutableOrderedSet alloc] init]; @@ -185,6 +204,8 @@ -(CPTMutableCategorySet)orderedSetForCoordinate:(CPTCoordinate)coordinate return categories; } +/// @endcond + /** * @brief Add a new category name for the given coordinate. * @@ -193,11 +214,11 @@ -(CPTMutableCategorySet)orderedSetForCoordinate:(CPTCoordinate)coordinate * @param category The category name. * @param coordinate The axis coordinate. */ --(void)addCategory:(NSString *)category forCoordinate:(CPTCoordinate)coordinate +-(void)addCategory:(nonnull NSString *)category forCoordinate:(CPTCoordinate)coordinate { NSParameterAssert(category); - CPTMutableCategorySet categories = [self orderedSetForCoordinate:coordinate]; + CPTMutableCategorySet *categories = [self orderedSetForCoordinate:coordinate]; [categories addObject:category]; } @@ -207,11 +228,11 @@ -(void)addCategory:(NSString *)category forCoordinate:(CPTCoordinate)coordinate * @param category The category name. * @param coordinate The axis coordinate. */ --(void)removeCategory:(NSString *)category forCoordinate:(CPTCoordinate)coordinate +-(void)removeCategory:(nonnull NSString *)category forCoordinate:(CPTCoordinate)coordinate { NSParameterAssert(category); - CPTMutableCategorySet categories = [self orderedSetForCoordinate:coordinate]; + CPTMutableCategorySet *categories = [self orderedSetForCoordinate:coordinate]; [categories removeObject:category]; } @@ -225,11 +246,11 @@ -(void)removeCategory:(NSString *)category forCoordinate:(CPTCoordinate)coordina * @param coordinate The axis coordinate. * @param idx The index in the list of category names. */ --(void)insertCategory:(NSString *)category forCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx +-(void)insertCategory:(nonnull NSString *)category forCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx { NSParameterAssert(category); - CPTMutableCategorySet categories = [self orderedSetForCoordinate:coordinate]; + CPTMutableCategorySet *categories = [self orderedSetForCoordinate:coordinate]; NSParameterAssert(idx <= categories.count); @@ -241,9 +262,9 @@ -(void)insertCategory:(NSString *)category forCoordinate:(CPTCoordinate)coordina * @param newCategories An array of category names. * @param coordinate The axis coordinate. */ --(void)setCategories:(CPTStringArray)newCategories forCoordinate:(CPTCoordinate)coordinate +-(void)setCategories:(nullable CPTStringArray *)newCategories forCoordinate:(CPTCoordinate)coordinate { - NSMutableDictionary *names = self.categoryNames; + NSMutableDictionary *names = self.categoryNames; if ( !names ) { names = [[NSMutableDictionary alloc] init]; @@ -254,7 +275,9 @@ -(void)setCategories:(CPTStringArray)newCategories forCoordinate:(CPTCoordinate) NSNumber *cacheKey = @(coordinate); if ( [newCategories isKindOfClass:[NSArray class]] ) { - names[cacheKey] = [NSMutableOrderedSet orderedSetWithArray:newCategories]; + CPTStringArray *categories = newCategories; + + names[cacheKey] = [NSMutableOrderedSet orderedSetWithArray:categories]; } else { [names removeObjectForKey:cacheKey]; @@ -274,11 +297,11 @@ -(void)removeAllCategories * @param coordinate The axis coordinate. * @return An array of category names. */ --(CPTStringArray)categoriesForCoordinate:(CPTCoordinate)coordinate +-(nonnull CPTStringArray *)categoriesForCoordinate:(CPTCoordinate)coordinate { - CPTMutableCategorySet categories = [self orderedSetForCoordinate:coordinate]; + CPTMutableCategorySet *categories = [self orderedSetForCoordinate:coordinate]; - return [categories array]; + return categories.array; } /** @@ -287,9 +310,9 @@ -(CPTStringArray)categoriesForCoordinate:(CPTCoordinate)coordinate * @param idx The index in the list of category names. * @return The category name. */ --(NSString *)categoryForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx +-(nullable NSString *)categoryForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger)idx { - CPTMutableCategorySet categories = [self orderedSetForCoordinate:coordinate]; + CPTMutableCategorySet *categories = [self orderedSetForCoordinate:coordinate]; NSParameterAssert(idx < categories.count); @@ -302,11 +325,11 @@ -(NSString *)categoryForCoordinate:(CPTCoordinate)coordinate atIndex:(NSUInteger * @param coordinate The axis coordinate. * @return The category index. */ --(NSUInteger)indexOfCategory:(NSString *)category forCoordinate:(CPTCoordinate)coordinate +-(NSUInteger)indexOfCategory:(nonnull NSString *)category forCoordinate:(CPTCoordinate)coordinate { NSParameterAssert(category); - CPTMutableCategorySet categories = [self orderedSetForCoordinate:coordinate]; + CPTMutableCategorySet *categories = [self orderedSetForCoordinate:coordinate]; return [categories indexOfObject:category]; } @@ -333,7 +356,7 @@ -(NSUInteger)indexOfCategory:(NSString *)category forCoordinate:(CPTCoordinate)c * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { BOOL handledByDelegate = NO; @@ -361,7 +384,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { BOOL handledByDelegate = NO; @@ -389,7 +412,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { BOOL handledByDelegate = NO; @@ -417,7 +440,7 @@ -(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)inter * @param event The OS event. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event +-(BOOL)pointingDeviceCancelledEvent:(nonnull CPTNativeEvent *)event { BOOL handledByDelegate = NO; @@ -429,7 +452,7 @@ -(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event return handledByDelegate; } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else /** @@ -447,7 +470,7 @@ -(BOOL)pointingDeviceCancelledEvent:(CPTNativeEvent *)event * @param toPoint The ending coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)scrollWheelEvent:(CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint +-(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint { BOOL handledByDelegate = NO; @@ -458,6 +481,7 @@ -(BOOL)scrollWheelEvent:(CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toP } return handledByDelegate; } + #endif /// @} @@ -481,7 +505,7 @@ -(NSUInteger)numberOfCoordinates * @param plotPoint An array of data point coordinates (as NSNumber values). * @return The drawing coordinates of the data point. **/ --(CGPoint)plotAreaViewPointForPlotPoint:(CPTNumberArray)plotPoint +-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *cpt_unused)plotPoint { NSParameterAssert(plotPoint.count == self.numberOfCoordinates); @@ -493,7 +517,7 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(CPTNumberArray)plotPoint * @param count The number of coordinate values in the @par{plotPoint} array. * @return The drawing coordinates of the data point. **/ --(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count +-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count { NSParameterAssert(count == self.numberOfCoordinates); @@ -505,7 +529,7 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint numberOfCoordinat * @param count The number of coordinate values in the @par{plotPoint} array. * @return The drawing coordinates of the data point. **/ --(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count +-(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count { NSParameterAssert(count == self.numberOfCoordinates); @@ -516,7 +540,7 @@ -(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint numbe * @param point The drawing coordinates of the data point. * @return An array of data point coordinates (as NSNumber values). **/ --(CPTNumberArray)plotPointForPlotAreaViewPoint:(CGPoint)point +-(nullable CPTNumberArray *)plotPointForPlotAreaViewPoint:(CGPoint __unused)point { return nil; } @@ -526,7 +550,7 @@ -(CPTNumberArray)plotPointForPlotAreaViewPoint:(CGPoint)point * @param count The number of coordinate values in the @par{plotPoint} array. * @param point The drawing coordinates of the data point. **/ --(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point +-(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forPlotAreaViewPoint:(CGPoint __unused)point { NSParameterAssert(count == self.numberOfCoordinates); } @@ -536,7 +560,7 @@ -(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count fo * @param count The number of coordinate values in the @par{plotPoint} array. * @param point The drawing coordinates of the data point. **/ --(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point +-(void)doublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forPlotAreaViewPoint:(CGPoint __unused)point { NSParameterAssert(count == self.numberOfCoordinates); } @@ -545,7 +569,7 @@ -(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInte * @param event The event. * @return The drawing coordinates of the point. **/ --(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event +-(CGPoint)plotAreaViewPointForEvent:(nonnull CPTNativeEvent *__unused)event { return CGPointZero; } @@ -554,7 +578,7 @@ -(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event * @param event The event. * @return An array of data point coordinates (as NSNumber values). **/ --(CPTNumberArray)plotPointForEvent:(CPTNativeEvent *)event +-(nullable CPTNumberArray *)plotPointForEvent:(nonnull CPTNativeEvent *__unused)event { return nil; } @@ -564,7 +588,7 @@ -(CPTNumberArray)plotPointForEvent:(CPTNativeEvent *)event * @param count The number of coordinate values in the @par{plotPoint} array. * @param event The event. **/ --(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(CPTNativeEvent *)event +-(void)plotPoint:(nonnull NSDecimal *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forEvent:(nonnull CPTNativeEvent *__unused)event { NSParameterAssert(count == self.numberOfCoordinates); } @@ -574,7 +598,7 @@ -(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count fo * @param count The number of coordinate values in the @par{plotPoint} array. * @param event The event. **/ --(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(CPTNativeEvent *)event +-(void)doublePrecisionPlotPoint:(nonnull double *__unused)plotPoint numberOfCoordinates:(NSUInteger cpt_unused)count forEvent:(nonnull CPTNativeEvent *__unused)event { NSParameterAssert(count == self.numberOfCoordinates); } @@ -583,7 +607,7 @@ -(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInte * @param newRange The new plot range. * @param coordinate The axis coordinate. **/ --(void)setPlotRange:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(void)setPlotRange:(nonnull CPTPlotRange *__unused)newRange forCoordinate:(CPTCoordinate __unused)coordinate { } @@ -591,7 +615,7 @@ -(void)setPlotRange:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordi * @param coordinate The axis coordinate. * @return The range of values. **/ --(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate +-(nullable CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate __unused)coordinate { return nil; } @@ -600,7 +624,7 @@ -(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate * @param newType The new scale type. * @param coordinate The axis coordinate. **/ --(void)setScaleType:(CPTScaleType)newType forCoordinate:(CPTCoordinate)coordinate +-(void)setScaleType:(CPTScaleType __unused)newType forCoordinate:(CPTCoordinate __unused)coordinate { } @@ -608,7 +632,7 @@ -(void)setScaleType:(CPTScaleType)newType forCoordinate:(CPTCoordinate)coordinat * @param coordinate The axis coordinate. * @return The scale type. **/ --(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate)coordinate +-(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate __unused)coordinate { return CPTScaleTypeLinear; } @@ -616,7 +640,43 @@ -(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate)coordinate /** @brief Scales the plot ranges so that the plots just fit in the visible space. * @param plots An array of the plots that have to fit in the visible area. **/ --(void)scaleToFitPlots:(CPTPlotArray)plots +-(void)scaleToFitPlots:(nullable CPTPlotArray *__unused)plots +{ +} + +/** @brief Scales the plot range for the given coordinate so that the plots just fit in the visible space. + * @param plots An array of the plots that have to fit in the visible area. + * @param coordinate The axis coordinate. + **/ +-(void)scaleToFitPlots:(nullable CPTPlotArray *)plots forCoordinate:(CPTCoordinate)coordinate +{ + if ( plots.count == 0 ) { + return; + } + + // Determine union of ranges + CPTMutablePlotRange *unionRange = nil; + for ( CPTPlot *plot in plots ) { + CPTPlotRange *currentRange = [plot plotRangeForCoordinate:coordinate]; + if ( !unionRange ) { + unionRange = [currentRange mutableCopy]; + } + [unionRange unionPlotRange:currentRange]; + } + + // Set range + if ( unionRange ) { + if ( CPTDecimalEquals(unionRange.lengthDecimal, CPTDecimalFromInteger(0))) { + [unionRange unionPlotRange:[self plotRangeForCoordinate:coordinate]]; + } + [self setPlotRange:unionRange forCoordinate:coordinate]; + } +} + +/** @brief Scales the plot ranges so that the plots just fit in the visible space. + * @param plots An array of the plots that have to fit in the visible area. + **/ +-(void)scaleToFitEntirePlots:(nullable CPTPlotArray *__unused)plots { } @@ -624,7 +684,7 @@ -(void)scaleToFitPlots:(CPTPlotArray)plots * @param plots An array of the plots that have to fit in the visible area. * @param coordinate The axis coordinate. **/ --(void)scaleToFitPlots:(CPTPlotArray)plots forCoordinate:(CPTCoordinate)coordinate +-(void)scaleToFitEntirePlots:(nullable CPTPlotArray *)plots forCoordinate:(CPTCoordinate)coordinate { if ( plots.count == 0 ) { return; @@ -642,7 +702,7 @@ -(void)scaleToFitPlots:(CPTPlotArray)plots forCoordinate:(CPTCoordinate)coordina // Set range if ( unionRange ) { - if ( CPTDecimalEquals( unionRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalEquals(unionRange.lengthDecimal, CPTDecimalFromInteger(0))) { [unionRange unionPlotRange:[self plotRangeForCoordinate:coordinate]]; } [self setPlotRange:unionRange forCoordinate:coordinate]; @@ -653,7 +713,7 @@ -(void)scaleToFitPlots:(CPTPlotArray)plots forCoordinate:(CPTCoordinate)coordina * @param interactionScale The scaling factor. One (@num{1}) gives no scaling. * @param interactionPoint The plot area view point about which the scaling occurs. **/ --(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint +-(void)scaleBy:(CGFloat __unused)interactionScale aboutPoint:(CGPoint __unused)interactionPoint { } @@ -662,11 +722,11 @@ -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)interactionPoint /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { return [NSString stringWithFormat:@"Identifier: %@\nallowsUserInteraction: %@", self.identifier, - self.allowsUserInteraction ? @"YES":@"NO"]; + self.allowsUserInteraction ? @"YES" : @"NO"]; } /// @endcond diff --git a/framework/Source/CPTPlotSpaceAnnotation.h b/framework/Source/CPTPlotSpaceAnnotation.h index a0fb80bec..e81554e07 100644 --- a/framework/Source/CPTPlotSpaceAnnotation.h +++ b/framework/Source/CPTPlotSpaceAnnotation.h @@ -4,10 +4,13 @@ @interface CPTPlotSpaceAnnotation : CPTAnnotation -@property (nonatomic, readwrite, copy, nullable) CPTNumberArray anchorPlotPoint; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *anchorPlotPoint; @property (nonatomic, readonly, nonnull) CPTPlotSpace *plotSpace; --(nonnull instancetype)initWithPlotSpace:(nonnull CPTPlotSpace *)space anchorPlotPoint:(nullable CPTNumberArray)plotPoint NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +/// @name Initialization +/// @{ +-(nonnull instancetype)initWithPlotSpace:(nonnull CPTPlotSpace *)space anchorPlotPoint:(nullable CPTNumberArray *)plotPoint NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +/// @} @end diff --git a/framework/Source/CPTPlotSpaceAnnotation.m b/framework/Source/CPTPlotSpaceAnnotation.m index 102058d7d..db08c4303 100644 --- a/framework/Source/CPTPlotSpaceAnnotation.m +++ b/framework/Source/CPTPlotSpaceAnnotation.m @@ -28,12 +28,12 @@ -(void)setContentNeedsLayout; **/ @implementation CPTPlotSpaceAnnotation -/** @property CPTNumberArray anchorPlotPoint +/** @property nullable CPTNumberArray *anchorPlotPoint * @brief An array of NSDecimalNumber objects giving the anchor plot coordinates. **/ @synthesize anchorPlotPoint; -/** @property CPTPlotSpace *plotSpace +/** @property nonnull CPTPlotSpace *plotSpace * @brief The plot space which the anchor is defined in. **/ @synthesize plotSpace; @@ -56,11 +56,11 @@ @implementation CPTPlotSpaceAnnotation * @param newPlotPoint An array of NSDecimalNumber objects giving the anchor plot coordinates. * @return The initialized CPTPlotSpaceAnnotation object. **/ --(instancetype)initWithPlotSpace:(CPTPlotSpace *)newPlotSpace anchorPlotPoint:(CPTNumberArray)newPlotPoint +-(nonnull instancetype)initWithPlotSpace:(nonnull CPTPlotSpace *)newPlotSpace anchorPlotPoint:(nullable CPTNumberArray *)newPlotPoint { NSParameterAssert(newPlotSpace); - if ( (self = [super init]) ) { + if ((self = [super init])) { plotSpace = newPlotSpace; self.anchorPlotPoint = newPlotPoint; @@ -77,7 +77,7 @@ -(instancetype)initWithPlotSpace:(CPTPlotSpace *)newPlotSpace anchorPlotPoint:(C /// @cond // plotSpace is required --(instancetype)init +-(nonnull instancetype)init { [NSException raise:CPTException format:@"%@ must be initialized with a plot space.", NSStringFromClass([self class])]; return [self initWithPlotSpace:[[CPTPlotSpace alloc] init] anchorPlotPoint:nil]; @@ -96,7 +96,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -110,19 +110,38 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - anchorPlotPoint = [[coder decodeObjectForKey:@"CPTPlotSpaceAnnotation.anchorPlotPoint"] copy]; + if ((self = [super initWithCoder:coder])) { + self.anchorPlotPoint = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [NSNumber class]]] + forKey:@"CPTPlotSpaceAnnotation.anchorPlotPoint"] copy]; - CPTPlotSpace *thePlotSpace = [coder decodeObjectForKey:@"CPTPlotSpaceAnnotation.plotSpace"]; + CPTPlotSpace *thePlotSpace = [coder decodeObjectOfClass:[CPTPlotSpace class] + forKey:@"CPTPlotSpaceAnnotation.plotSpace"]; if ( thePlotSpace ) { plotSpace = thePlotSpace; + + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(setContentNeedsLayout) + name:CPTPlotSpaceCoordinateMappingDidChangeNotification + object:plotSpace]; } } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Layout @@ -140,7 +159,7 @@ -(void)positionContentLayer if ( content ) { CPTLayer *hostLayer = self.annotationHostLayer; if ( hostLayer ) { - CPTNumberArray plotAnchor = self.anchorPlotPoint; + CPTNumberArray *plotAnchor = self.anchorPlotPoint; if ( plotAnchor ) { // Get plot area point CPTPlotSpace *thePlotSpace = self.plotSpace; @@ -161,7 +180,7 @@ -(void)positionContentLayer content.anchorPoint = self.contentAnchorPoint; content.position = newPosition; - content.transform = CATransform3DMakeRotation( self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) ); + content.transform = CATransform3DMakeRotation(self.rotation, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0)); [content pixelAlign]; } } @@ -175,16 +194,16 @@ -(void)positionContentLayer /// @cond --(void)setAnchorPlotPoint:(CPTNumberArray)newPlotPoint +-(void)setAnchorPlotPoint:(nullable CPTNumberArray *)newPlotPoint { if ( anchorPlotPoint != newPlotPoint ) { anchorPlotPoint = [newPlotPoint copy]; self.anchorCount = anchorPlotPoint.count; - NSDecimal *decimalPoint = malloc(sizeof(NSDecimal) * self.anchorCount); + NSDecimal *decimalPoint = calloc(self.anchorCount, sizeof(NSDecimal)); for ( NSUInteger i = 0; i < self.anchorCount; i++ ) { - decimalPoint[i] = [anchorPlotPoint[i] decimalValue]; + decimalPoint[i] = anchorPlotPoint[i].decimalValue; } self.decimalAnchor = decimalPoint; @@ -192,7 +211,7 @@ -(void)setAnchorPlotPoint:(CPTNumberArray)newPlotPoint } } --(void)setDecimalAnchor:(NSDecimal *)newAnchor +-(void)setDecimalAnchor:(nonnull NSDecimal *)newAnchor { if ( decimalAnchor != newAnchor ) { free(decimalAnchor); diff --git a/framework/Source/CPTPlotSpaceTests.h b/framework/Source/CPTPlotSpaceTests.h index ccd2a1f49..fd5b2cf96 100644 --- a/framework/Source/CPTPlotSpaceTests.h +++ b/framework/Source/CPTPlotSpaceTests.h @@ -4,6 +4,6 @@ @interface CPTPlotSpaceTests : CPTTestCase -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nullable) CPTXYGraph *graph; @end diff --git a/framework/Source/CPTPlotSpaceTests.m b/framework/Source/CPTPlotSpaceTests.m index e10faf39f..226617ec5 100644 --- a/framework/Source/CPTPlotSpaceTests.m +++ b/framework/Source/CPTPlotSpaceTests.m @@ -32,7 +32,7 @@ -(void)testKeyedArchivingRoundTrip plotSpace.identifier = @"test plot space"; - CPTPlotSpace *newPlotSpace = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:plotSpace]]; + CPTPlotSpace *newPlotSpace = [self archiveRoundTrip:plotSpace]; XCTAssertEqualObjects(plotSpace.identifier, newPlotSpace.identifier, @"identifier not equal"); XCTAssertEqual(plotSpace.allowsUserInteraction, newPlotSpace.allowsUserInteraction, @"allowsUserInteraction not equal"); diff --git a/framework/Source/CPTPlotSymbol.h b/framework/Source/CPTPlotSymbol.h index a78902ba8..36ca6d399 100644 --- a/framework/Source/CPTPlotSymbol.h +++ b/framework/Source/CPTPlotSymbol.h @@ -27,14 +27,14 @@ typedef NS_ENUM (NSInteger, CPTPlotSymbolType) { /** * @brief An array of plot symbols. **/ -typedef NSArray *CPTPlotSymbolArray; +typedef NSArray CPTPlotSymbolArray; /** * @brief A mutable array of plot symbols. **/ -typedef NSMutableArray *CPTMutablePlotSymbolArray; +typedef NSMutableArray CPTMutablePlotSymbolArray; -@interface CPTPlotSymbol : NSObject +@interface CPTPlotSymbol : NSObject @property (nonatomic, readwrite, assign) CGPoint anchorPoint; @property (nonatomic, readwrite, assign) CGSize size; diff --git a/framework/Source/CPTPlotSymbol.m b/framework/Source/CPTPlotSymbol.m index f818f1d88..9bae6be66 100644 --- a/framework/Source/CPTPlotSymbol.m +++ b/framework/Source/CPTPlotSymbol.m @@ -11,11 +11,11 @@ /// @cond @interface CPTPlotSymbol() -@property (nonatomic, readwrite, assign) CGPathRef cachedSymbolPath; -@property (nonatomic, readwrite, assign) CGLayerRef cachedLayer; +@property (nonatomic, readwrite, assign, nullable) CGPathRef cachedSymbolPath; +@property (nonatomic, readwrite, assign, nullable) CGLayerRef cachedLayer; @property (nonatomic, readwrite, assign) CGFloat cachedScale; --(CGPathRef)newSymbolPath; +-(nonnull CGPathRef)newSymbolPath; -(CGSize)layerSizeForScale:(CGFloat)scale; @end @@ -43,24 +43,24 @@ @implementation CPTPlotSymbol **/ @synthesize symbolType; -/** @property CPTLineStyle *lineStyle +/** @property nullable CPTLineStyle *lineStyle * @brief The line style for the border of the symbol. * If @nil, the border is not drawn. **/ @synthesize lineStyle; -/** @property CPTFill *fill +/** @property nullable CPTFill *fill * @brief The fill for the interior of the symbol. * If @nil, the symbol is not filled. **/ @synthesize fill; -/** @property CPTShadow *shadow +/** @property nullable CPTShadow *shadow * @brief The shadow applied to each plot symbol. **/ @synthesize shadow; -/** @property CGPathRef customSymbolPath +/** @property nullable CGPathRef customSymbolPath * @brief The drawing path for a custom plot symbol. It will be scaled to @ref size before being drawn. **/ @synthesize customSymbolPath; @@ -96,9 +96,9 @@ @implementation CPTPlotSymbol * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { anchorPoint = CPTPointMake(0.5, 0.5); size = CPTSizeMake(5.0, 5.0); symbolType = CPTPlotSymbolTypeNone; @@ -132,7 +132,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeCPTPoint:self.anchorPoint forKey:@"CPTPlotSymbol.anchorPoint"]; [coder encodeCPTSize:self.size forKey:@"CPTPlotSymbol.size"]; @@ -149,15 +149,18 @@ -(void)encodeWithCoder:(NSCoder *)coder // cachedScale } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - anchorPoint = [coder decodeCPTPointForKey:@"CPTPlotSymbol.anchorPoint"]; - size = [coder decodeCPTSizeForKey:@"CPTPlotSymbol.size"]; - symbolType = (CPTPlotSymbolType)[coder decodeIntegerForKey : @"CPTPlotSymbol.symbolType"]; - lineStyle = [coder decodeObjectForKey:@"CPTPlotSymbol.lineStyle"]; - fill = [coder decodeObjectForKey:@"CPTPlotSymbol.fill"]; - shadow = [[coder decodeObjectForKey:@"CPTPlotSymbol.shadow"] copy]; + if ((self = [super init])) { + anchorPoint = [coder decodeCPTPointForKey:@"CPTPlotSymbol.anchorPoint"]; + size = [coder decodeCPTSizeForKey:@"CPTPlotSymbol.size"]; + symbolType = (CPTPlotSymbolType)[coder decodeIntegerForKey:@"CPTPlotSymbol.symbolType"]; + lineStyle = [coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTPlotSymbol.lineStyle"]; + fill = [coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTPlotSymbol.fill"]; + shadow = [[coder decodeObjectOfClass:[CPTShadow class] + forKey:@"CPTPlotSymbol.shadow"] copy]; customSymbolPath = [coder newCGPathDecodeForKey:@"CPTPlotSymbol.customSymbolPath"]; usesEvenOddClipRule = [coder decodeBoolForKey:@"CPTPlotSymbol.usesEvenOddClipRule"]; @@ -170,6 +173,18 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Accessors @@ -177,7 +192,7 @@ -(instancetype)initWithCoder:(NSCoder *)coder -(void)setSize:(CGSize)newSize { - if ( !CGSizeEqualToSize(newSize, size) ) { + if ( !CGSizeEqualToSize(newSize, size)) { size = newSize; self.cachedSymbolPath = NULL; } @@ -191,7 +206,7 @@ -(void)setSymbolType:(CPTPlotSymbolType)newType } } --(void)setShadow:(CPTShadow *)newShadow +-(void)setShadow:(nullable CPTShadow *)newShadow { if ( newShadow != shadow ) { shadow = [newShadow copy]; @@ -199,7 +214,7 @@ -(void)setShadow:(CPTShadow *)newShadow } } --(void)setCustomSymbolPath:(CGPathRef)newPath +-(void)setCustomSymbolPath:(nullable CGPathRef)newPath { if ( customSymbolPath != newPath ) { CGPathRelease(customSymbolPath); @@ -208,7 +223,7 @@ -(void)setCustomSymbolPath:(CGPathRef)newPath } } --(void)setLineStyle:(CPTLineStyle *)newLineStyle +-(void)setLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( newLineStyle != lineStyle ) { lineStyle = newLineStyle; @@ -216,7 +231,7 @@ -(void)setLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setFill:(CPTFill *)newFill +-(void)setFill:(nullable CPTFill *)newFill { if ( newFill != fill ) { fill = newFill; @@ -232,7 +247,7 @@ -(void)setUsesEvenOddClipRule:(BOOL)newEvenOddClipRule } } --(CGPathRef)cachedSymbolPath +-(nullable CGPathRef)cachedSymbolPath { if ( !cachedSymbolPath ) { cachedSymbolPath = [self newSymbolPath]; @@ -240,7 +255,7 @@ -(CGPathRef)cachedSymbolPath return cachedSymbolPath; } --(void)setCachedSymbolPath:(CGPathRef)newPath +-(void)setCachedSymbolPath:(nullable CGPathRef)newPath { if ( cachedSymbolPath != newPath ) { CGPathRelease(cachedSymbolPath); @@ -249,7 +264,7 @@ -(void)setCachedSymbolPath:(CGPathRef)newPath } } --(void)setCachedLayer:(CGLayerRef)newLayer +-(void)setCachedLayer:(nullable CGLayerRef)newLayer { if ( cachedLayer != newLayer ) { CGLayerRelease(cachedLayer); @@ -265,7 +280,7 @@ -(void)setCachedLayer:(CGLayerRef)newLayer /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeNone. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeNone. **/ -+(instancetype)plotSymbol ++(nonnull instancetype)plotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -277,7 +292,7 @@ +(instancetype)plotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeCross. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeCross. **/ -+(instancetype)crossPlotSymbol ++(nonnull instancetype)crossPlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -289,7 +304,7 @@ +(instancetype)crossPlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeEllipse. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeEllipse. **/ -+(instancetype)ellipsePlotSymbol ++(nonnull instancetype)ellipsePlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -301,7 +316,7 @@ +(instancetype)ellipsePlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeRectangle. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeRectangle. **/ -+(instancetype)rectanglePlotSymbol ++(nonnull instancetype)rectanglePlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -313,7 +328,7 @@ +(instancetype)rectanglePlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypePlus. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypePlus. **/ -+(instancetype)plusPlotSymbol ++(nonnull instancetype)plusPlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -325,7 +340,7 @@ +(instancetype)plusPlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeStar. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeStar. **/ -+(instancetype)starPlotSymbol ++(nonnull instancetype)starPlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -337,7 +352,7 @@ +(instancetype)starPlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeDiamond. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeDiamond. **/ -+(instancetype)diamondPlotSymbol ++(nonnull instancetype)diamondPlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -349,7 +364,7 @@ +(instancetype)diamondPlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeTriangle. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeTriangle. **/ -+(instancetype)trianglePlotSymbol ++(nonnull instancetype)trianglePlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -361,7 +376,7 @@ +(instancetype)trianglePlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypePentagon. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypePentagon. **/ -+(instancetype)pentagonPlotSymbol ++(nonnull instancetype)pentagonPlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -373,7 +388,7 @@ +(instancetype)pentagonPlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeHexagon. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeHexagon. **/ -+(instancetype)hexagonPlotSymbol ++(nonnull instancetype)hexagonPlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -385,7 +400,7 @@ +(instancetype)hexagonPlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeDash. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeDash. **/ -+(instancetype)dashPlotSymbol ++(nonnull instancetype)dashPlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -397,7 +412,7 @@ +(instancetype)dashPlotSymbol /** @brief Creates and returns a new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeSnow. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeSnow. **/ -+(instancetype)snowPlotSymbol ++(nonnull instancetype)snowPlotSymbol { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -410,7 +425,7 @@ +(instancetype)snowPlotSymbol * @param aPath The bounding path for the custom symbol. * @return A new CPTPlotSymbol instance initialized with a symbol type of #CPTPlotSymbolTypeCustom. **/ -+(instancetype)customPlotSymbolWithPath:(CGPathRef)aPath ++(nonnull instancetype)customPlotSymbolWithPath:(nullable CGPathRef)aPath { CPTPlotSymbol *symbol = [[self alloc] init]; @@ -425,7 +440,7 @@ +(instancetype)customPlotSymbolWithPath:(CGPathRef)aPath /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTPlotSymbol *copy = [[[self class] allocWithZone:zone] init]; @@ -457,14 +472,14 @@ -(id)copyWithZone:(NSZone *)zone * @param scale The drawing scale factor. Must be greater than zero (@num{0}). * @param alignToPixels If @YES, the symbol position is aligned with device pixels to reduce anti-aliasing artifacts. **/ --(void)renderInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFloat)scale alignToPixels:(BOOL)alignToPixels +-(void)renderInContext:(nonnull CGContextRef)context atPoint:(CGPoint)center scale:(CGFloat)scale alignToPixels:(BOOL)alignToPixels { CGPoint symbolAnchor = self.anchorPoint; CGLayerRef theCachedLayer = self.cachedLayer; CGFloat theCachedScale = self.cachedScale; - if ( !theCachedLayer || (theCachedScale != scale) ) { + if ( !theCachedLayer || (theCachedScale != scale)) { CGSize layerSize = [self layerSizeForScale:scale]; self.anchorPoint = CPTPointMake(0.5, 0.5); @@ -473,7 +488,7 @@ -(void)renderInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFl CGContextRef layerContext = CGLayerGetContext(newLayer); [self renderAsVectorInContext:layerContext - atPoint:CPTPointMake( layerSize.width * CPTFloat(0.5), layerSize.height * CPTFloat(0.5) ) + atPoint:CPTPointMake(layerSize.width * CPTFloat(0.5), layerSize.height * CPTFloat(0.5)) scale:scale]; self.cachedLayer = newLayer; @@ -485,18 +500,18 @@ -(void)renderInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFl if ( theCachedLayer ) { CGSize layerSize = CGLayerGetSize(theCachedLayer); - if ( scale != 1.0 ) { + if ( scale != CPTFloat(1.0)) { layerSize.width /= scale; layerSize.height /= scale; } CGSize symbolSize = self.size; - CGPoint origin = CPTPointMake( center.x - layerSize.width * CPTFloat(0.5) - symbolSize.width * ( symbolAnchor.x - CPTFloat(0.5) ), - center.y - layerSize.height * CPTFloat(0.5) - symbolSize.height * ( symbolAnchor.y - CPTFloat(0.5) ) ); + CGPoint origin = CPTPointMake(center.x - layerSize.width * CPTFloat(0.5) - symbolSize.width * (symbolAnchor.x - CPTFloat(0.5)), + center.y - layerSize.height * CPTFloat(0.5) - symbolSize.height * (symbolAnchor.y - CPTFloat(0.5))); if ( alignToPixels ) { - if ( scale == 1.0 ) { + if ( scale == CPTFloat(1.0)) { origin.x = round(origin.x); origin.y = round(origin.y); } @@ -510,6 +525,8 @@ -(void)renderInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFl } } +/// @cond + -(CGSize)layerSizeForScale:(CGFloat)scale { const CGFloat symbolMargin = CPTFloat(2.0); @@ -537,12 +554,14 @@ -(CGSize)layerSizeForScale:(CGFloat)scale return layerSize; } +/// @endcond + /** @brief Draws the plot symbol into the given graphics context centered at the provided point. * @param context The graphics context to draw into. * @param center The center point of the symbol. * @param scale The drawing scale factor. Must be greater than zero (@num{0}). **/ --(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center scale:(CGFloat)scale +-(void)renderAsVectorInContext:(nonnull CGContextRef)context atPoint:(CGPoint)center scale:(CGFloat)scale { CGPathRef theSymbolPath = self.cachedSymbolPath; @@ -580,12 +599,12 @@ -(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center sca CPTShadow *myShadow = self.shadow; CGContextSaveGState(context); - CGContextTranslateCTM(context, center.x + ( symbolAnchor.x - CPTFloat(0.5) ) * symbolSize.width, center.y + ( symbolAnchor.y - CPTFloat(0.5) ) * symbolSize.height); + CGContextTranslateCTM(context, center.x + (symbolAnchor.x - CPTFloat(0.5)) * symbolSize.width, center.y + (symbolAnchor.y - CPTFloat(0.5)) * symbolSize.height); CGContextScaleCTM(context, scale, scale); [myShadow setShadowInContext:context]; // redraw only symbol rectangle - CGSize halfSize = CPTSizeMake( symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5) ); + CGSize halfSize = CPTSizeMake(symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5)); CGRect bounds = CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height); CGRect symbolRect = bounds; @@ -593,7 +612,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center sca if ( myShadow ) { CGFloat shadowRadius = myShadow.shadowBlurRadius; CGSize shadowOffset = myShadow.shadowOffset; - symbolRect = CGRectInset( symbolRect, -( ABS(shadowOffset.width) + ABS(shadowRadius) ), -( ABS(shadowOffset.height) + ABS(shadowRadius) ) ); + symbolRect = CGRectInset(symbolRect, -(ABS(shadowOffset.width) + ABS(shadowRadius)), -(ABS(shadowOffset.height) + ABS(shadowRadius))); } if ( theLineStyle ) { CGFloat lineWidth = ABS(theLineStyle.lineWidth); @@ -607,7 +626,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center sca if ( theFill ) { // use fillRect instead of fillPath so that images and gradients are properly centered in the symbol CGContextSaveGState(context); - if ( !CGPathIsEmpty(theSymbolPath) ) { + if ( !CGPathIsEmpty(theSymbolPath)) { CGContextBeginPath(context); CGContextAddPath(context, theSymbolPath); if ( self.usesEvenOddClipRule ) { @@ -643,11 +662,11 @@ -(void)renderAsVectorInContext:(CGContextRef)context atPoint:(CGPoint)center sca * @brief Creates and returns a drawing path for the current symbol type. * @return A path describing the outline of the current symbol type. **/ --(CGPathRef)newSymbolPath +-(nonnull CGPathRef)newSymbolPath { CGFloat dx, dy; CGSize symbolSize = self.size; - CGSize halfSize = CPTSizeMake( symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5) ); + CGSize halfSize = CPTSizeMake(symbolSize.width * CPTFloat(0.5), symbolSize.height * CPTFloat(0.5)); CGMutablePathRef symbolPath = CGPathCreateMutable(); @@ -657,11 +676,11 @@ -(CGPathRef)newSymbolPath break; case CPTPlotSymbolTypeRectangle: - CGPathAddRect( symbolPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height) ); + CGPathAddRect(symbolPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height)); break; case CPTPlotSymbolTypeEllipse: - CGPathAddEllipseInRect( symbolPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height) ); + CGPathAddEllipseInRect(symbolPath, NULL, CPTRectMake(-halfSize.width, -halfSize.height, symbolSize.width, symbolSize.height)); break; case CPTPlotSymbolTypeCross: @@ -674,38 +693,38 @@ -(CGPathRef)newSymbolPath case CPTPlotSymbolTypePlus: CGPathMoveToPoint(symbolPath, NULL, CPTFloat(0.0), halfSize.height); CGPathAddLineToPoint(symbolPath, NULL, CPTFloat(0.0), -halfSize.height); - CGPathMoveToPoint( symbolPath, NULL, -halfSize.width, CPTFloat(0.0) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width, CPTFloat(0.0) ); + CGPathMoveToPoint(symbolPath, NULL, -halfSize.width, CPTFloat(0.0)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width, CPTFloat(0.0)); break; case CPTPlotSymbolTypePentagon: CGPathMoveToPoint(symbolPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); CGPathCloseSubpath(symbolPath); break; case CPTPlotSymbolTypeStar: CGPathMoveToPoint(symbolPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.22451398829), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.36327126400), -halfSize.height * CPTFloat(0.11803398875) ); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, CPTFloat(0.0), -halfSize.height * CPTFloat(0.38196601125) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.36327126400), -halfSize.height * CPTFloat(0.11803398875) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width * CPTFloat(0.22451398829), halfSize.height * CPTFloat(0.30901699437) ); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.22451398829), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.36327126400), -halfSize.height * CPTFloat(0.11803398875)); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(symbolPath, NULL, CPTFloat(0.0), -halfSize.height * CPTFloat(0.38196601125)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.58778525229), -halfSize.height * CPTFloat(0.80901699437)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.36327126400), -halfSize.height * CPTFloat(0.11803398875)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.95105651630), halfSize.height * CPTFloat(0.30901699437)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width * CPTFloat(0.22451398829), halfSize.height * CPTFloat(0.30901699437)); CGPathCloseSubpath(symbolPath); break; case CPTPlotSymbolTypeDiamond: CGPathMoveToPoint(symbolPath, NULL, CPTFloat(0.0), halfSize.height); - CGPathAddLineToPoint( symbolPath, NULL, halfSize.width, CPTFloat(0.0) ); + CGPathAddLineToPoint(symbolPath, NULL, halfSize.width, CPTFloat(0.0)); CGPathAddLineToPoint(symbolPath, NULL, CPTFloat(0.0), -halfSize.height); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width, CPTFloat(0.0) ); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width, CPTFloat(0.0)); CGPathCloseSubpath(symbolPath); break; @@ -720,8 +739,8 @@ -(CGPathRef)newSymbolPath break; case CPTPlotSymbolTypeDash: - CGPathMoveToPoint( symbolPath, NULL, halfSize.width, CPTFloat(0.0) ); - CGPathAddLineToPoint( symbolPath, NULL, -halfSize.width, CPTFloat(0.0) ); + CGPathMoveToPoint(symbolPath, NULL, halfSize.width, CPTFloat(0.0)); + CGPathAddLineToPoint(symbolPath, NULL, -halfSize.width, CPTFloat(0.0)); break; case CPTPlotSymbolTypeHexagon: @@ -758,8 +777,8 @@ -(CGPathRef)newSymbolPath CGFloat dy1 = symbolSize.height / oldBounds.size.height; CGAffineTransform scaleTransform = CGAffineTransformScale(CGAffineTransformIdentity, dx1, dy1); - scaleTransform = CGAffineTransformConcat( scaleTransform, - CGAffineTransformMakeTranslation(-halfSize.width, -halfSize.height) ); + scaleTransform = CGAffineTransformConcat(scaleTransform, + CGAffineTransformMakeTranslation(-halfSize.width, -halfSize.height)); CGPathAddPath(symbolPath, &scaleTransform, customPath); } } @@ -776,7 +795,7 @@ -(CGPathRef)newSymbolPath /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { const CGFloat screenScale = 1.0; @@ -789,7 +808,7 @@ -(id)debugQuickLookObject self.anchorPoint = CPTPointMake(0.5, 0.5); - [self renderAsVectorInContext:context atPoint:CGPointMake( CGRectGetMidX(bounds), CGRectGetMidY(bounds) ) scale:scale]; + [self renderAsVectorInContext:context atPoint:CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)) scale:scale]; self.anchorPoint = symbolAnchor; }); diff --git a/framework/Source/CPTRangePlot.h b/framework/Source/CPTRangePlot.h index 09362a50b..5e3434e38 100644 --- a/framework/Source/CPTRangePlot.h +++ b/framework/Source/CPTRangePlot.h @@ -5,27 +5,41 @@ @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; +extern CPTRangePlotBinding __nonnull const CPTRangePlotBindingBarWidths; /// @} /** * @brief Enumeration of range plot data source field types **/ typedef NS_ENUM (NSInteger, CPTRangePlotField) { - CPTRangePlotFieldX, ///< X values. - CPTRangePlotFieldY, ///< Y values. - CPTRangePlotFieldHigh, ///< relative High values. - CPTRangePlotFieldLow, ///< relative Low values. - CPTRangePlotFieldLeft, ///< relative Left values. - CPTRangePlotFieldRight, ///< relative Right values. + CPTRangePlotFieldX, ///< X values. + CPTRangePlotFieldY, ///< Y values. + CPTRangePlotFieldHigh, ///< relative High values. + CPTRangePlotFieldLow, ///< relative Low values. + CPTRangePlotFieldLeft, ///< relative Left values. + CPTRangePlotFieldRight ///< relative Right values. +}; + +/** + * @brief Enumeration of range plot data fill directions + **/ +typedef NS_ENUM (NSInteger, CPTRangePlotFillDirection) { + CPTRangePlotFillHorizontal, ///< Fill between the high and low values in a horizontal direction. + CPTRangePlotFillVertical ///< Fill between the left and right values in a vertical direction. }; #pragma mark - @@ -44,7 +58,7 @@ typedef NS_ENUM (NSInteger, CPTRangePlotField) { * @param indexRange The range of the data indexes of interest. * @return An array of line styles. **/ --(nullable CPTLineStyleArray)barLineStylesForRangePlot:(nonnull CPTRangePlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTLineStyleArray *)barLineStylesForRangePlot:(nonnull CPTRangePlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets a bar line style for the given range plot. * This method will not be called if @@ -57,6 +71,23 @@ typedef NS_ENUM (NSInteger, CPTRangePlotField) { **/ -(nullable CPTLineStyle *)barLineStyleForRangePlot:(nonnull CPTRangePlot *)plot recordIndex:(NSUInteger)idx; +/** @brief @optional Gets an array of bar widths for the given range plot. + * @param plot The range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of bar widths. + **/ +-(nullable CPTNumberArray *)barWidthsForRangePlot:(nonnull CPTRangePlot *)barPlot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar width for the given range plot. + * This method will not be called if + * @link CPTRangePlotDataSource::barWidthForRangePlot:recordIndexRange: -barWidthForRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The range plot. + * @param idx The data index of interest. + * @return The bar width for the bar with the given index. If the data source returns @nil, the default barWidth is used. + **/ +-(nullable NSNumber *)barWidthForRangePlot:(nonnull CPTRangePlot *)plot recordIndex:(NSUInteger)idx; + /// @} @end @@ -154,6 +185,7 @@ typedef NS_ENUM (NSInteger, CPTRangePlotField) { /// @name Drawing /// @{ +@property (nonatomic, readwrite) CPTRangePlotFillDirection fillDirection; @property (nonatomic, copy, nullable) CPTFill *areaFill; @property (nonatomic, readwrite, copy, nullable) CPTLineStyle *areaBorderLineStyle; /// @} @@ -162,6 +194,8 @@ typedef NS_ENUM (NSInteger, CPTRangePlotField) { /// @{ -(void)reloadBarLineStyles; -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange; +-(void)reloadBarWidths; +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange; /// @} @end diff --git a/framework/Source/CPTRangePlot.m b/framework/Source/CPTRangePlot.m index f157ccd3c..b03c7e6e2 100644 --- a/framework/Source/CPTRangePlot.m +++ b/framework/Source/CPTRangePlot.m @@ -13,6 +13,8 @@ #import "CPTUtilities.h" #import "CPTXYPlotSpace.h" #import "NSCoderExtensions.h" +#import "NSNumberExtensions.h" +#import "tgmath.h" /** @defgroup plotAnimationRangePlot Range Plot * @brief Range plot properties that can be animated using Core Animation. @@ -26,13 +28,14 @@ * @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. +CPTRangePlotBinding const CPTRangePlotBindingBarWidths = @"barWidths"; ///< Bar widths. /// @cond struct CGPointError { @@ -47,22 +50,24 @@ @interface CPTRangePlot() -@property (nonatomic, readwrite, copy) CPTNumberArray xValues; -@property (nonatomic, readwrite, copy) CPTNumberArray yValues; -@property (nonatomic, readwrite, copy) CPTMutableNumericData *highValues; -@property (nonatomic, readwrite, copy) CPTMutableNumericData *lowValues; -@property (nonatomic, readwrite, copy) CPTMutableNumericData *leftValues; -@property (nonatomic, readwrite, copy) CPTMutableNumericData *rightValues; -@property (nonatomic, readwrite, copy) CPTLineStyleArray barLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *xValues; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *yValues; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *highValues; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *lowValues; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *leftValues; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *rightValues; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barWidths; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; --(void)calculatePointsToDraw:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount forPlotSpace:(CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly; --(void)calculateViewPoints:(CGPointError *)viewPoints withDrawPointFlags:(BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount; --(void)alignViewPointsToUserSpace:(CGPointError *)viewPoints withContent:(CGContextRef)context drawPointFlags:(BOOL *)drawPointFlag numberOfPoints:(NSUInteger)dataCounts; --(NSInteger)extremeDrawnPointIndexForFlags:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound; +-(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace; +-(void)calculateViewPoints:(nonnull CGPointError *)viewPoints withDrawPointFlags:(nonnull BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount; +-(void)alignViewPointsToUserSpace:(nonnull CGPointError *)viewPoints withContext:(nonnull CGContextRef)context drawPointFlags:(nonnull BOOL *)drawPointFlag numberOfPoints:(NSUInteger)dataCounts; +-(NSInteger)extremeDrawnPointIndexForFlags:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound; --(void)drawRangeInContext:(CGContextRef)context lineStyle:(CPTLineStyle *)lineStyle viewPoint:(CGPointError *)viewPoint halfGapSize:(CGSize)halfGapSize halfBarWidth:(CGFloat)halfBarWidth alignPoints:(BOOL)alignPoints; +-(void)drawRangeInContext:(nonnull CGContextRef)context lineStyle:(nonnull CPTLineStyle *)lineStyle viewPoint:(CGPointError *)viewPoint halfGapSize:(CGSize)halfGapSize halfBarWidth:(CGFloat)halfBarWidth alignPoints:(BOOL)alignPoints; -(CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx; +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx; @end @@ -87,6 +92,13 @@ @implementation CPTRangePlot @dynamic leftValues; @dynamic rightValues; @dynamic barLineStyles; +@dynamic barWidths; + +/** @property CPTRangePlotFillDirection fillDirection + * @brief Fill the range in a horizontal or vertical direction. + * Default is CPTRangePlotFillHorizontal. + **/ +@synthesize fillDirection; /** @property CPTFill *areaFill * @brief The fill used to render the area. @@ -137,7 +149,7 @@ @implementation CPTRangePlot /// @cond -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else +(void)initialize { @@ -149,8 +161,10 @@ +(void)initialize [self exposeBinding:CPTRangePlotBindingLeftValues]; [self exposeBinding:CPTRangePlotBindingRightValues]; [self exposeBinding:CPTRangePlotBindingBarLineStyles]; + [self exposeBinding:CPTRangePlotBindingBarWidths]; } } + #endif /// @endcond @@ -162,18 +176,27 @@ +(void)initialize * * This is the designated initializer. The initialized layer will have the following properties: * - @ref barLineStyle = default line style + * - @ref fillDirection = CPTRangePlotFillHorizontal * - @ref areaFill = @nil + * - @ref areaBorderLineStyle = @nil + * - @ref barWidth = 0.0 + * - @ref gapHeight = 0.0 + * - @ref gapWidth = 0.0 * - @ref labelField = #CPTRangePlotFieldX * * @param newFrame The frame rectangle. * @return The initialized CPTRangePlot object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { barLineStyle = [[CPTLineStyle alloc] init]; + fillDirection = CPTRangePlotFillHorizontal; areaFill = nil; areaBorderLineStyle = nil; + barWidth = CPTFloat(0.0); + gapHeight = CPTFloat(0.0); + gapWidth = CPTFloat(0.0); pointingDeviceDownIndex = NSNotFound; @@ -186,14 +209,18 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTRangePlot *theLayer = (CPTRangePlot *)layer; barLineStyle = theLayer->barLineStyle; + fillDirection = theLayer->fillDirection; areaFill = theLayer->areaFill; areaBorderLineStyle = theLayer->areaBorderLineStyle; + barWidth = theLayer->barWidth; + gapHeight = theLayer->gapHeight; + gapWidth = theLayer->gapWidth; pointingDeviceDownIndex = NSNotFound; } @@ -207,7 +234,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -215,6 +242,7 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeCGFloat:self.barWidth forKey:@"CPTRangePlot.barWidth"]; [coder encodeCGFloat:self.gapHeight forKey:@"CPTRangePlot.gapHeight"]; [coder encodeCGFloat:self.gapWidth forKey:@"CPTRangePlot.gapWidth"]; + [coder encodeInteger:self.fillDirection forKey:@"CPTRangePlot.fillDirection"]; [coder encodeObject:self.areaFill forKey:@"CPTRangePlot.areaFill"]; [coder encodeObject:self.areaBorderLineStyle forKey:@"CPTRangePlot.areaBorderLineStyle"]; @@ -222,15 +250,19 @@ -(void)encodeWithCoder:(NSCoder *)coder // pointingDeviceDownIndex } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - barLineStyle = [[coder decodeObjectForKey:@"CPTRangePlot.barLineStyle"] copy]; - barWidth = [coder decodeCGFloatForKey:@"CPTRangePlot.barWidth"]; - gapHeight = [coder decodeCGFloatForKey:@"CPTRangePlot.gapHeight"]; - gapWidth = [coder decodeCGFloatForKey:@"CPTRangePlot.gapWidth"]; - areaFill = [[coder decodeObjectForKey:@"CPTRangePlot.areaFill"] copy]; - areaBorderLineStyle = [[coder decodeObjectForKey:@"CPTRangePlot.areaBorderLineStyle"] copy]; + if ((self = [super initWithCoder:coder])) { + barLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTRangePlot.barLineStyle"] copy]; + barWidth = [coder decodeCGFloatForKey:@"CPTRangePlot.barWidth"]; + gapHeight = [coder decodeCGFloatForKey:@"CPTRangePlot.gapHeight"]; + gapWidth = [coder decodeCGFloatForKey:@"CPTRangePlot.gapWidth"]; + fillDirection = [coder decodeIntegerForKey:@"CPTRangePlot.fillDirection"]; + areaFill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTRangePlot.areaFill"] copy]; + areaBorderLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTRangePlot.areaBorderLineStyle"] copy]; pointingDeviceDownIndex = NSNotFound; } @@ -239,12 +271,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Determining Which Points to Draw /// @cond --(void)calculatePointsToDraw:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount forPlotSpace:(CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly +-(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace { if ( dataCount == 0 ) { return; @@ -257,9 +301,9 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)d } } else { - CPTPlotRangeComparisonResult *xRangeFlags = malloc( dataCount * sizeof(CPTPlotRangeComparisonResult) ); - CPTPlotRangeComparisonResult *yRangeFlags = malloc( dataCount * sizeof(CPTPlotRangeComparisonResult) ); - BOOL *nanFlags = malloc( dataCount * sizeof(BOOL) ); + CPTPlotRangeComparisonResult *xRangeFlags = calloc(dataCount, sizeof(CPTPlotRangeComparisonResult)); + CPTPlotRangeComparisonResult *yRangeFlags = calloc(dataCount, sizeof(CPTPlotRangeComparisonResult)); + BOOL *nanFlags = calloc(dataCount, sizeof(BOOL)); CPTPlotRange *xRange = xyPlotSpace.xRange; CPTPlotRange *yRange = xyPlotSpace.yRange; @@ -275,7 +319,7 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)d xRangeFlags[i] = [xRange compareToDouble:x]; yRangeFlags[i] = [yRange compareToDouble:y]; - nanFlags[i] = isnan(x) || isnan(y); + nanFlags[i] = isnan(x) || isnan(y); }); } else { @@ -288,7 +332,7 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)d xRangeFlags[i] = [xRange compareToDecimal:x]; yRangeFlags[i] = [yRange compareToDecimal:y]; - nanFlags[i] = NSDecimalIsNotANumber(&x); + nanFlags[i] = NSDecimalIsNotANumber(&x); }); } @@ -306,7 +350,7 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)d } } --(void)calculateViewPoints:(CGPointError *)viewPoints withDrawPointFlags:(BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount +-(void)calculateViewPoints:(nonnull CGPointError *)viewPoints withDrawPointFlags:(nonnull BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount { CPTPlotSpace *thePlotSpace = self.plotSpace; @@ -320,43 +364,43 @@ -(void)calculateViewPoints:(CGPointError *)viewPoints withDrawPointFlags:(BOOL * const double *rightBytes = (const double *)[self cachedNumbersForField:CPTRangePlotFieldRight].data.bytes; dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { - const double x = xBytes[i]; - const double y = yBytes[i]; - const double high = highBytes[i]; - const double low = lowBytes[i]; - const double left = leftBytes[i]; + const double x = xBytes[i]; + const double y = yBytes[i]; + const double high = highBytes[i]; + const double low = lowBytes[i]; + const double left = leftBytes[i]; const double right = rightBytes[i]; - if ( !drawPointFlags[i] || isnan(x) || isnan(y) ) { - viewPoints[i].x = NAN; // depending coordinates - viewPoints[i].y = NAN; + if ( !drawPointFlags[i] || isnan(x) || isnan(y)) { + viewPoints[i].x = CPTNAN; // depending coordinates + viewPoints[i].y = CPTNAN; } else { double plotPoint[2]; plotPoint[CPTCoordinateX] = x; plotPoint[CPTCoordinateY] = y; - CGPoint pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].x = pos.x; - viewPoints[i].y = pos.y; + CGPoint pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].x = pos.x; + viewPoints[i].y = pos.y; plotPoint[CPTCoordinateX] = x; plotPoint[CPTCoordinateY] = y + high; - pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].high = pos.y; + pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].high = pos.y; plotPoint[CPTCoordinateX] = x; plotPoint[CPTCoordinateY] = y - low; - pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].low = pos.y; + pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].low = pos.y; plotPoint[CPTCoordinateX] = x - left; plotPoint[CPTCoordinateY] = y; - pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].left = pos.x; + pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].left = pos.x; plotPoint[CPTCoordinateX] = x + right; plotPoint[CPTCoordinateY] = y; - pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].right = pos.x; + pos = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].right = pos.x; } }); } @@ -369,96 +413,96 @@ -(void)calculateViewPoints:(CGPointError *)viewPoints withDrawPointFlags:(BOOL * const NSDecimal *rightBytes = (const NSDecimal *)[self cachedNumbersForField:CPTRangePlotFieldRight].data.bytes; dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { - const NSDecimal x = xBytes[i]; - const NSDecimal y = yBytes[i]; - const NSDecimal high = highBytes[i]; - const NSDecimal low = lowBytes[i]; - const NSDecimal left = leftBytes[i]; + const NSDecimal x = xBytes[i]; + const NSDecimal y = yBytes[i]; + const NSDecimal high = highBytes[i]; + const NSDecimal low = lowBytes[i]; + const NSDecimal left = leftBytes[i]; const NSDecimal right = rightBytes[i]; - if ( !drawPointFlags[i] || NSDecimalIsNotANumber(&x) || NSDecimalIsNotANumber(&y) ) { - viewPoints[i].x = NAN; // depending coordinates - viewPoints[i].y = NAN; + if ( !drawPointFlags[i] || NSDecimalIsNotANumber(&x) || NSDecimalIsNotANumber(&y)) { + viewPoints[i].x = CPTNAN; // depending coordinates + viewPoints[i].y = CPTNAN; } else { NSDecimal plotPoint[2]; plotPoint[CPTCoordinateX] = x; plotPoint[CPTCoordinateY] = y; - CGPoint pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].x = pos.x; - viewPoints[i].y = pos.y; + CGPoint pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].x = pos.x; + viewPoints[i].y = pos.y; - if ( !NSDecimalIsNotANumber(&high) ) { + if ( !NSDecimalIsNotANumber(&high)) { plotPoint[CPTCoordinateX] = x; NSDecimal yh; NSDecimalAdd(&yh, &y, &high, NSRoundPlain); plotPoint[CPTCoordinateY] = yh; - pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].high = pos.y; + pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].high = pos.y; } else { - viewPoints[i].high = NAN; + viewPoints[i].high = CPTNAN; } - if ( !NSDecimalIsNotANumber(&low) ) { + if ( !NSDecimalIsNotANumber(&low)) { plotPoint[CPTCoordinateX] = x; NSDecimal yl; NSDecimalSubtract(&yl, &y, &low, NSRoundPlain); plotPoint[CPTCoordinateY] = yl; - pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].low = pos.y; + pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].low = pos.y; } else { - viewPoints[i].low = NAN; + viewPoints[i].low = CPTNAN; } - if ( !NSDecimalIsNotANumber(&left) ) { + if ( !NSDecimalIsNotANumber(&left)) { NSDecimal xl; NSDecimalSubtract(&xl, &x, &left, NSRoundPlain); plotPoint[CPTCoordinateX] = xl; plotPoint[CPTCoordinateY] = y; - pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].left = pos.x; + pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].left = pos.x; } else { - viewPoints[i].left = NAN; + viewPoints[i].left = CPTNAN; } - if ( !NSDecimalIsNotANumber(&right) ) { + if ( !NSDecimalIsNotANumber(&right)) { NSDecimal xr; NSDecimalAdd(&xr, &x, &right, NSRoundPlain); plotPoint[CPTCoordinateX] = xr; plotPoint[CPTCoordinateY] = y; - pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; - viewPoints[i].right = pos.x; + pos = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; + viewPoints[i].right = pos.x; } else { - viewPoints[i].right = NAN; + viewPoints[i].right = CPTNAN; } } }); } } --(void)alignViewPointsToUserSpace:(CGPointError *)viewPoints withContent:(CGContextRef)context drawPointFlags:(BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount +-(void)alignViewPointsToUserSpace:(nonnull CGPointError *)viewPoints withContext:(nonnull CGContextRef)context drawPointFlags:(nonnull BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount { // Align to device pixels if there is a data line. // Otherwise, align to view space, so fills are sharp at edges. - if ( self.barLineStyle.lineWidth > 0.0 ) { + if ( self.barLineStyle.lineWidth > CPTFloat(0.0)) { dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { if ( drawPointFlags[i] ) { - CGFloat x = viewPoints[i].x; - CGFloat y = viewPoints[i].y; - CGPoint pos = CPTAlignPointToUserSpace( context, CPTPointMake(viewPoints[i].x, viewPoints[i].y) ); + CGFloat x = viewPoints[i].x; + CGFloat y = viewPoints[i].y; + CGPoint pos = CPTAlignPointToUserSpace(context, CPTPointMake(viewPoints[i].x, viewPoints[i].y)); viewPoints[i].x = pos.x; viewPoints[i].y = pos.y; - pos = CPTAlignPointToUserSpace( context, CPTPointMake(x, viewPoints[i].high) ); - viewPoints[i].high = pos.y; - pos = CPTAlignPointToUserSpace( context, CPTPointMake(x, viewPoints[i].low) ); - viewPoints[i].low = pos.y; - pos = CPTAlignPointToUserSpace( context, CPTPointMake(viewPoints[i].left, y) ); - viewPoints[i].left = pos.x; - pos = CPTAlignPointToUserSpace( context, CPTPointMake(viewPoints[i].right, y) ); + pos = CPTAlignPointToUserSpace(context, CPTPointMake(x, viewPoints[i].high)); + viewPoints[i].high = pos.y; + pos = CPTAlignPointToUserSpace(context, CPTPointMake(x, viewPoints[i].low)); + viewPoints[i].low = pos.y; + pos = CPTAlignPointToUserSpace(context, CPTPointMake(viewPoints[i].left, y)); + viewPoints[i].left = pos.x; + pos = CPTAlignPointToUserSpace(context, CPTPointMake(viewPoints[i].right, y)); viewPoints[i].right = pos.x; } }); @@ -466,26 +510,26 @@ -(void)alignViewPointsToUserSpace:(CGPointError *)viewPoints withContent:(CGCont else { dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { if ( drawPointFlags[i] ) { - CGFloat x = viewPoints[i].x; - CGFloat y = viewPoints[i].y; - CGPoint pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(viewPoints[i].x, viewPoints[i].y) ); + CGFloat x = viewPoints[i].x; + CGFloat y = viewPoints[i].y; + CGPoint pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(viewPoints[i].x, viewPoints[i].y)); viewPoints[i].x = pos.x; viewPoints[i].y = pos.y; - pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(x, viewPoints[i].high) ); - viewPoints[i].high = pos.y; - pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(x, viewPoints[i].low) ); - viewPoints[i].low = pos.y; - pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(viewPoints[i].left, y) ); - viewPoints[i].left = pos.x; - pos = CPTAlignIntegralPointToUserSpace( context, CPTPointMake(viewPoints[i].right, y) ); + pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(x, viewPoints[i].high)); + viewPoints[i].high = pos.y; + pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(x, viewPoints[i].low)); + viewPoints[i].low = pos.y; + pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(viewPoints[i].left, y)); + viewPoints[i].left = pos.x; + pos = CPTAlignIntegralPointToUserSpace(context, CPTPointMake(viewPoints[i].right, y)); viewPoints[i].right = pos.x; } }); } } --(NSInteger)extremeDrawnPointIndexForFlags:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound +-(NSInteger)extremeDrawnPointIndexForFlags:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound { NSInteger result = NSNotFound; NSInteger delta = (isLowerBound ? 1 : -1); @@ -497,7 +541,7 @@ -(NSInteger)extremeDrawnPointIndexForFlags:(BOOL *)pointDrawFlags numberOfPoints result = i; break; } - if ( (delta < 0) && (i == 0) ) { + if ((delta < 0) && (i == 0)) { break; } } @@ -518,6 +562,9 @@ -(void)reloadDataInIndexRange:(NSRange)indexRange // Bar line styles [self reloadBarLineStylesInIndexRange:indexRange]; + + // Bar widths + [self reloadBarWidthsInIndexRange:indexRange]; } -(void)reloadPlotDataInIndexRange:(NSRange)indexRange @@ -581,9 +628,9 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(barLineStyleForRangePlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableLineStyleArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableLineStyleArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTLineStyle *dataSourceLineStyle = [theDataSource barLineStyleForRangePlot:self recordIndex:idx]; @@ -606,12 +653,55 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange [self setNeedsDisplay]; } +/** + * @brief Reload all bar widths from the data source immediately. + **/ +-(void)reloadBarWidths +{ + [self reloadBarWidthsInIndexRange:NSMakeRange(0, self.cachedDataCount)]; +} + +/** @brief Reload bar widths in the given index range from the data source immediately. + * @param indexRange The index range to load. + **/ +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange +{ + id theDataSource = (id)self.dataSource; + + if ( [theDataSource respondsToSelector:@selector(barWidthsForRangePlot:recordIndexRange:)] ) { + [self cacheArray:[theDataSource barWidthsForRangePlot:self recordIndexRange:indexRange] + forKey:CPTRangePlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + else if ( [theDataSource respondsToSelector:@selector(barWidthForRangePlot:recordIndex:)] ) { + id nilObject = [CPTPlot nilData]; + CPTMutableNumberArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); + + for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { + NSNumber *width = [theDataSource barWidthForRangePlot:self recordIndex:idx]; + if ( width ) { + [array addObject:width]; + } + else { + [array addObject:nilObject]; + } + } + + [self cacheArray:array + forKey:CPTRangePlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + + [self setNeedsDisplay]; +} + #pragma mark - #pragma mark Drawing /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -620,7 +710,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context CPTMutableNumericData *xValueData = [self cachedNumbersForField:CPTRangePlotFieldX]; CPTMutableNumericData *yValueData = [self cachedNumbersForField:CPTRangePlotFieldY]; - if ( (xValueData == nil) || (yValueData == nil) ) { + if ((xValueData == nil) || (yValueData == nil)) { return; } NSUInteger dataCount = self.cachedDataCount; @@ -634,14 +724,14 @@ -(void)renderAsVectorInContext:(CGContextRef)context [super renderAsVectorInContext:context]; // Calculate view points, and align to user space - CGPointError *viewPoints = calloc( dataCount, sizeof(CGPointError) ); - BOOL *drawPointFlags = calloc( dataCount, sizeof(BOOL) ); + CGPointError *viewPoints = calloc(dataCount, sizeof(CGPointError)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)self.plotSpace; - [self calculatePointsToDraw:drawPointFlags numberOfPoints:dataCount forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO]; + [self calculatePointsToDraw:drawPointFlags numberOfPoints:dataCount forPlotSpace:thePlotSpace]; [self calculateViewPoints:viewPoints withDrawPointFlags:drawPointFlags numberOfPoints:dataCount]; if ( self.alignsPointsToPixels ) { - [self alignViewPointsToUserSpace:viewPoints withContent:context drawPointFlags:drawPointFlags numberOfPoints:dataCount]; + [self alignViewPointsToUserSpace:viewPoints withContext:context drawPointFlags:drawPointFlags numberOfPoints:dataCount]; } // Get extreme points @@ -652,39 +742,80 @@ -(void)renderAsVectorInContext:(CGContextRef)context if ( self.areaFill ) { CGMutablePathRef fillPath = CGPathCreateMutable(); - // First do the top points - for ( NSUInteger i = (NSUInteger)firstDrawnPointIndex; i <= (NSUInteger)lastDrawnPointIndex; i++ ) { - CGFloat x = viewPoints[i].x; - CGFloat y = viewPoints[i].high; - if ( isnan(y) ) { - y = viewPoints[i].y; - } - - if ( !isnan(x) && !isnan(y) ) { - if ( i == (NSUInteger)firstDrawnPointIndex ) { - CGPathMoveToPoint(fillPath, NULL, x, y); + switch ( self.fillDirection ) { + case CPTRangePlotFillHorizontal: + // First do the top points + for ( NSUInteger i = (NSUInteger)firstDrawnPointIndex; i <= (NSUInteger)lastDrawnPointIndex; i++ ) { + CGFloat x = viewPoints[i].x; + CGFloat y = viewPoints[i].high; + if ( isnan(y)) { + y = viewPoints[i].y; + } + + if ( !isnan(x) && !isnan(y)) { + if ( i == (NSUInteger)firstDrawnPointIndex ) { + CGPathMoveToPoint(fillPath, NULL, x, y); + } + else { + CGPathAddLineToPoint(fillPath, NULL, x, y); + } + } } - else { - CGPathAddLineToPoint(fillPath, NULL, x, y); + + // Then reverse over bottom points + for ( NSUInteger j = (NSUInteger)lastDrawnPointIndex; j >= (NSUInteger)firstDrawnPointIndex; j-- ) { + CGFloat x = viewPoints[j].x; + CGFloat y = viewPoints[j].low; + if ( isnan(y)) { + y = viewPoints[j].y; + } + + if ( !isnan(x) && !isnan(y)) { + CGPathAddLineToPoint(fillPath, NULL, x, y); + } + if ( j == (NSUInteger)firstDrawnPointIndex ) { + // This could be done a bit more elegant + break; + } } - } - } + break; - // Then reverse over bottom points - for ( NSUInteger j = (NSUInteger)lastDrawnPointIndex; j >= (NSUInteger)firstDrawnPointIndex; j-- ) { - CGFloat x = viewPoints[j].x; - CGFloat y = viewPoints[j].low; - if ( isnan(y) ) { - y = viewPoints[j].y; - } + case CPTRangePlotFillVertical: + // First do the left points + for ( NSUInteger i = (NSUInteger)firstDrawnPointIndex; i <= (NSUInteger)lastDrawnPointIndex; i++ ) { + CGFloat x = viewPoints[i].left; + CGFloat y = viewPoints[i].y; + if ( isnan(x)) { + y = viewPoints[i].x; + } + + if ( !isnan(x) && !isnan(y)) { + if ( i == (NSUInteger)firstDrawnPointIndex ) { + CGPathMoveToPoint(fillPath, NULL, x, y); + } + else { + CGPathAddLineToPoint(fillPath, NULL, x, y); + } + } + } - if ( !isnan(x) && !isnan(y) ) { - CGPathAddLineToPoint(fillPath, NULL, x, y); - } - if ( j == (NSUInteger)firstDrawnPointIndex ) { - // This could be done a bit more elegant + // Then reverse over right points + for ( NSUInteger j = (NSUInteger)lastDrawnPointIndex; j >= (NSUInteger)firstDrawnPointIndex; j-- ) { + CGFloat x = viewPoints[j].right; + CGFloat y = viewPoints[j].y; + if ( isnan(x)) { + y = viewPoints[j].x; + } + + if ( !isnan(x) && !isnan(y)) { + CGPathAddLineToPoint(fillPath, NULL, x, y); + } + if ( j == (NSUInteger)firstDrawnPointIndex ) { + // This could be done a bit more elegant + break; + } + } break; - } } // Close the path to have a closed loop @@ -707,11 +838,12 @@ -(void)renderAsVectorInContext:(CGContextRef)context CGPathRelease(fillPath); } - CGSize halfGapSize = CPTSizeMake( self.gapWidth * CPTFloat(0.5), self.gapHeight * CPTFloat(0.5) ); - CGFloat halfBarWidth = self.barWidth * CPTFloat(0.5); - BOOL alignPoints = self.alignsPointsToPixels; + CGSize halfGapSize = CPTSizeMake(self.gapWidth * CPTFloat(0.5), self.gapHeight * CPTFloat(0.5)); + BOOL alignPoints = self.alignsPointsToPixels; for ( NSUInteger i = (NSUInteger)firstDrawnPointIndex; i <= (NSUInteger)lastDrawnPointIndex; i++ ) { + CGFloat halfBarWidth = [self barWidthForIndex:i].cgFloatValue * CPTFloat(0.5); + [self drawRangeInContext:context lineStyle:[self barLineStyleForIndex:i] viewPoint:&viewPoints[i] @@ -725,25 +857,25 @@ -(void)renderAsVectorInContext:(CGContextRef)context free(drawPointFlags); } --(void)drawRangeInContext:(CGContextRef)context - lineStyle:(CPTLineStyle *)lineStyle - viewPoint:(CGPointError *)viewPoint +-(void)drawRangeInContext:(nonnull CGContextRef)context + lineStyle:(nonnull CPTLineStyle *)lineStyle + viewPoint:(nonnull CGPointError *)viewPoint halfGapSize:(CGSize)halfGapSize halfBarWidth:(CGFloat)halfBarWidth alignPoints:(BOOL)alignPoints { - if ( [lineStyle isKindOfClass:[CPTLineStyle class]] && !isnan(viewPoint->x) && !isnan(viewPoint->y) ) { + if ( [lineStyle isKindOfClass:[CPTLineStyle class]] && !isnan(viewPoint->x) && !isnan(viewPoint->y)) { CPTAlignPointFunction alignmentFunction = CPTAlignPointToUserSpace; CGFloat lineWidth = lineStyle.lineWidth; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } CGMutablePathRef path = CGPathCreateMutable(); // centre-high - if ( !isnan(viewPoint->high) ) { + if ( !isnan(viewPoint->high)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x, viewPoint->y + halfGapSize.height); CGPoint alignedLowPoint = CPTPointMake(viewPoint->x, viewPoint->high); if ( alignPoints ) { @@ -755,7 +887,7 @@ -(void)drawRangeInContext:(CGContextRef)context } // centre-low - if ( !isnan(viewPoint->low) ) { + if ( !isnan(viewPoint->low)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x, viewPoint->y - halfGapSize.height); CGPoint alignedLowPoint = CPTPointMake(viewPoint->x, viewPoint->low); if ( alignPoints ) { @@ -767,7 +899,7 @@ -(void)drawRangeInContext:(CGContextRef)context } // top bar - if ( !isnan(viewPoint->high) ) { + if ( !isnan(viewPoint->high)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x - halfBarWidth, viewPoint->high); CGPoint alignedLowPoint = CPTPointMake(viewPoint->x + halfBarWidth, viewPoint->high); if ( alignPoints ) { @@ -779,7 +911,7 @@ -(void)drawRangeInContext:(CGContextRef)context } // bottom bar - if ( !isnan(viewPoint->low) ) { + if ( !isnan(viewPoint->low)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x - halfBarWidth, viewPoint->low); CGPoint alignedLowPoint = CPTPointMake(viewPoint->x + halfBarWidth, viewPoint->low); if ( alignPoints ) { @@ -791,7 +923,7 @@ -(void)drawRangeInContext:(CGContextRef)context } // centre-left - if ( !isnan(viewPoint->left) ) { + if ( !isnan(viewPoint->left)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x - halfGapSize.width, viewPoint->y); CGPoint alignedLowPoint = CPTPointMake(viewPoint->left, viewPoint->y); if ( alignPoints ) { @@ -803,7 +935,7 @@ -(void)drawRangeInContext:(CGContextRef)context } // centre-right - if ( !isnan(viewPoint->right) ) { + if ( !isnan(viewPoint->right)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->x + halfGapSize.width, viewPoint->y); CGPoint alignedLowPoint = CPTPointMake(viewPoint->right, viewPoint->y); if ( alignPoints ) { @@ -815,7 +947,7 @@ -(void)drawRangeInContext:(CGContextRef)context } // left bar - if ( !isnan(viewPoint->left) ) { + if ( !isnan(viewPoint->left)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->left, viewPoint->y - halfBarWidth); CGPoint alignedLowPoint = CPTPointMake(viewPoint->left, viewPoint->y + halfBarWidth); if ( alignPoints ) { @@ -827,7 +959,7 @@ -(void)drawRangeInContext:(CGContextRef)context } // right bar - if ( !isnan(viewPoint->right) ) { + if ( !isnan(viewPoint->right)) { CGPoint alignedHighPoint = CPTPointMake(viewPoint->right, viewPoint->y - halfBarWidth); CGPoint alignedLowPoint = CPTPointMake(viewPoint->right, viewPoint->y + halfBarWidth); if ( alignPoints ) { @@ -846,7 +978,7 @@ -(void)drawRangeInContext:(CGContextRef)context } } --(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(nonnull CGContextRef)context { [super drawSwatchForLegend:legend atIndex:idx inRect:rect inContext:context]; @@ -881,24 +1013,35 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C [self drawRangeInContext:context lineStyle:theBarLineStyle viewPoint:&viewPoint - halfGapSize:CPTSizeMake( MIN( self.gapWidth, rect.size.width / CPTFloat(2.0) ) * CPTFloat(0.5), MIN( self.gapHeight, rect.size.height / CPTFloat(2.0) ) * CPTFloat(0.5) ) + halfGapSize:CPTSizeMake(MIN(self.gapWidth, rect.size.width / CPTFloat(2.0)) * CPTFloat(0.5), MIN(self.gapHeight, rect.size.height / CPTFloat(2.0)) * CPTFloat(0.5)) halfBarWidth:MIN(MIN(self.barWidth, rect.size.width), rect.size.height) * CPTFloat(0.5) alignPoints:YES]; } } } --(CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx +-(nullable CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theBarLineStyle = [self cachedValueForKey:CPTRangePlotBindingBarLineStyles recordIndex:idx]; - if ( (theBarLineStyle == nil) || (theBarLineStyle == [CPTPlot nilData]) ) { + if ((theBarLineStyle == nil) || (theBarLineStyle == [CPTPlot nilData])) { theBarLineStyle = self.barLineStyle; } return theBarLineStyle; } +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx +{ + NSNumber *theBarWidth = [self cachedValueForKey:CPTRangePlotBindingBarWidths recordIndex:idx]; + + if ((theBarWidth == nil) || (theBarWidth == [CPTPlot nilData])) { + theBarWidth = @(self.barWidth); + } + + return theBarWidth; +} + /// @endcond #pragma mark - @@ -906,7 +1049,7 @@ -(CPTLineStyle *)barLineStyleForIndex:(NSUInteger)idx /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken = 0; @@ -937,7 +1080,7 @@ -(NSUInteger)numberOfFields return 6; } --(CPTNumberArray)fieldIdentifiers +-(nonnull CPTNumberArray *)fieldIdentifiers { return @[@(CPTRangePlotFieldX), @(CPTRangePlotFieldY), @@ -947,18 +1090,18 @@ -(CPTNumberArray)fieldIdentifiers @(CPTRangePlotFieldRight)]; } --(CPTNumberArray)fieldIdentifiersForCoordinate:(CPTCoordinate)coord +-(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord { - CPTNumberArray result = nil; + CPTNumberArray *result = nil; switch ( coord ) { case CPTCoordinateX: result = @[@(CPTRangePlotFieldX)]; - break; + break; case CPTCoordinateY: result = @[@(CPTRangePlotFieldY)]; - break; + break; default: [NSException raise:CPTException format:@"Invalid coordinate passed to fieldIdentifiersForCoordinate:"]; @@ -998,27 +1141,18 @@ -(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field /// @cond --(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx +-(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx { NSNumber *xValue = [self cachedNumberForField:CPTRangePlotFieldX recordIndex:idx]; + NSNumber *yValue = [self cachedNumberForField:CPTRangePlotFieldY recordIndex:idx]; BOOL positiveDirection = YES; CPTPlotRange *yRange = [self.plotSpace plotRangeForCoordinate:CPTCoordinateY]; - if ( CPTDecimalLessThan( yRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalLessThan(yRange.lengthDecimal, CPTDecimalFromInteger(0))) { positiveDirection = !positiveDirection; } - NSNumber *yValue; - CPTNumberArray yValues = @[[self cachedNumberForField:CPTRangePlotFieldY recordIndex:idx]]; - CPTNumberArray yValuesSorted = [yValues sortedArrayUsingSelector:@selector(compare:)]; - if ( positiveDirection ) { - yValue = [yValuesSorted lastObject]; - } - else { - yValue = yValuesSorted[0]; - } - label.anchorPlotPoint = @[xValue, yValue]; label.contentLayer.hidden = self.hidden || isnan([xValue doubleValue]) || isnan([yValue doubleValue]); @@ -1040,22 +1174,22 @@ -(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInte -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point { NSUInteger dataCount = self.cachedDataCount; - CGPointError *viewPoints = calloc( dataCount, sizeof(CGPointError) ); - BOOL *drawPointFlags = malloc( dataCount * sizeof(BOOL) ); + CGPointError *viewPoints = calloc(dataCount, sizeof(CGPointError)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); - [self calculatePointsToDraw:drawPointFlags numberOfPoints:dataCount forPlotSpace:(id)self.plotSpace includeVisiblePointsOnly:YES]; + [self calculatePointsToDraw:drawPointFlags numberOfPoints:dataCount forPlotSpace:(CPTXYPlotSpace *)self.plotSpace]; [self calculateViewPoints:viewPoints withDrawPointFlags:drawPointFlags numberOfPoints:dataCount]; NSInteger result = [self extremeDrawnPointIndexForFlags:drawPointFlags numberOfPoints:dataCount extremeNumIsLowerBound:YES]; if ( result != NSNotFound ) { CGPointError lastViewPoint; - CGFloat minimumDistanceSquared = NAN; + CGFloat minimumDistanceSquared = CPTNAN; for ( NSUInteger i = (NSUInteger)result; i < dataCount; ++i ) { if ( drawPointFlags[i] ) { lastViewPoint = viewPoints[i]; CGPoint lastPoint = CPTPointMake(lastViewPoint.x, lastViewPoint.y); CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, lastPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = (NSInteger)i; } @@ -1064,16 +1198,16 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( result != NSNotFound ) { lastViewPoint = viewPoints[result]; - if ( !isnan(lastViewPoint.left) && (point.x < lastViewPoint.left) ) { + if ( !isnan(lastViewPoint.left) && (point.x < lastViewPoint.left)) { result = NSNotFound; } - if ( !isnan(lastViewPoint.right) && (point.x > lastViewPoint.right) ) { + if ( !isnan(lastViewPoint.right) && (point.x > lastViewPoint.right)) { result = NSNotFound; } - if ( !isnan(lastViewPoint.high) && (point.y > lastViewPoint.high) ) { + if ( !isnan(lastViewPoint.high) && (point.y > lastViewPoint.high)) { result = NSNotFound; } - if ( !isnan(lastViewPoint.low) && (point.y < lastViewPoint.low) ) { + if ( !isnan(lastViewPoint.low) && (point.y < lastViewPoint.low)) { result = NSNotFound; } } @@ -1108,7 +1242,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTGraph *theGraph = self.graph; CPTPlotArea *thePlotArea = self.plotArea; @@ -1117,7 +1251,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact 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:)] || @@ -1173,7 +1307,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { NSUInteger selectedDownIndex = self.pointingDeviceDownIndex; @@ -1186,7 +1320,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio 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:)] || @@ -1236,7 +1370,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio /// @cond --(void)setBarLineStyle:(CPTLineStyle *)newLineStyle +-(void)setBarLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( barLineStyle != newLineStyle ) { barLineStyle = [newLineStyle copy]; @@ -1245,7 +1379,7 @@ -(void)setBarLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setAreaFill:(CPTFill *)newFill +-(void)setAreaFill:(nullable CPTFill *)newFill { if ( newFill != areaFill ) { areaFill = [newFill copy]; @@ -1254,7 +1388,7 @@ -(void)setAreaFill:(CPTFill *)newFill } } --(void)setAreaBorderLineStyle:(CPTLineStyle *)newLineStyle +-(void)setAreaBorderLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( areaBorderLineStyle != newLineStyle ) { areaBorderLineStyle = [newLineStyle copy]; @@ -1287,72 +1421,72 @@ -(void)setGapWidth:(CGFloat)newGapWidth } } --(void)setXValues:(CPTNumberArray)newValues +-(void)setXValues:(nullable CPTNumberArray *)newValues { [self cacheNumbers:newValues forField:CPTRangePlotFieldX]; } --(CPTNumberArray)xValues +-(nullable CPTNumberArray *)xValues { return [[self cachedNumbersForField:CPTRangePlotFieldX] sampleArray]; } --(void)setYValues:(CPTNumberArray)newValues +-(void)setYValues:(nullable CPTNumberArray *)newValues { [self cacheNumbers:newValues forField:CPTRangePlotFieldY]; } --(CPTNumberArray)yValues +-(nullable CPTNumberArray *)yValues { return [[self cachedNumbersForField:CPTRangePlotFieldY] sampleArray]; } --(CPTMutableNumericData *)highValues +-(nullable CPTMutableNumericData *)highValues { return [self cachedNumbersForField:CPTRangePlotFieldHigh]; } --(void)setHighValues:(CPTMutableNumericData *)newValues +-(void)setHighValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTRangePlotFieldHigh]; } --(CPTMutableNumericData *)lowValues +-(nullable CPTMutableNumericData *)lowValues { return [self cachedNumbersForField:CPTRangePlotFieldLow]; } --(void)setLowValues:(CPTMutableNumericData *)newValues +-(void)setLowValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTRangePlotFieldLow]; } --(CPTMutableNumericData *)leftValues +-(nullable CPTMutableNumericData *)leftValues { return [self cachedNumbersForField:CPTRangePlotFieldLeft]; } --(void)setLeftValues:(CPTMutableNumericData *)newValues +-(void)setLeftValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTRangePlotFieldLeft]; } --(CPTMutableNumericData *)rightValues +-(nullable CPTMutableNumericData *)rightValues { return [self cachedNumbersForField:CPTRangePlotFieldRight]; } --(void)setRightValues:(CPTMutableNumericData *)newValues +-(void)setRightValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTRangePlotFieldRight]; } --(CPTLineStyleArray)barLineStyles +-(nullable CPTLineStyleArray *)barLineStyles { return [self cachedArrayForKey:CPTRangePlotBindingBarLineStyles]; } --(void)setBarLineStyles:(CPTLineStyleArray)newLineStyles +-(void)setBarLineStyles:(nullable CPTLineStyleArray *)newLineStyles { [self cacheArray:newLineStyles forKey:CPTRangePlotBindingBarLineStyles]; [self setNeedsDisplay]; diff --git a/framework/Source/CPTResponder.h b/framework/Source/CPTResponder.h index 0e60d5d54..6b56832ff 100644 --- a/framework/Source/CPTResponder.h +++ b/framework/Source/CPTResponder.h @@ -48,7 +48,7 @@ **/ -(BOOL)pointingDeviceCancelledEvent:(nonnull CPTNativeEvent *)event; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else /** diff --git a/framework/Source/CPTScatterPlot.h b/framework/Source/CPTScatterPlot.h index 84317a202..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; /// @} /** @@ -31,7 +36,19 @@ typedef NS_ENUM (NSInteger, CPTScatterPlotInterpolation) { CPTScatterPlotInterpolationLinear, ///< Linear interpolation. CPTScatterPlotInterpolationStepped, ///< Steps beginning at data point. CPTScatterPlotInterpolationHistogram, ///< Steps centered at data point. - CPTScatterPlotInterpolationCurved ///< Bezier curve interpolation. + CPTScatterPlotInterpolationCurved ///< Curved interpolation. +}; + +/** + * @brief Enumration of scatter plot curved interpolation style options + **/ +typedef NS_ENUM (NSInteger, CPTScatterPlotCurvedInterpolationOption) { + CPTScatterPlotCurvedInterpolationNormal, ///< Standard Curved Interpolation (Bezier Curve) + CPTScatterPlotCurvedInterpolationCatmullRomUniform, ///< Catmull-Rom Spline Interpolation with alpha = @num{0.0}. + CPTScatterPlotCurvedInterpolationCatmullRomCentripetal, ///< Catmull-Rom Spline Interpolation with alpha = @num{0.5}. + CPTScatterPlotCurvedInterpolationCatmullRomChordal, ///< Catmull-Rom Spline Interpolation with alpha = @num{1.0}. + CPTScatterPlotCurvedInterpolationCatmullCustomAlpha, ///< Catmull-Rom Spline Interpolation with a custom alpha value. + CPTScatterPlotCurvedInterpolationHermiteCubic ///< Hermite Cubic Spline Interpolation }; /** @@ -61,7 +78,7 @@ typedef NS_ENUM (NSInteger, CPTScatterPlotHistogramOption) { * @param indexRange The range of the data indexes of interest. * @return An array of plot symbols. **/ --(nullable CPTPlotSymbolArray)symbolsForScatterPlot:(nonnull CPTScatterPlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTPlotSymbolArray *)symbolsForScatterPlot:(nonnull CPTScatterPlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets a single plot symbol for the given scatter plot. * This method will not be called if @@ -234,11 +251,13 @@ typedef NS_ENUM (NSInteger, CPTScatterPlotHistogramOption) { @property (nonatomic, readwrite, strong, nullable) NSNumber *areaBaseValue2; @property (nonatomic, readwrite, assign) CPTScatterPlotInterpolation interpolation; @property (nonatomic, readwrite, assign) CPTScatterPlotHistogramOption histogramOption; +@property (nonatomic, readwrite, assign) CPTScatterPlotCurvedInterpolationOption curvedInterpolationOption; +@property (nonatomic, readwrite, assign) CGFloat curvedInterpolationCustomAlpha; /// @} /// @name Area Fill Bands /// @{ -@property (nonatomic, readonly, nullable) CPTLimitBandArray areaFillBands; +@property (nonatomic, readonly, nullable) CPTLimitBandArray *areaFillBands; /// @} /// @name Drawing diff --git a/framework/Source/CPTScatterPlot.m b/framework/Source/CPTScatterPlot.m index 8eaf87835..d8417fc1f 100644 --- a/framework/Source/CPTScatterPlot.m +++ b/framework/Source/CPTScatterPlot.m @@ -27,29 +27,32 @@ * @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() -@property (nonatomic, readwrite, copy) CPTNumberArray xValues; -@property (nonatomic, readwrite, copy) CPTNumberArray yValues; -@property (nonatomic, readwrite, strong) CPTPlotSymbolArray plotSymbols; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *xValues; +@property (nonatomic, readwrite, copy, nullable) CPTNumberArray *yValues; +@property (nonatomic, readwrite, strong, nullable) CPTPlotSymbolArray *plotSymbols; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; @property (nonatomic, readwrite, assign) BOOL pointingDeviceDownOnLine; -@property (nonatomic, readwrite, strong) CPTMutableLimitBandArray mutableAreaFillBands; +@property (nonatomic, readwrite, strong) CPTMutableLimitBandArray *mutableAreaFillBands; --(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly numberOfPoints:(NSUInteger)dataCount; --(void)calculateViewPoints:(CGPoint *)viewPoints withDrawPointFlags:(BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount; --(void)alignViewPointsToUserSpace:(CGPoint *)viewPoints withContent:(CGContextRef)context drawPointFlags:(BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount; +-(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly numberOfPoints:(NSUInteger)dataCount; +-(void)calculateViewPoints:(nonnull CGPoint *)viewPoints withDrawPointFlags:(nonnull BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount; +-(void)alignViewPointsToUserSpace:(nonnull CGPoint *)viewPoints withContext:(nonnull CGContextRef)context drawPointFlags:(nonnull BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount; --(NSInteger)extremeDrawnPointIndexForFlags:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound; +-(NSInteger)extremeDrawnPointIndexForFlags:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound; --(CGPathRef)newDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange:(NSRange)indexRange baselineYValue:(CGFloat)baselineYValue; --(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange:(NSRange)indexRange baselineYValue:(CGFloat)baselineYValue; --(void)computeControlPoints:(CGPoint *)cp1 points2:(CGPoint *)cp2 forViewPoints:(CGPoint *)viewPoints indexRange:(NSRange)indexRange; +-(nonnull CGPathRef)newDataLinePathForViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange baselineYValue:(CGFloat)baselineYValue; +-(nonnull CGPathRef)newCurvedDataLinePathForViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange baselineYValue:(CGFloat)baselineYValue; +-(void)computeBezierControlPoints:(nonnull CGPoint *)cp1 points2:(nonnull CGPoint *)cp2 forViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange; +-(void)computeCatmullRomControlPoints:(nonnull CGPoint *)points points2:(nonnull CGPoint *)points2 withAlpha:(CGFloat)alpha forViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange; +-(void)computeHermiteControlPoints:(nonnull CGPoint *)points points2:(nonnull CGPoint *)points2 forViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange; +-(BOOL)monotonicViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange; @end @@ -82,31 +85,44 @@ @implementation CPTScatterPlot **/ @synthesize histogramOption; -/** @property CPTLineStyle *dataLineStyle +/** @property CPTScatterPlotCurvedInterpolationOption curvedInterpolationOption + * @brief The interpolation method used to generate the curved plot line (@ref interpolation = #CPTScatterPlotInterpolationCurved) + * Default is #CPTScatterPlotCurvedInterpolationNormal + **/ +@synthesize curvedInterpolationOption; + +/** @property CGFloat curvedInterpolationCustomAlpha + * @brief The custom alpha value used when the #CPTScatterPlotCurvedInterpolationCatmullCustomAlpha interpolation is selected. + * Default is @num{0.5}. + * @note Must be between @num{0.0} and @num{1.0}. + **/ +@synthesize curvedInterpolationCustomAlpha; + +/** @property nullable CPTLineStyle *dataLineStyle * @brief The line style for the data line. * If @nil, the line is not drawn. **/ @synthesize dataLineStyle; -/** @property CPTPlotSymbol *plotSymbol +/** @property nullable CPTPlotSymbol *plotSymbol * @brief The plot symbol drawn at each point if the data source does not provide symbols. * If @nil, no symbol is drawn. **/ @synthesize plotSymbol; -/** @property CPTFill *areaFill +/** @property nullable CPTFill *areaFill * @brief The fill style for the area underneath the data line. * If @nil, the area is not filled. **/ @synthesize areaFill; -/** @property CPTFill *areaFill2 +/** @property nullable CPTFill *areaFill2 * @brief The fill style for the area above the data line. * If @nil, the area is not filled. **/ @synthesize areaFill2; -/** @property NSNumber *areaBaseValue +/** @property nullable NSNumber *areaBaseValue * @brief The Y coordinate of the straight boundary of the area fill. * If not a number, the area is not filled. * @@ -116,7 +132,7 @@ @implementation CPTScatterPlot **/ @synthesize areaBaseValue; -/** @property NSNumber *areaBaseValue2 +/** @property nullable NSNumber *areaBaseValue2 * @brief The Y coordinate of the straight boundary of the secondary area fill. * If not a number, the area is not filled. * @@ -133,7 +149,7 @@ @implementation CPTScatterPlot **/ @synthesize plotSymbolMarginForHitDetection; -/** @property CGPathRef newDataLinePath +/** @property nonnull CGPathRef newDataLinePath * @brief The path used to draw the data line. The caller must release the returned path. **/ @dynamic newDataLinePath; @@ -166,7 +182,7 @@ @implementation CPTScatterPlot **/ @synthesize pointingDeviceDownOnLine; -/** @property CPTLimitBandArray areaFillBands +/** @property nullable CPTLimitBandArray *areaFillBands * @brief An array of CPTLimitBand objects. * * The limit bands are drawn between the plot line and areaBaseValue and on top of the areaFill. @@ -180,7 +196,7 @@ @implementation CPTScatterPlot /// @cond -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else +(void)initialize { @@ -190,6 +206,7 @@ +(void)initialize [self exposeBinding:CPTScatterPlotBindingPlotSymbols]; } } + #endif /// @endcond @@ -211,14 +228,16 @@ +(void)initialize * - @ref allowSimultaneousSymbolAndPlotSelection = NO * - @ref interpolation = #CPTScatterPlotInterpolationLinear * - @ref histogramOption = #CPTScatterPlotHistogramNormal + * - @ref curvedInterpolationOption = #CPTScatterPlotCurvedInterpolationNormal + * - @ref curvedInterpolationCustomAlpha = @num{0.5} * - @ref labelField = #CPTScatterPlotFieldY * * @param newFrame The frame rectangle. * @return The initialized CPTScatterPlot object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { dataLineStyle = [[CPTLineStyle alloc] init]; plotSymbol = nil; areaFill = nil; @@ -229,6 +248,8 @@ -(instancetype)initWithFrame:(CGRect)newFrame plotLineMarginForHitDetection = CPTFloat(4.0); interpolation = CPTScatterPlotInterpolationLinear; histogramOption = CPTScatterPlotHistogramNormal; + curvedInterpolationOption = CPTScatterPlotCurvedInterpolationNormal; + curvedInterpolationCustomAlpha = CPTFloat(0.5); pointingDeviceDownIndex = NSNotFound; pointingDeviceDownOnLine = NO; mutableAreaFillBands = nil; @@ -241,9 +262,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTScatterPlot *theLayer = (CPTScatterPlot *)layer; dataLineStyle = theLayer->dataLineStyle; @@ -257,6 +278,8 @@ -(instancetype)initWithLayer:(id)layer allowSimultaneousSymbolAndPlotSelection = theLayer->allowSimultaneousSymbolAndPlotSelection; interpolation = theLayer->interpolation; histogramOption = theLayer->histogramOption; + curvedInterpolationOption = theLayer->curvedInterpolationOption; + curvedInterpolationCustomAlpha = theLayer->curvedInterpolationCustomAlpha; mutableAreaFillBands = theLayer->mutableAreaFillBands; pointingDeviceDownIndex = NSNotFound; pointingDeviceDownOnLine = NO; @@ -271,12 +294,14 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeInteger:self.interpolation forKey:@"CPTScatterPlot.interpolation"]; [coder encodeInteger:self.histogramOption forKey:@"CPTScatterPlot.histogramOption"]; + [coder encodeInteger:self.curvedInterpolationOption forKey:@"CPTScatterPlot.curvedInterpolationOption"]; + [coder encodeCGFloat:self.curvedInterpolationCustomAlpha forKey:@"CPTScatterPlot.curvedInterpolationCustomAlpha"]; [coder encodeObject:self.dataLineStyle forKey:@"CPTScatterPlot.dataLineStyle"]; [coder encodeObject:self.plotSymbol forKey:@"CPTScatterPlot.plotSymbol"]; [coder encodeObject:self.areaFill forKey:@"CPTScatterPlot.areaFill"]; @@ -293,18 +318,27 @@ -(void)encodeWithCoder:(NSCoder *)coder // pointingDeviceDownOnLine } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - interpolation = (CPTScatterPlotInterpolation)[coder decodeIntegerForKey : @"CPTScatterPlot.interpolation"]; - histogramOption = (CPTScatterPlotHistogramOption)[coder decodeIntegerForKey : @"CPTScatterPlot.histogramOption"]; - dataLineStyle = [[coder decodeObjectForKey:@"CPTScatterPlot.dataLineStyle"] copy]; - plotSymbol = [[coder decodeObjectForKey:@"CPTScatterPlot.plotSymbol"] copy]; - areaFill = [[coder decodeObjectForKey:@"CPTScatterPlot.areaFill"] copy]; - areaFill2 = [[coder decodeObjectForKey:@"CPTScatterPlot.areaFill2"] copy]; - mutableAreaFillBands = [[coder decodeObjectForKey:@"CPTScatterPlot.mutableAreaFillBands"] mutableCopy]; - areaBaseValue = [coder decodeObjectForKey:@"CPTScatterPlot.areaBaseValue"]; - areaBaseValue2 = [coder decodeObjectForKey:@"CPTScatterPlot.areaBaseValue2"]; + if ((self = [super initWithCoder:coder])) { + interpolation = (CPTScatterPlotInterpolation)[coder decodeIntegerForKey:@"CPTScatterPlot.interpolation"]; + histogramOption = (CPTScatterPlotHistogramOption)[coder decodeIntegerForKey:@"CPTScatterPlot.histogramOption"]; + curvedInterpolationOption = (CPTScatterPlotCurvedInterpolationOption)[coder decodeIntegerForKey:@"CPTScatterPlot.curvedInterpolationOption"]; + curvedInterpolationCustomAlpha = [coder decodeCGFloatForKey:@"CPTScatterPlot.curvedInterpolationCustomAlpha"]; + dataLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTScatterPlot.dataLineStyle"] copy]; + plotSymbol = [[coder decodeObjectOfClass:[CPTPlotSymbol class] + forKey:@"CPTScatterPlot.plotSymbol"] copy]; + areaFill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTScatterPlot.areaFill"] copy]; + areaFill2 = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTScatterPlot.areaFill2"] copy]; + mutableAreaFillBands = [[coder decodeObjectOfClasses:[NSSet setWithArray:@[[NSArray class], [CPTLimitBand class]]] + forKey:@"CPTScatterPlot.mutableAreaFillBands"] mutableCopy]; + areaBaseValue = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTScatterPlot.areaBaseValue"]; + areaBaseValue2 = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTScatterPlot.areaBaseValue2"]; plotSymbolMarginForHitDetection = [coder decodeCGFloatForKey:@"CPTScatterPlot.plotSymbolMarginForHitDetection"]; plotLineMarginForHitDetection = [coder decodeCGFloatForKey:@"CPTScatterPlot.plotLineMarginForHitDetection"]; allowSimultaneousSymbolAndPlotSelection = [coder decodeBoolForKey:@"CPTScatterPlot.allowSimultaneousSymbolAndPlotSelection"]; @@ -316,6 +350,18 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Data Loading @@ -374,9 +420,9 @@ -(void)reloadPlotSymbolsInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(symbolForScatterPlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutablePlotSymbolArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutablePlotSymbolArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTPlotSymbol *symbol = [theDataSource symbolForScatterPlot:self recordIndex:idx]; @@ -406,11 +452,11 @@ -(void)reloadPlotSymbolsInIndexRange:(NSRange)indexRange * @param idx The index of the record. * @return The plot symbol to use, or @nil if no plot symbol should be drawn. **/ --(CPTPlotSymbol *)plotSymbolForRecordIndex:(NSUInteger)idx +-(nullable CPTPlotSymbol *)plotSymbolForRecordIndex:(NSUInteger)idx { CPTPlotSymbol *symbol = [self cachedValueForKey:CPTScatterPlotBindingPlotSymbols recordIndex:idx]; - if ( (symbol == nil) || (symbol == [CPTPlot nilData]) ) { + if ((symbol == nil) || (symbol == [CPTPlot nilData])) { symbol = self.plotSymbol; } @@ -422,7 +468,7 @@ -(CPTPlotSymbol *)plotSymbolForRecordIndex:(NSUInteger)idx /// @cond --(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly numberOfPoints:(NSUInteger)dataCount +-(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly numberOfPoints:(NSUInteger)dataCount { if ( dataCount == 0 ) { return; @@ -430,16 +476,16 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace CPTLineStyle *lineStyle = self.dataLineStyle; - if ( self.areaFill || self.areaFill2 || lineStyle.dashPattern || lineStyle.lineFill || (self.interpolation == CPTScatterPlotInterpolationCurved) ) { + if ( self.areaFill || self.areaFill2 || lineStyle.dashPattern || lineStyle.lineFill || (self.interpolation == CPTScatterPlotInterpolationCurved)) { // show all points to preserve the line dash and area fills for ( NSUInteger i = 0; i < dataCount; i++ ) { pointDrawFlags[i] = YES; } } else { - CPTPlotRangeComparisonResult *xRangeFlags = malloc( dataCount * sizeof(CPTPlotRangeComparisonResult) ); - CPTPlotRangeComparisonResult *yRangeFlags = malloc( dataCount * sizeof(CPTPlotRangeComparisonResult) ); - BOOL *nanFlags = malloc( dataCount * sizeof(BOOL) ); + CPTPlotRangeComparisonResult *xRangeFlags = calloc(dataCount, sizeof(CPTPlotRangeComparisonResult)); + CPTPlotRangeComparisonResult *yRangeFlags = calloc(dataCount, sizeof(CPTPlotRangeComparisonResult)); + BOOL *nanFlags = calloc(dataCount, sizeof(BOOL)); CPTPlotRange *xRange = xyPlotSpace.xRange; CPTPlotRange *yRange = xyPlotSpace.yRange; @@ -454,7 +500,7 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace const double y = yBytes[i]; CPTPlotRangeComparisonResult xFlag = [xRange compareToDouble:x]; - xRangeFlags[i] = xFlag; + xRangeFlags[i] = xFlag; if ( xFlag != CPTPlotRangeComparisonResultNumberInRange ) { yRangeFlags[i] = CPTPlotRangeComparisonResultNumberInRange; // if x is out of range, then y doesn't matter } @@ -474,7 +520,7 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace const NSDecimal y = yBytes[i]; CPTPlotRangeComparisonResult xFlag = [xRange compareToDecimal:x]; - xRangeFlags[i] = xFlag; + xRangeFlags[i] = xFlag; if ( xFlag != CPTPlotRangeComparisonResultNumberInRange ) { yRangeFlags[i] = CPTPlotRangeComparisonResultNumberInRange; // if x is out of range, then y doesn't matter } @@ -490,7 +536,7 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace // are included. This ensures no lines are left out that shouldn't be. CPTScatterPlotInterpolation theInterpolation = self.interpolation; - memset( pointDrawFlags, NO, dataCount * sizeof(BOOL) ); + memset(pointDrawFlags, NO, dataCount * sizeof(BOOL)); if ( dataCount > 0 ) { pointDrawFlags[0] = (xRangeFlags[0] == CPTPlotRangeComparisonResultNumberInRange && yRangeFlags[0] == CPTPlotRangeComparisonResultNumberInRange && @@ -498,9 +544,9 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace } if ( visibleOnly ) { for ( NSUInteger i = 1; i < dataCount; i++ ) { - if ( (xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - !nanFlags[i] ) { + if ((xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + !nanFlags[i] ) { pointDrawFlags[i] = YES; } } @@ -510,13 +556,13 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace case CPTScatterPlotInterpolationCurved: // Keep 2 points outside of the visible area on each side to maintain the correct curvature of the line if ( dataCount > 1 ) { - if ( !nanFlags[0] && !nanFlags[1] && ( (xRangeFlags[0] != xRangeFlags[1]) || (yRangeFlags[0] != yRangeFlags[1]) ) ) { + if ( !nanFlags[0] && !nanFlags[1] && ((xRangeFlags[0] != xRangeFlags[1]) || (yRangeFlags[0] != yRangeFlags[1]))) { pointDrawFlags[0] = YES; pointDrawFlags[1] = YES; } - else if ( (xRangeFlags[1] == CPTPlotRangeComparisonResultNumberInRange) && - (yRangeFlags[1] == CPTPlotRangeComparisonResultNumberInRange) && - !nanFlags[1] ) { + else if ((xRangeFlags[1] == CPTPlotRangeComparisonResultNumberInRange) && + (yRangeFlags[1] == CPTPlotRangeComparisonResultNumberInRange) && + !nanFlags[1] ) { pointDrawFlags[1] = YES; } } @@ -527,14 +573,14 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace pointDrawFlags[i - 1] = YES; pointDrawFlags[i] = YES; } - else if ( !nanFlags[i - 1] && !nanFlags[i] && ( (xRangeFlags[i - 1] != xRangeFlags[i]) || (yRangeFlags[i - 1] != yRangeFlags[i]) ) ) { + else if ( !nanFlags[i - 1] && !nanFlags[i] && ((xRangeFlags[i - 1] != xRangeFlags[i]) || (yRangeFlags[i - 1] != yRangeFlags[i]))) { pointDrawFlags[i - 2] = YES; pointDrawFlags[i - 1] = YES; pointDrawFlags[i] = YES; } - else if ( (xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - !nanFlags[i] ) { + else if ((xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + !nanFlags[i] ) { pointDrawFlags[i] = YES; } } @@ -543,13 +589,13 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace default: // Keep 1 point outside of the visible area on each side for ( NSUInteger i = 1; i < dataCount; i++ ) { - if ( !nanFlags[i - 1] && !nanFlags[i] && ( (xRangeFlags[i - 1] != xRangeFlags[i]) || (yRangeFlags[i - 1] != yRangeFlags[i]) ) ) { + if ( !nanFlags[i - 1] && !nanFlags[i] && ((xRangeFlags[i - 1] != xRangeFlags[i]) || (yRangeFlags[i - 1] != yRangeFlags[i]))) { pointDrawFlags[i - 1] = YES; pointDrawFlags[i] = YES; } - else if ( (xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && - !nanFlags[i] ) { + else if ((xRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + (yRangeFlags[i] == CPTPlotRangeComparisonResultNumberInRange) && + !nanFlags[i] ) { pointDrawFlags[i] = YES; } } @@ -563,7 +609,7 @@ -(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace } } --(void)calculateViewPoints:(CGPoint *)viewPoints withDrawPointFlags:(BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount +-(void)calculateViewPoints:(nonnull CGPoint *)viewPoints withDrawPointFlags:(nonnull BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount { CPTPlotSpace *thePlotSpace = self.plotSpace; @@ -575,7 +621,7 @@ -(void)calculateViewPoints:(CGPoint *)viewPoints withDrawPointFlags:(BOOL *)draw dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { const double x = xBytes[i]; const double y = yBytes[i]; - if ( !drawPointFlags[i] || isnan(x) || isnan(y) ) { + if ( !drawPointFlags[i] || isnan(x) || isnan(y)) { viewPoints[i] = CPTPointMake(NAN, NAN); } else { @@ -597,7 +643,7 @@ -(void)calculateViewPoints:(CGPoint *)viewPoints withDrawPointFlags:(BOOL *)draw dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { const NSDecimal x = xBytes[i]; const NSDecimal y = yBytes[i]; - if ( !drawPointFlags[i] || NSDecimalIsNotANumber(&x) || NSDecimalIsNotANumber(&y) ) { + if ( !drawPointFlags[i] || NSDecimalIsNotANumber(&x) || NSDecimalIsNotANumber(&y)) { viewPoints[i] = CPTPointMake(NAN, NAN); } else { @@ -611,11 +657,11 @@ -(void)calculateViewPoints:(CGPoint *)viewPoints withDrawPointFlags:(BOOL *)draw } } --(void)alignViewPointsToUserSpace:(CGPoint *)viewPoints withContent:(CGContextRef)context drawPointFlags:(BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount +-(void)alignViewPointsToUserSpace:(nonnull CGPoint *)viewPoints withContext:(nonnull CGContextRef)context drawPointFlags:(nonnull BOOL *)drawPointFlags numberOfPoints:(NSUInteger)dataCount { // Align to device pixels if there is a data line. // Otherwise, align to view space, so fills are sharp at edges. - if ( self.dataLineStyle.lineWidth > 0.0 ) { + if ( self.dataLineStyle.lineWidth > CPTFloat(0.0)) { dispatch_apply(dataCount, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(size_t i) { if ( drawPointFlags[i] ) { viewPoints[i] = CPTAlignPointToUserSpace(context, viewPoints[i]); @@ -631,7 +677,7 @@ -(void)alignViewPointsToUserSpace:(CGPoint *)viewPoints withContent:(CGContextRe } } --(NSInteger)extremeDrawnPointIndexForFlags:(BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound +-(NSInteger)extremeDrawnPointIndexForFlags:(nonnull BOOL *)pointDrawFlags numberOfPoints:(NSUInteger)dataCount extremeNumIsLowerBound:(BOOL)isLowerBound { NSInteger result = NSNotFound; NSInteger delta = (isLowerBound ? 1 : -1); @@ -643,7 +689,7 @@ -(NSInteger)extremeDrawnPointIndexForFlags:(BOOL *)pointDrawFlags numberOfPoints result = i; break; } - if ( (delta < 0) && (i == 0) ) { + if ((delta < 0) && (i == 0)) { break; } } @@ -672,19 +718,19 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point -(NSUInteger)indexOfVisiblePointClosestToPlotAreaPoint:(CGPoint)viewPoint { NSUInteger dataCount = self.cachedDataCount; - CGPoint *viewPoints = calloc( dataCount, sizeof(CGPoint) ); - BOOL *drawPointFlags = calloc( dataCount, sizeof(BOOL) ); + CGPoint *viewPoints = calloc(dataCount, sizeof(CGPoint)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); - [self calculatePointsToDraw:drawPointFlags forPlotSpace:(id)self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:dataCount]; + [self calculatePointsToDraw:drawPointFlags forPlotSpace:(CPTXYPlotSpace *)self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:dataCount]; [self calculateViewPoints:viewPoints withDrawPointFlags:drawPointFlags numberOfPoints:dataCount]; NSInteger result = [self extremeDrawnPointIndexForFlags:drawPointFlags numberOfPoints:dataCount extremeNumIsLowerBound:YES]; if ( result != NSNotFound ) { - CGFloat minimumDistanceSquared = NAN; + CGFloat minimumDistanceSquared = CPTNAN; for ( NSUInteger i = (NSUInteger)result; i < dataCount; ++i ) { if ( drawPointFlags[i] ) { CGFloat distanceSquared = squareOfDistanceBetweenPoints(viewPoint, viewPoints[i]); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = (NSInteger)i; } @@ -732,7 +778,7 @@ -(CGPoint)plotAreaPointOfVisiblePointAtIndex:(NSUInteger)idx /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -741,14 +787,14 @@ -(void)renderAsVectorInContext:(CGContextRef)context CPTMutableNumericData *xValueData = [self cachedNumbersForField:CPTScatterPlotFieldX]; CPTMutableNumericData *yValueData = [self cachedNumbersForField:CPTScatterPlotFieldY]; - if ( (xValueData == nil) || (yValueData == nil) ) { + if ((xValueData == nil) || (yValueData == nil)) { return; } NSUInteger dataCount = self.cachedDataCount; if ( dataCount == 0 ) { return; } - if ( !(self.dataLineStyle || self.areaFill || self.areaFill2 || self.plotSymbol || self.plotSymbols.count) ) { + if ( !(self.dataLineStyle || self.areaFill || self.areaFill2 || self.plotSymbol || self.plotSymbols.count)) { return; } if ( xValueData.numberOfSamples != yValueData.numberOfSamples ) { @@ -758,8 +804,8 @@ -(void)renderAsVectorInContext:(CGContextRef)context [super renderAsVectorInContext:context]; // Calculate view points, and align to user space - CGPoint *viewPoints = malloc( dataCount * sizeof(CGPoint) ); - BOOL *drawPointFlags = malloc( dataCount * sizeof(BOOL) ); + CGPoint *viewPoints = calloc(dataCount, sizeof(CGPoint)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)self.plotSpace; [self calculatePointsToDraw:drawPointFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:dataCount]; @@ -767,7 +813,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context BOOL pixelAlign = self.alignsPointsToPixels; if ( pixelAlign ) { - [self alignViewPointsToUserSpace:viewPoints withContent:context drawPointFlags:drawPointFlags numberOfPoints:dataCount]; + [self alignViewPointsToUserSpace:viewPoints withContext:context drawPointFlags:drawPointFlags numberOfPoints:dataCount]; } // Get extreme points @@ -775,11 +821,11 @@ -(void)renderAsVectorInContext:(CGContextRef)context NSInteger firstDrawnPointIndex = [self extremeDrawnPointIndexForFlags:drawPointFlags numberOfPoints:dataCount extremeNumIsLowerBound:YES]; if ( firstDrawnPointIndex != NSNotFound ) { - NSRange viewIndexRange = NSMakeRange( (NSUInteger)firstDrawnPointIndex, (NSUInteger)(lastDrawnPointIndex - firstDrawnPointIndex + 1) ); + NSRange viewIndexRange = NSMakeRange((NSUInteger)firstDrawnPointIndex, (NSUInteger)(lastDrawnPointIndex - firstDrawnPointIndex + 1)); - CPTPlotArea *thePlotArea = self.plotArea; - CPTLineStyle *theLineStyle = self.dataLineStyle; - CPTMutableLimitBandArray fillBands = self.mutableAreaFillBands; + CPTPlotArea *thePlotArea = self.plotArea; + CPTLineStyle *theLineStyle = self.dataLineStyle; + CPTMutableLimitBandArray *fillBands = self.mutableAreaFillBands; // Draw fills NSDecimal theAreaBaseValue; @@ -798,10 +844,11 @@ -(void)renderAsVectorInContext:(CGContextRef)context break; default: + theAreaBaseValue = CPTDecimalNaN(); break; } - if ( !NSDecimalIsNotANumber(&theAreaBaseValue) ) { - if ( theFill || ( (i == 0) && fillBands ) ) { + if ( !NSDecimalIsNotANumber(&theAreaBaseValue)) { + if ( theFill || ((i == 0) && fillBands)) { // clear the plot shadow if any--not needed for fills when the plot has a data line if ( theLineStyle ) { CGContextSaveGState(context); @@ -810,7 +857,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context NSNumber *xValue = [xValueData sampleValue:(NSUInteger)firstDrawnPointIndex]; NSDecimal plotPoint[2]; - plotPoint[CPTCoordinateX] = [xValue decimalValue]; + plotPoint[CPTCoordinateX] = xValue.decimalValue; plotPoint[CPTCoordinateY] = theAreaBaseValue; CGPoint baseLinePoint = [self convertPoint:[thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2] fromLayer:thePlotArea]; if ( pixelAlign ) { @@ -826,8 +873,8 @@ -(void)renderAsVectorInContext:(CGContextRef)context } // Draw fill bands - if ( (i == 0) && fillBands ) { - CGFloat height = CPTFloat( CGBitmapContextGetHeight(context) ); + if ((i == 0) && fillBands ) { + CGFloat height = CPTFloat(CGBitmapContextGetHeight(context)); for ( CPTLimitBand *band in fillBands ) { CGContextSaveGState(context); @@ -845,7 +892,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context maxPoint = CPTAlignIntegralPointToUserSpace(context, maxPoint); } - CGContextClipToRect( context, CGRectMake(minPoint.x, 0.0, maxPoint.x - minPoint.x, height) ); + CGContextClipToRect(context, CGRectMake(minPoint.x, 0.0, maxPoint.x - minPoint.x, height)); CGContextBeginPath(context); CGContextAddPath(context, dataLinePath); @@ -866,10 +913,10 @@ -(void)renderAsVectorInContext:(CGContextRef)context // Draw line if ( theLineStyle ) { - CGPathRef dataLinePath = [self newDataLinePathForViewPoints:viewPoints indexRange:viewIndexRange baselineYValue:NAN]; + 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]; } @@ -916,7 +963,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context free(drawPointFlags); } --(CGPathRef)newDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange:(NSRange)indexRange baselineYValue:(CGFloat)baselineYValue +-(nonnull CGPathRef)newDataLinePathForViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange baselineYValue:(CGFloat)baselineYValue { CPTScatterPlotInterpolation theInterpolation = self.interpolation; @@ -937,9 +984,9 @@ -(CGPathRef)newDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange:(NSRan for ( NSUInteger i = indexRange.location; i <= lastDrawnPointIndex; i++ ) { CGPoint viewPoint = viewPoints[i]; - if ( isnan(viewPoint.x) || isnan(viewPoint.y) ) { + if ( isnan(viewPoint.x) || isnan(viewPoint.y)) { if ( !lastPointSkipped ) { - if ( !isnan(baselineYValue) ) { + if ( !isnan(baselineYValue)) { CGPathAddLineToPoint(dataLinePath, NULL, lastPoint.x, baselineYValue); CGPathAddLineToPoint(dataLinePath, NULL, firstPoint.x, baselineYValue); CGPathCloseSubpath(dataLinePath); @@ -986,7 +1033,7 @@ -(CGPathRef)newDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange:(NSRan } } - if ( !lastPointSkipped && !isnan(baselineYValue) ) { + if ( !lastPointSkipped && !isnan(baselineYValue)) { CGPathAddLineToPoint(dataLinePath, NULL, lastPoint.x, baselineYValue); CGPathAddLineToPoint(dataLinePath, NULL, firstPoint.x, baselineYValue); CGPathCloseSubpath(dataLinePath); @@ -995,7 +1042,7 @@ -(CGPathRef)newDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange:(NSRan return dataLinePath; } --(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange:(NSRange)indexRange baselineYValue:(CGFloat)baselineYValue +-(nonnull CGPathRef)newCurvedDataLinePathForViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange baselineYValue:(CGFloat)baselineYValue { CGMutablePathRef dataLinePath = CGPathCreateMutable(); BOOL lastPointSkipped = YES; @@ -1004,9 +1051,11 @@ -(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange: NSUInteger firstIndex = indexRange.location; NSUInteger lastDrawnPointIndex = NSMaxRange(indexRange); + CPTScatterPlotCurvedInterpolationOption interpolationOption = self.curvedInterpolationOption; + if ( lastDrawnPointIndex > 0 ) { - CGPoint *controlPoints1 = calloc( lastDrawnPointIndex, sizeof(CGPoint) ); - CGPoint *controlPoints2 = calloc( lastDrawnPointIndex, sizeof(CGPoint) ); + CGPoint *controlPoints1 = calloc(lastDrawnPointIndex, sizeof(CGPoint)); + CGPoint *controlPoints2 = calloc(lastDrawnPointIndex, sizeof(CGPoint)); lastDrawnPointIndex--; @@ -1014,12 +1063,56 @@ -(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange: for ( NSUInteger i = indexRange.location; i <= lastDrawnPointIndex; i++ ) { CGPoint viewPoint = viewPoints[i]; - if ( isnan(viewPoint.x) || isnan(viewPoint.y) ) { + if ( isnan(viewPoint.x) || isnan(viewPoint.y)) { if ( !lastPointSkipped ) { - [self computeControlPoints:controlPoints1 - points2:controlPoints2 - forViewPoints:viewPoints - indexRange:NSMakeRange(firstIndex, i - firstIndex)]; + switch ( interpolationOption ) { + case CPTScatterPlotCurvedInterpolationNormal: + [self computeBezierControlPoints:controlPoints1 + points2:controlPoints2 + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, i - firstIndex)]; + break; + + case CPTScatterPlotCurvedInterpolationCatmullRomUniform: + [self computeCatmullRomControlPoints:controlPoints1 + points2:controlPoints2 + withAlpha:CPTFloat(0.0) + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, i - firstIndex)]; + break; + + case CPTScatterPlotCurvedInterpolationCatmullRomCentripetal: + [self computeCatmullRomControlPoints:controlPoints1 + points2:controlPoints2 + withAlpha:CPTFloat(0.5) + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, i - firstIndex)]; + break; + + case CPTScatterPlotCurvedInterpolationCatmullRomChordal: + [self computeCatmullRomControlPoints:controlPoints1 + points2:controlPoints2 + withAlpha:CPTFloat(1.0) + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, i - firstIndex)]; + + break; + + case CPTScatterPlotCurvedInterpolationHermiteCubic: + [self computeHermiteControlPoints:controlPoints1 + points2:controlPoints2 + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, i - firstIndex)]; + break; + + case CPTScatterPlotCurvedInterpolationCatmullCustomAlpha: + [self computeCatmullRomControlPoints:controlPoints1 + points2:controlPoints2 + withAlpha:self.curvedInterpolationCustomAlpha + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, i - firstIndex)]; + break; + } lastPointSkipped = YES; } @@ -1033,10 +1126,55 @@ -(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange: } if ( !lastPointSkipped ) { - [self computeControlPoints:controlPoints1 - points2:controlPoints2 - forViewPoints:viewPoints - indexRange:NSMakeRange(firstIndex, NSMaxRange(indexRange) - firstIndex)]; + switch ( interpolationOption ) { + case CPTScatterPlotCurvedInterpolationNormal: + [self computeBezierControlPoints:controlPoints1 + points2:controlPoints2 + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, NSMaxRange(indexRange) - firstIndex)]; + break; + + case CPTScatterPlotCurvedInterpolationCatmullRomUniform: + [self computeCatmullRomControlPoints:controlPoints1 + points2:controlPoints2 + withAlpha:CPTFloat(0.0) + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, NSMaxRange(indexRange) - firstIndex)]; + + break; + + case CPTScatterPlotCurvedInterpolationCatmullRomCentripetal: + [self computeCatmullRomControlPoints:controlPoints1 + points2:controlPoints2 + withAlpha:CPTFloat(0.5) + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, NSMaxRange(indexRange) - firstIndex)]; + break; + + case CPTScatterPlotCurvedInterpolationCatmullRomChordal: + [self computeCatmullRomControlPoints:controlPoints1 + points2:controlPoints2 + withAlpha:CPTFloat(1.0) + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, NSMaxRange(indexRange) - firstIndex)]; + + break; + + case CPTScatterPlotCurvedInterpolationHermiteCubic: + [self computeHermiteControlPoints:controlPoints1 + points2:controlPoints2 + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, NSMaxRange(indexRange) - firstIndex)]; + break; + + case CPTScatterPlotCurvedInterpolationCatmullCustomAlpha: + [self computeCatmullRomControlPoints:controlPoints1 + points2:controlPoints2 + withAlpha:self.curvedInterpolationCustomAlpha + forViewPoints:viewPoints + indexRange:NSMakeRange(firstIndex, NSMaxRange(indexRange) - firstIndex)]; + break; + } } // Build the path @@ -1044,9 +1182,9 @@ -(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange: for ( NSUInteger i = indexRange.location; i <= lastDrawnPointIndex; i++ ) { CGPoint viewPoint = viewPoints[i]; - if ( isnan(viewPoint.x) || isnan(viewPoint.y) ) { + if ( isnan(viewPoint.x) || isnan(viewPoint.y)) { if ( !lastPointSkipped ) { - if ( !isnan(baselineYValue) ) { + if ( !isnan(baselineYValue)) { CGPathAddLineToPoint(dataLinePath, NULL, lastPoint.x, baselineYValue); CGPathAddLineToPoint(dataLinePath, NULL, firstPoint.x, baselineYValue); CGPathCloseSubpath(dataLinePath); @@ -1070,13 +1208,13 @@ -(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange: // add the control points CGPathMoveToPoint(dataLinePath, NULL, cp1.x - CPTFloat(5.0), cp1.y); CGPathAddLineToPoint(dataLinePath, NULL, cp1.x + CPTFloat(5.0), cp1.y); - CGPathMoveToPoint( dataLinePath, NULL, cp1.x, cp1.y - CPTFloat(5.0) ); - CGPathAddLineToPoint( dataLinePath, NULL, cp1.x, cp1.y + CPTFloat(5.0) ); + CGPathMoveToPoint(dataLinePath, NULL, cp1.x, cp1.y - CPTFloat(5.0)); + CGPathAddLineToPoint(dataLinePath, NULL, cp1.x, cp1.y + CPTFloat(5.0)); - CGPathMoveToPoint( dataLinePath, NULL, cp2.x - CPTFloat(3.5), cp2.y - CPTFloat(3.5) ); - CGPathAddLineToPoint( dataLinePath, NULL, cp2.x + CPTFloat(3.5), cp2.y + CPTFloat(3.5) ); - CGPathMoveToPoint( dataLinePath, NULL, cp2.x + CPTFloat(3.5), cp2.y - CPTFloat(3.5) ); - CGPathAddLineToPoint( dataLinePath, NULL, cp2.x - CPTFloat(3.5), cp2.y + CPTFloat(3.5) ); + CGPathMoveToPoint(dataLinePath, NULL, cp2.x - CPTFloat(3.5), cp2.y - CPTFloat(3.5)); + CGPathAddLineToPoint(dataLinePath, NULL, cp2.x + CPTFloat(3.5), cp2.y + CPTFloat(3.5)); + CGPathMoveToPoint(dataLinePath, NULL, cp2.x + CPTFloat(3.5), cp2.y - CPTFloat(3.5)); + CGPathAddLineToPoint(dataLinePath, NULL, cp2.x - CPTFloat(3.5), cp2.y + CPTFloat(3.5)); // add a line connecting the control points CGPathMoveToPoint(dataLinePath, NULL, cp1.x, cp1.y); @@ -1091,7 +1229,7 @@ -(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange: } } - if ( !lastPointSkipped && !isnan(baselineYValue) ) { + if ( !lastPointSkipped && !isnan(baselineYValue)) { CGPathAddLineToPoint(dataLinePath, NULL, lastPoint.x, baselineYValue); CGPathAddLineToPoint(dataLinePath, NULL, firstPoint.x, baselineYValue); CGPathCloseSubpath(dataLinePath); @@ -1104,9 +1242,238 @@ -(CGPathRef)newCurvedDataLinePathForViewPoints:(CGPoint *)viewPoints indexRange: return dataLinePath; } +/** @brief Compute the control points using a catmull-rom spline. + * @param points A pointer to the array which should hold the first control points. + * @param points2 A pointer to the array which should hold the second control points. + * @param alpha The alpha value used for the catmull-rom interpolation. + * @param viewPoints A pointer to the array which holds all view points for which the interpolation should be calculated. + * @param indexRange The range in which the interpolation should occur. + * @warning The @par{indexRange} must be valid for all passed arrays otherwise this method crashes. + **/ +-(void)computeCatmullRomControlPoints:(nonnull CGPoint *)points points2:(nonnull CGPoint *)points2 withAlpha:(CGFloat)alpha forViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange +{ + if ( indexRange.length >= 2 ) { + NSUInteger startIndex = indexRange.location; + NSUInteger endIndex = NSMaxRange(indexRange) - 1; // the index starts at zero + NSUInteger segmentCount = endIndex - 1; // there are n - 1 segments + + CGFloat epsilon = CPTFloat(1.0e-5); // the minimum point distance. below that no interpolation happens. + + for ( NSUInteger index = startIndex; index <= segmentCount; index++ ) { + // calculate the control for the segment from index -> index + 1 + CGPoint p0, p1, p2, p3; // the view point + + // the internal points are always valid + p1 = viewPoints[index]; + p2 = viewPoints[index + 1]; + // account for first and last segment + if ( index == startIndex ) { + p0 = p1; + } + else { + p0 = viewPoints[index - 1]; + } + if ( index == segmentCount ) { + p3 = p2; + } + else { + p3 = viewPoints[index + 2]; + } + + // distance between the points + CGFloat d1 = hypot(p1.x - p0.x, p1.y - p0.y); + CGFloat d2 = hypot(p2.x - p1.x, p2.y - p1.y); + CGFloat d3 = hypot(p3.x - p2.x, p3.y - p2.y); + // constants + CGFloat d1_a = pow(d1, alpha); // d1^alpha + CGFloat d2_a = pow(d2, alpha); // d2^alpha + CGFloat d3_a = pow(d3, alpha); // d3^alpha + CGFloat d1_2a = pow(d1_a, CPTFloat(2.0)); // d1^alpha^2 = d1^2*alpha + CGFloat d2_2a = pow(d2_a, CPTFloat(2.0)); // d2^alpha^2 = d2^2*alpha + CGFloat d3_2a = pow(d3_a, CPTFloat(2.0)); // d3^alpha^2 = d3^2*alpha + + // calculate the control points + // see : http://www.cemyuksel.com/research/catmullrom_param/catmullrom.pdf under point 3. + CGPoint cp1, cp2; // the calculated view points; + if ( fabs(d1) <= epsilon ) { + cp1 = p1; + } + else { + CGFloat divisor = CPTFloat(3.0) * d1_a * (d1_a + d2_a); + cp1 = CPTPointMake((p2.x * d1_2a - p0.x * d2_2a + (2 * d1_2a + 3 * d1_a * d2_a + d2_2a) * p1.x) / divisor, + (p2.y * d1_2a - p0.y * d2_2a + (2 * d1_2a + 3 * d1_a * d2_a + d2_2a) * p1.y) / divisor + ); + } + + if ( fabs(d3) <= epsilon ) { + cp2 = p2; + } + else { + CGFloat divisor = 3 * d3_a * (d3_a + d2_a); + cp2 = CPTPointMake((d3_2a * p1.x - d2_2a * p3.x + (2 * d3_2a + 3 * d3_a * d2_a + d2_2a) * p2.x) / divisor, + (d3_2a * p1.y - d2_2a * p3.y + (2 * d3_2a + 3 * d3_a * d2_a + d2_2a) * p2.y) / divisor); + } + + points[index + 1] = cp1; + points2[index + 1] = cp2; + } + } +} + +/** @brief Compute the control points using a hermite cubic spline. + * + * If the view points are monotonically increasing or decreasing in both @par{x} and @par{y}, + * the smoothed curve will be also. + * + * @param points A pointer to the array which should hold the first control points. + * @param points2 A pointer to the array which should hold the second control points. + * @param viewPoints A pointer to the array which holds all view points for which the interpolation should be calculated. + * @param indexRange The range in which the interpolation should occur. + * @warning The @par{indexRange} must be valid for all passed arrays otherwise this method crashes. + **/ +-(void)computeHermiteControlPoints:(nonnull CGPoint *)points points2:(nonnull CGPoint *)points2 forViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange +{ + // See https://en.wikipedia.org/wiki/Cubic_Hermite_spline and https://en.m.wikipedia.org/wiki/Monotone_cubic_interpolation for a discussion of algorithms used. + if ( indexRange.length >= 2 ) { + NSUInteger startIndex = indexRange.location; + NSUInteger lastIndex = NSMaxRange(indexRange) - 1; // last accessible element in view points + + BOOL monotonic = [self monotonicViewPoints:viewPoints indexRange:indexRange]; + + for ( NSUInteger index = startIndex; index <= lastIndex; index++ ) { + CGVector m; + CGPoint p1 = viewPoints[index]; + + if ( index == startIndex ) { + CGPoint p2 = viewPoints[index + 1]; + + m.dx = p2.x - p1.x; + m.dy = p2.y - p1.y; + } + else if ( index == lastIndex ) { + CGPoint p0 = viewPoints[index - 1]; + + m.dx = p1.x - p0.x; + m.dy = p1.y - p0.y; + } + else { // index > startIndex && index < numberOfPoints + CGPoint p0 = viewPoints[index - 1]; + CGPoint p2 = viewPoints[index + 1]; + + m.dx = p2.x - p0.x; + m.dy = p2.y - p0.y; + + if ( monotonic ) { + if ( m.dx > CPTFloat(0.0)) { + m.dx = MIN(p2.x - p1.x, p1.x - p0.x); + } + else if ( m.dx < CPTFloat(0.0)) { + m.dx = MAX(p2.x - p1.x, p1.x - p0.x); + } + + if ( m.dy > CPTFloat(0.0)) { + m.dy = MIN(p2.y - p1.y, p1.y - p0.y); + } + else if ( m.dy < CPTFloat(0.0)) { + m.dy = MAX(p2.y - p1.y, p1.y - p0.y); + } + } + } + + // get control points + m.dx /= CPTFloat(6.0); + m.dy /= CPTFloat(6.0); + + CGPoint rhsControlPoint = CPTPointMake(p1.x + m.dx, p1.y + m.dy); + CGPoint lhsControlPoint = CPTPointMake(p1.x - m.dx, p1.y - m.dy); + + // We calculated the lhs & rhs control point. The rhs control point is the first control point for the curve to the next point. The lhs control point is the second control point for the curve to the current point. + + points2[index] = lhsControlPoint; + if ( index + 1 <= lastIndex ) { + points[index + 1] = rhsControlPoint; + } + } + } +} + +/** @brief Determine whether the plot points form a monotonic series. + * @param viewPoints A pointer to the array which holds all view points for which the interpolation should be calculated. + * @param indexRange The range in which the interpolation should occur. + * @return Returns @YES if the viewpoints are monotonically increasing or decreasing in both @par{x} and @par{y}. + * @warning The @par{indexRange} must be valid for all passed arrays otherwise this method crashes. + **/ +-(BOOL)monotonicViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange +{ + if ( indexRange.length < 2 ) { + return YES; + } + + NSUInteger startIndex = indexRange.location; + NSUInteger lastIndex = NSMaxRange(indexRange) - 2; + + BOOL foundTrendX = NO; + BOOL foundTrendY = NO; + BOOL isIncreasingX = NO; + BOOL isIncreasingY = NO; + + for ( NSUInteger index = startIndex; index <= lastIndex; index++ ) { + CGPoint p1 = viewPoints[index]; + CGPoint p2 = viewPoints[index + 1]; + + if ( !foundTrendX ) { + if ( p2.x > p1.x ) { + isIncreasingX = YES; + foundTrendX = YES; + } + else if ( p2.x < p1.x ) { + foundTrendX = YES; + } + } + + if ( foundTrendX ) { + if ( isIncreasingX ) { + if ( p2.x < p1.x ) { + return NO; + } + } + else { + if ( p2.x > p1.x ) { + return NO; + } + } + } + + if ( !foundTrendY ) { + if ( p2.y > p1.y ) { + isIncreasingY = YES; + foundTrendY = YES; + } + else if ( p2.y < p1.y ) { + foundTrendY = YES; + } + } + + if ( foundTrendY ) { + if ( isIncreasingY ) { + if ( p2.y < p1.y ) { + return NO; + } + } + else { + if ( p2.y > p1.y ) { + return NO; + } + } + } + } + + return YES; +} + // Compute the control points using the algorithm described at http://www.particleincell.com/blog/2012/bezier-splines/ // cp1, cp2, and viewPoints should point to arrays of points with at least NSMaxRange(indexRange) elements each. --(void)computeControlPoints:(CGPoint *)cp1 points2:(CGPoint *)cp2 forViewPoints:(CGPoint *)viewPoints indexRange:(NSRange)indexRange +-(void)computeBezierControlPoints:(nonnull CGPoint *)cp1 points2:(nonnull CGPoint *)cp2 forViewPoints:(nonnull CGPoint *)viewPoints indexRange:(NSRange)indexRange { if ( indexRange.length == 2 ) { NSUInteger rangeEnd = NSMaxRange(indexRange) - 1; @@ -1117,10 +1484,10 @@ -(void)computeControlPoints:(CGPoint *)cp1 points2:(CGPoint *)cp2 forViewPoints: NSUInteger n = indexRange.length - 1; // rhs vector - CGPoint *a = malloc( n * sizeof(CGPoint) ); - CGPoint *b = malloc( n * sizeof(CGPoint) ); - CGPoint *c = malloc( n * sizeof(CGPoint) ); - CGPoint *r = malloc( n * sizeof(CGPoint) ); + CGPoint *a = calloc(n, sizeof(CGPoint)); + CGPoint *b = calloc(n, sizeof(CGPoint)); + CGPoint *c = calloc(n, sizeof(CGPoint)); + CGPoint *r = calloc(n, sizeof(CGPoint)); // left most segment a[0] = CGPointZero; @@ -1167,11 +1534,11 @@ -(void)computeControlPoints:(CGPoint *)cp1 points2:(CGPoint *)cp2 forViewPoints: cp1[indexRange.location + n] = CGPointMake(r[n - 1].x / b[n - 1].x, r[n - 1].y / b[n - 1].y); for ( NSUInteger i = n - 2; i > 0; i-- ) { - cp1[indexRange.location + i + 1] = CGPointMake( (r[i].x - c[i].x * cp1[indexRange.location + i + 2].x) / b[i].x, - (r[i].y - c[i].y * cp1[indexRange.location + i + 2].y) / b[i].y ); + cp1[indexRange.location + i + 1] = CGPointMake((r[i].x - c[i].x * cp1[indexRange.location + i + 2].x) / b[i].x, + (r[i].y - c[i].y * cp1[indexRange.location + i + 2].y) / b[i].y); } - cp1[indexRange.location + 1] = CGPointMake( (r[0].x - c[0].x * cp1[indexRange.location + 2].x) / b[0].x, - (r[0].y - c[0].y * cp1[indexRange.location + 2].y) / b[0].y ); + cp1[indexRange.location + 1] = CGPointMake((r[0].x - c[0].x * cp1[indexRange.location + 2].x) / b[0].x, + (r[0].y - c[0].y * cp1[indexRange.location + 2].y) / b[0].y); // we have p1, now compute p2 NSUInteger rangeEnd = NSMaxRange(indexRange) - 1; @@ -1180,8 +1547,8 @@ -(void)computeControlPoints:(CGPoint *)cp1 points2:(CGPoint *)cp2 forViewPoints: CPTFloat(2.0) * viewPoints[i].y - cp1[i + 1].y); } - cp2[rangeEnd] = CGPointMake( CPTFloat(0.5) * (viewPoints[rangeEnd].x + cp1[rangeEnd].x), - CPTFloat(0.5) * (viewPoints[rangeEnd].y + cp1[rangeEnd].y) ); + cp2[rangeEnd] = CGPointMake(CPTFloat(0.5) * (viewPoints[rangeEnd].x + cp1[rangeEnd].x), + CPTFloat(0.5) * (viewPoints[rangeEnd].y + cp1[rangeEnd].y)); // clean up free(a); @@ -1191,7 +1558,7 @@ -(void)computeControlPoints:(CGPoint *)cp1 points2:(CGPoint *)cp2 forViewPoints: } } --(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(nonnull CGContextRef)context { [super drawSwatchForLegend:legend atIndex:idx inRect:rect inContext:context]; @@ -1201,8 +1568,8 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C if ( theLineStyle ) { [theLineStyle setLineStyleInContext:context]; - CGPoint alignedStartPoint = CPTAlignPointToUserSpace( context, CPTPointMake( CGRectGetMinX(rect), CGRectGetMidY(rect) ) ); - CGPoint alignedEndPoint = CPTAlignPointToUserSpace( context, CPTPointMake( CGRectGetMaxX(rect), CGRectGetMidY(rect) ) ); + CGPoint alignedStartPoint = CPTAlignPointToUserSpace(context, CPTPointMake(CGRectGetMinX(rect), CGRectGetMidY(rect))); + CGPoint alignedEndPoint = CPTAlignPointToUserSpace(context, CPTPointMake(CGRectGetMaxX(rect), CGRectGetMidY(rect))); CGContextMoveToPoint(context, alignedStartPoint.x, alignedStartPoint.y); CGContextAddLineToPoint(context, alignedEndPoint.x, alignedEndPoint.y); @@ -1213,7 +1580,7 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C if ( thePlotSymbol ) { [thePlotSymbol renderInContext:context - atPoint:CPTPointMake( CGRectGetMidX(rect), CGRectGetMidY(rect) ) + atPoint:CPTPointMake(CGRectGetMidX(rect), CGRectGetMidY(rect)) scale:self.contentsScale alignToPixels:YES]; } @@ -1241,13 +1608,13 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C CGContextAddPath(context, swatchPath); CGContextClip(context); - if ( CPTDecimalGreaterThanOrEqualTo(self.areaBaseValue2.decimalValue, self.areaBaseValue.decimalValue) ) { - [fill1 fillRect:CPTRectMake( CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, rect.size.height / CPTFloat(2.0) ) inContext:context]; - [fill2 fillRect:CPTRectMake( CGRectGetMinX(rect), CGRectGetMidY(rect), rect.size.width, rect.size.height / CPTFloat(2.0) ) inContext:context]; + if ( CPTDecimalGreaterThanOrEqualTo(self.areaBaseValue2.decimalValue, self.areaBaseValue.decimalValue)) { + [fill1 fillRect:CPTRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, rect.size.height / CPTFloat(2.0)) inContext:context]; + [fill2 fillRect:CPTRectMake(CGRectGetMinX(rect), CGRectGetMidY(rect), rect.size.width, rect.size.height / CPTFloat(2.0)) inContext:context]; } else { - [fill2 fillRect:CPTRectMake( CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, rect.size.height / CPTFloat(2.0) ) inContext:context]; - [fill1 fillRect:CPTRectMake( CGRectGetMinX(rect), CGRectGetMidY(rect), rect.size.width, rect.size.height / CPTFloat(2.0) ) inContext:context]; + [fill2 fillRect:CPTRectMake(CGRectGetMinX(rect), CGRectGetMinY(rect), rect.size.width, rect.size.height / CPTFloat(2.0)) inContext:context]; + [fill1 fillRect:CPTRectMake(CGRectGetMinX(rect), CGRectGetMidY(rect), rect.size.width, rect.size.height / CPTFloat(2.0)) inContext:context]; } CGContextRestoreGState(context); @@ -1259,7 +1626,7 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C } } --(CGPathRef)newDataLinePath +-(nonnull CGPathRef)newDataLinePath { [self reloadDataIfNeeded]; @@ -1269,8 +1636,8 @@ -(CGPathRef)newDataLinePath } // Calculate view points - CGPoint *viewPoints = malloc( dataCount * sizeof(CGPoint) ); - BOOL *drawPointFlags = malloc( dataCount * sizeof(BOOL) ); + CGPoint *viewPoints = calloc(dataCount, sizeof(CGPoint)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); for ( NSUInteger i = 0; i < dataCount; i++ ) { drawPointFlags[i] = YES; @@ -1281,7 +1648,7 @@ -(CGPathRef)newDataLinePath // Create the path CGPathRef dataLinePath = [self newDataLinePathForViewPoints:viewPoints indexRange:NSMakeRange(0, dataCount) - baselineYValue:NAN]; + baselineYValue:CPTNAN]; free(viewPoints); free(drawPointFlags); @@ -1296,7 +1663,7 @@ -(CGPathRef)newDataLinePath /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken; @@ -1316,6 +1683,61 @@ +(BOOL)needsDisplayForKey:(NSString *)aKey /// @endcond +#pragma mark - +#pragma mark Data Ranges + +/// @cond + +-(nullable CPTPlotRange *)plotRangeEnclosingField:(NSUInteger)fieldEnum +{ + CPTPlotRange *range = [self plotRangeForField:fieldEnum]; + + if ( self.interpolation == CPTScatterPlotInterpolationCurved ) { + CPTPlotSpace *space = self.plotSpace; + + if ( space ) { + CGPathRef dataLinePath = self.newDataLinePath; + + CGRect boundingBox = CGPathGetBoundingBox(dataLinePath); + + CGPathRelease(dataLinePath); + + CPTNumberArray *lowerLeft = [space plotPointForPlotAreaViewPoint:boundingBox.origin]; + CPTNumberArray *upperRight = [space plotPointForPlotAreaViewPoint:CGPointMake(CGRectGetMaxX(boundingBox), + CGRectGetMaxY(boundingBox))]; + + switch ( fieldEnum ) { + case CPTScatterPlotFieldX: + { + NSNumber *length = [NSDecimalNumber decimalNumberWithDecimal: + CPTDecimalSubtract(upperRight[CPTCoordinateX].decimalValue, + lowerLeft[CPTCoordinateX].decimalValue)]; + range = [CPTPlotRange plotRangeWithLocation:lowerLeft[CPTCoordinateX] + length:length]; + } + break; + + case CPTScatterPlotFieldY: + { + NSNumber *length = [NSDecimalNumber decimalNumberWithDecimal: + CPTDecimalSubtract(upperRight[CPTCoordinateY].decimalValue, + lowerLeft[CPTCoordinateY].decimalValue)]; + range = [CPTPlotRange plotRangeWithLocation:lowerLeft[CPTCoordinateY] + length:length]; + } + break; + + default: + break; + } + } + } + + return range; +} + +/// @endcond + #pragma mark - #pragma mark Fields @@ -1326,23 +1748,23 @@ -(NSUInteger)numberOfFields return 2; } --(CPTNumberArray)fieldIdentifiers +-(nonnull CPTNumberArray *)fieldIdentifiers { return @[@(CPTScatterPlotFieldX), @(CPTScatterPlotFieldY)]; } --(CPTNumberArray)fieldIdentifiersForCoordinate:(CPTCoordinate)coord +-(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord { - CPTNumberArray result = nil; + CPTNumberArray *result = nil; switch ( coord ) { case CPTCoordinateX: result = @[@(CPTScatterPlotFieldX)]; - break; + break; case CPTCoordinateY: result = @[@(CPTScatterPlotFieldY)]; - break; + break; default: [NSException raise:CPTException format:@"Invalid coordinate passed to fieldIdentifiersForCoordinate:"]; @@ -1378,7 +1800,7 @@ -(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field /// @cond --(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx +-(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx { NSNumber *xValue = [self cachedNumberForField:CPTScatterPlotFieldX recordIndex:idx]; NSNumber *yValue = [self cachedNumberForField:CPTScatterPlotFieldY recordIndex:idx]; @@ -1386,7 +1808,7 @@ -(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInte BOOL positiveDirection = YES; CPTPlotRange *yRange = [self.plotSpace plotRangeForCoordinate:CPTCoordinateY]; - if ( CPTDecimalLessThan( yRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalLessThan(yRange.lengthDecimal, CPTDecimalFromInteger(0))) { positiveDirection = !positiveDirection; } @@ -1412,14 +1834,15 @@ -(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInte * * @param limitBand The new limit band. **/ --(void)addAreaFillBand:(CPTLimitBand *)limitBand +-(void)addAreaFillBand:(nullable CPTLimitBand *)limitBand { if ( [limitBand isKindOfClass:[CPTLimitBand class]] ) { if ( !self.mutableAreaFillBands ) { self.mutableAreaFillBands = [NSMutableArray array]; } - [self.mutableAreaFillBands addObject:limitBand]; + CPTLimitBand *band = limitBand; + [self.mutableAreaFillBands addObject:band]; [self setNeedsDisplay]; } @@ -1428,12 +1851,14 @@ -(void)addAreaFillBand:(CPTLimitBand *)limitBand /** @brief Remove an area fill limit band. * @param limitBand The limit band to be removed. **/ --(void)removeAreaFillBand:(CPTLimitBand *)limitBand +-(void)removeAreaFillBand:(nullable CPTLimitBand *)limitBand { if ( limitBand ) { - CPTMutableLimitBandArray fillBands = self.mutableAreaFillBands; + CPTMutableLimitBandArray *fillBands = self.mutableAreaFillBands; + + CPTLimitBand *band = limitBand; + [fillBands removeObject:band]; - [fillBands removeObject:limitBand]; if ( fillBands.count == 0 ) { self.mutableAreaFillBands = nil; } @@ -1477,7 +1902,7 @@ -(void)removeAreaFillBand:(CPTLimitBand *)limitBand * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { self.pointingDeviceDownIndex = NSNotFound; self.pointingDeviceDownOnLine = NO; @@ -1489,7 +1914,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; BOOL symbolTouchUpHandled = NO; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchDownAtRecordIndex:)] || @@ -1514,9 +1939,9 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact CGFloat margin = self.plotSymbolMarginForHitDetection * CPTFloat(2.0); symbolRect.size.width += margin; symbolRect.size.height += margin; - symbolRect.origin = CPTPointMake( center.x - CPTFloat(0.5) * CGRectGetWidth(symbolRect), center.y - CPTFloat(0.5) * CGRectGetHeight(symbolRect) ); + symbolRect.origin = CPTPointMake(center.x - CPTFloat(0.5) * CGRectGetWidth(symbolRect), center.y - CPTFloat(0.5) * CGRectGetHeight(symbolRect)); - if ( CGRectContainsPoint(symbolRect, plotAreaPoint) ) { + if ( CGRectContainsPoint(symbolRect, plotAreaPoint)) { self.pointingDeviceDownIndex = idx; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchDownAtRecordIndex:)] ) { @@ -1539,7 +1964,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact ([theDelegate respondsToSelector:@selector(scatterPlotDataLineTouchDown:)] || [theDelegate respondsToSelector:@selector(scatterPlot:dataLineTouchDownWithEvent:)] || [theDelegate respondsToSelector:@selector(scatterPlotDataLineWasSelected:)] || - [theDelegate respondsToSelector:@selector(scatterPlot:dataLineWasSelectedWithEvent:)]) ) { + [theDelegate respondsToSelector:@selector(scatterPlot:dataLineWasSelectedWithEvent:)])) { plotSelected = [self plotWasLineHitByInteractionPoint:interactionPoint]; if ( plotSelected ) { // Let the delegate know that the plot was selected. @@ -1592,7 +2017,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { NSUInteger selectedDownIndex = self.pointingDeviceDownIndex; @@ -1606,7 +2031,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio return NO; } - id theDelegate = self.delegate; + id theDelegate = (id)self.delegate; BOOL symbolSelectHandled = NO; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchUpAtRecordIndex:)] || @@ -1631,9 +2056,9 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio CGFloat margin = self.plotSymbolMarginForHitDetection * CPTFloat(2.0); symbolRect.size.width += margin; symbolRect.size.height += margin; - symbolRect.origin = CPTPointMake( center.x - CPTFloat(0.5) * CGRectGetWidth(symbolRect), center.y - CPTFloat(0.5) * CGRectGetHeight(symbolRect) ); + symbolRect.origin = CPTPointMake(center.x - CPTFloat(0.5) * CGRectGetWidth(symbolRect), center.y - CPTFloat(0.5) * CGRectGetHeight(symbolRect)); - if ( CGRectContainsPoint(symbolRect, plotAreaPoint) ) { + if ( CGRectContainsPoint(symbolRect, plotAreaPoint)) { self.pointingDeviceDownIndex = idx; if ( [theDelegate respondsToSelector:@selector(scatterPlot:plotSymbolTouchUpAtRecordIndex:)] ) { @@ -1668,7 +2093,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio ([theDelegate respondsToSelector:@selector(scatterPlotDataLineTouchUp:)] || [theDelegate respondsToSelector:@selector(scatterPlot:dataLineTouchUpWithEvent:)] || [theDelegate respondsToSelector:@selector(scatterPlotDataLineWasSelected:)] || - [theDelegate respondsToSelector:@selector(scatterPlot:dataLineWasSelectedWithEvent:)]) ) { + [theDelegate respondsToSelector:@selector(scatterPlot:dataLineWasSelectedWithEvent:)])) { plotSelected = [self plotWasLineHitByInteractionPoint:interactionPoint]; if ( plotSelected ) { @@ -1712,8 +2137,8 @@ -(BOOL)plotWasLineHitByInteractionPoint:(CGPoint)interactionPoint NSUInteger dataCount = self.cachedDataCount; if ( theGraph && thePlotArea && !self.hidden && dataCount ) { - CGPoint *viewPoints = malloc( dataCount * sizeof(CGPoint) ); - BOOL *drawPointFlags = malloc( dataCount * sizeof(BOOL) ); + CGPoint *viewPoints = calloc(dataCount, sizeof(CGPoint)); + BOOL *drawPointFlags = calloc(dataCount, sizeof(BOOL)); CPTXYPlotSpace *thePlotSpace = (CPTXYPlotSpace *)self.plotSpace; [self calculatePointsToDraw:drawPointFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:dataCount]; @@ -1723,14 +2148,14 @@ -(BOOL)plotWasLineHitByInteractionPoint:(CGPoint)interactionPoint if ( firstDrawnPointIndex != NSNotFound ) { NSInteger lastDrawnPointIndex = [self extremeDrawnPointIndexForFlags:drawPointFlags numberOfPoints:dataCount extremeNumIsLowerBound:NO]; - NSRange viewIndexRange = NSMakeRange( (NSUInteger)firstDrawnPointIndex, (NSUInteger)(lastDrawnPointIndex - firstDrawnPointIndex + 1) ); - CGPathRef dataLinePath = [self newDataLinePathForViewPoints:viewPoints indexRange:viewIndexRange baselineYValue:NAN]; - CGPathRef path = CGPathCreateCopyByStrokingPath( dataLinePath, - NULL, - self.plotLineMarginForHitDetection * CPTFloat(2.0), - kCGLineCapRound, - kCGLineJoinRound, - CPTFloat(3.0) ); + NSRange viewIndexRange = NSMakeRange((NSUInteger)firstDrawnPointIndex, (NSUInteger)(lastDrawnPointIndex - firstDrawnPointIndex + 1)); + CGPathRef dataLinePath = [self newDataLinePathForViewPoints:viewPoints indexRange:viewIndexRange baselineYValue:CPTNAN]; + CGPathRef path = CGPathCreateCopyByStrokingPath(dataLinePath, + NULL, + self.plotLineMarginForHitDetection * CPTFloat(2.0), + kCGLineCapRound, + kCGLineJoinRound, + CPTFloat(3.0)); CGPoint plotAreaPoint = [theGraph convertPoint:interactionPoint toLayer:thePlotArea]; @@ -1769,7 +2194,30 @@ -(void)setHistogramOption:(CPTScatterPlotHistogramOption)newHistogramOption } } --(void)setPlotSymbol:(CPTPlotSymbol *)aSymbol +-(void)setCurvedInterpolationOption:(CPTScatterPlotCurvedInterpolationOption)newCurvedInterpolationOption +{ + if ( newCurvedInterpolationOption != curvedInterpolationOption ) { + curvedInterpolationOption = newCurvedInterpolationOption; + [self setNeedsDisplay]; + } +} + +-(void)setCurvedInterpolationCustomAlpha:(CGFloat)newCurvedInterpolationCustomAlpha +{ + if ( newCurvedInterpolationCustomAlpha > CPTFloat(1.0)) { + newCurvedInterpolationCustomAlpha = CPTFloat(1.0); + } + if ( newCurvedInterpolationCustomAlpha < CPTFloat(0.0)) { + newCurvedInterpolationCustomAlpha = CPTFloat(0.0); + } + + if ( newCurvedInterpolationCustomAlpha != curvedInterpolationCustomAlpha ) { + curvedInterpolationCustomAlpha = newCurvedInterpolationCustomAlpha; + [self setNeedsDisplay]; + } +} + +-(void)setPlotSymbol:(nullable CPTPlotSymbol *)aSymbol { if ( aSymbol != plotSymbol ) { plotSymbol = [aSymbol copy]; @@ -1778,7 +2226,7 @@ -(void)setPlotSymbol:(CPTPlotSymbol *)aSymbol } } --(void)setDataLineStyle:(CPTLineStyle *)newLineStyle +-(void)setDataLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( dataLineStyle != newLineStyle ) { dataLineStyle = [newLineStyle copy]; @@ -1787,7 +2235,7 @@ -(void)setDataLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setAreaFill:(CPTFill *)newFill +-(void)setAreaFill:(nullable CPTFill *)newFill { if ( newFill != areaFill ) { areaFill = [newFill copy]; @@ -1796,7 +2244,7 @@ -(void)setAreaFill:(CPTFill *)newFill } } --(void)setAreaFill2:(CPTFill *)newFill +-(void)setAreaFill2:(nullable CPTFill *)newFill { if ( newFill != areaFill2 ) { areaFill2 = [newFill copy]; @@ -1805,17 +2253,18 @@ -(void)setAreaFill2:(CPTFill *)newFill } } --(CPTLimitBandArray)areaFillBands +-(nullable CPTLimitBandArray *)areaFillBands { return [self.mutableAreaFillBands copy]; } --(void)setAreaBaseValue:(NSNumber *)newAreaBaseValue +-(void)setAreaBaseValue:(nullable NSNumber *)newAreaBaseValue { BOOL needsUpdate = YES; if ( newAreaBaseValue ) { - needsUpdate = ![areaBaseValue isEqualToNumber:newAreaBaseValue]; + NSNumber *baseValue = newAreaBaseValue; + needsUpdate = ![areaBaseValue isEqualToNumber:baseValue]; } if ( needsUpdate ) { @@ -1825,12 +2274,13 @@ -(void)setAreaBaseValue:(NSNumber *)newAreaBaseValue } } --(void)setAreaBaseValue2:(NSNumber *)newAreaBaseValue +-(void)setAreaBaseValue2:(nullable NSNumber *)newAreaBaseValue { BOOL needsUpdate = YES; if ( newAreaBaseValue ) { - needsUpdate = ![areaBaseValue2 isEqualToNumber:newAreaBaseValue]; + NSNumber *baseValue = newAreaBaseValue; + needsUpdate = ![areaBaseValue2 isEqualToNumber:baseValue]; } if ( needsUpdate ) { @@ -1840,33 +2290,33 @@ -(void)setAreaBaseValue2:(NSNumber *)newAreaBaseValue } } --(void)setXValues:(CPTNumberArray)newValues +-(void)setXValues:(nullable CPTNumberArray *)newValues { [self cacheNumbers:newValues forField:CPTScatterPlotFieldX]; } --(CPTNumberArray)xValues +-(nullable CPTNumberArray *)xValues { return [[self cachedNumbersForField:CPTScatterPlotFieldX] sampleArray]; } --(void)setYValues:(CPTNumberArray)newValues +-(void)setYValues:(nullable CPTNumberArray *)newValues { [self cacheNumbers:newValues forField:CPTScatterPlotFieldY]; } --(CPTNumberArray)yValues +-(nullable CPTNumberArray *)yValues { return [[self cachedNumbersForField:CPTScatterPlotFieldY] sampleArray]; } --(void)setPlotSymbols:(CPTPlotSymbolArray)newSymbols +-(void)setPlotSymbols:(nullable CPTPlotSymbolArray *)newSymbols { [self cacheArray:newSymbols forKey:CPTScatterPlotBindingPlotSymbols]; [self setNeedsDisplay]; } --(CPTPlotSymbolArray)plotSymbols +-(nullable CPTPlotSymbolArray *)plotSymbols { return [self cachedArrayForKey:CPTScatterPlotBindingPlotSymbols]; } diff --git a/framework/Source/CPTScatterPlotTests.h b/framework/Source/CPTScatterPlotTests.h index 14c954c5c..994599bdd 100644 --- a/framework/Source/CPTScatterPlotTests.h +++ b/framework/Source/CPTScatterPlotTests.h @@ -5,7 +5,7 @@ @interface CPTScatterPlotTests : CPTTestCase -@property (nonatomic, readwrite, strong) CPTScatterPlot *plot; -@property (nonatomic, readwrite, strong) CPTXYPlotSpace *plotSpace; +@property (nonatomic, readwrite, strong, nullable) CPTScatterPlot *plot; +@property (nonatomic, readwrite, strong, nullable) CPTXYPlotSpace *plotSpace; @end diff --git a/framework/Source/CPTScatterPlotTests.m b/framework/Source/CPTScatterPlotTests.m index aca7fc1f7..5cecafe5b 100644 --- a/framework/Source/CPTScatterPlotTests.m +++ b/framework/Source/CPTScatterPlotTests.m @@ -6,9 +6,9 @@ @interface CPTScatterPlot(Testing) --(void)calculatePointsToDraw:(BOOL *)pointDrawFlags forPlotSpace:(CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly numberOfPoints:(NSUInteger)dataCount; --(void)setXValues:(CPTNumberArray)newValues; --(void)setYValues:(CPTNumberArray)newValues; +-(void)calculatePointsToDraw:(nonnull BOOL *)pointDrawFlags forPlotSpace:(nonnull CPTXYPlotSpace *)xyPlotSpace includeVisiblePointsOnly:(BOOL)visibleOnly numberOfPoints:(NSUInteger)dataCount; +-(void)setXValues:(nullable CPTNumberArray *)newValues; +-(void)setYValues:(nullable CPTNumberArray *)newValues; @end @@ -19,13 +19,9 @@ @implementation CPTScatterPlotTests -(void)setUp { - double values[5] = { 0.5, 0.5, 0.5, 0.5, 0.5 }; + CPTNumberArray *yValues = @[@0.5, @0.5, @0.5, @0.5, @0.5]; self.plot = [CPTScatterPlot new]; - CPTMutableNumberArray yValues = [NSMutableArray array]; - for ( NSInteger i = 0; i < 5; i++ ) { - [yValues addObject:@(values[i])]; - } [self.plot setYValues:yValues]; self.plot.cachePrecision = CPTPlotCachePrecisionDouble; @@ -44,194 +40,209 @@ -(void)tearDown -(void)testCalculatePointsToDrawAllInRange { - BOOL drawFlags[5]; - double inRangeValues[5] = { 0.1, 0.2, 0.15, 0.6, 0.9 }; + CPTNumberArray *inRangeValues = @[@0.1, @0.2, @0.15, @0.6, @0.9]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:NO numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { - XCTAssertTrue(drawFlags[i], @"Test that in range points are drawn (%g).", inRangeValues[i]); + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { + XCTAssertTrue(drawFlags[i], @"Test that in range points are drawn (%@).", inRangeValues[i]); } + + free(drawFlags); } -(void)testCalculatePointsToDrawAllInRangeVisibleOnly { - BOOL drawFlags[5]; - double inRangeValues[5] = { 0.1, 0.2, 0.15, 0.6, 0.9 }; + CPTNumberArray *inRangeValues = @[@0.1, @0.2, @0.15, @0.6, @0.9]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { - XCTAssertTrue(drawFlags[i], @"Test that in range points are drawn (%g).", inRangeValues[i]); + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:YES numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { + XCTAssertTrue(drawFlags[i], @"Test that in range points are drawn (%@).", inRangeValues[i]); } + + free(drawFlags); } -(void)testCalculatePointsToDrawNoneInRange { - BOOL drawFlags[5]; - double inRangeValues[5] = { -0.1, -0.2, -0.15, -0.6, -0.9 }; + CPTNumberArray *inRangeValues = @[@(-0.1), @(-0.2), @(-0.15), @(-0.6), @(-0.9)]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:NO numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { - XCTAssertFalse(drawFlags[i], @"Test that out of range points are not drawn (%g).", inRangeValues[i]); + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { + XCTAssertFalse(drawFlags[i], @"Test that out of range points are not drawn (%@).", inRangeValues[i]); } + + free(drawFlags); } -(void)testCalculatePointsToDrawNoneInRangeVisibleOnly { - BOOL drawFlags[5]; - double inRangeValues[5] = { -0.1, -0.2, -0.15, -0.6, -0.9 }; + CPTNumberArray *inRangeValues = @[@(-0.1), @(-0.2), @(-0.15), @(-0.6), @(-0.9)]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { - XCTAssertFalse(drawFlags[i], @"Test that out of range points are not drawn (%g).", inRangeValues[i]); + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:YES numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { + XCTAssertFalse(drawFlags[i], @"Test that out of range points are not drawn (%@).", inRangeValues[i]); } + + free(drawFlags); } -(void)testCalculatePointsToDrawNoneInRangeDifferentRegions { - BOOL drawFlags[5]; - double inRangeValues[5] = { -0.1, 2, -0.15, 3, -0.9 }; + CPTNumberArray *inRangeValues = @[@(-0.1), @2, @(-0.15), @3, @(-0.9)]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:NO numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { - XCTAssertTrue(drawFlags[i], @"Test that out of range points in different regions get included (%g).", inRangeValues[i]); + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { + XCTAssertTrue(drawFlags[i], @"Test that out of range points in different regions get included (%@).", inRangeValues[i]); } + + free(drawFlags); } -(void)testCalculatePointsToDrawNoneInRangeDifferentRegionsVisibleOnly { - BOOL drawFlags[5]; - double inRangeValues[5] = { -0.1, 2, -0.15, 3, -0.9 }; + CPTNumberArray *inRangeValues = @[@(-0.1), @2, @(-0.15), @3, @(-0.9)]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { - XCTAssertFalse(drawFlags[i], @"Test that out of range points in different regions get included (%g).", inRangeValues[i]); + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:YES numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { + XCTAssertFalse(drawFlags[i], @"Test that out of range points in different regions get included (%@).", inRangeValues[i]); } + + free(drawFlags); } -(void)testCalculatePointsToDrawSomeInRange { - BOOL drawFlags[5]; - double inRangeValues[5] = { -0.1, 0.1, 0.2, 1.2, 1.5 }; - BOOL expected[5] = { YES, YES, YES, YES, NO }; + CPTNumberArray *inRangeValues = @[@(-0.1), @0.1, @0.2, @1.2, @1.5]; + BOOL expected[5] = { YES, YES, YES, YES, NO }; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:NO numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:inRangeValues.count]; + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { if ( expected[i] ) { - XCTAssertTrue(drawFlags[i], @"Test that correct points included when some are in range, others out (%g).", inRangeValues[i]); + XCTAssertTrue(drawFlags[i], @"Test that correct points included when some are in range, others out (%@).", inRangeValues[i]); } else { - XCTAssertFalse(drawFlags[i], @"Test that correct points included when some are in range, others out (%g).", inRangeValues[i]); + XCTAssertFalse(drawFlags[i], @"Test that correct points included when some are in range, others out (%@).", inRangeValues[i]); } } + + free(drawFlags); } -(void)testCalculatePointsToDrawSomeInRangeVisibleOnly { - BOOL drawFlags[5]; - double inRangeValues[5] = { -0.1, 0.1, 0.2, 1.2, 1.5 }; + CPTNumberArray *inRangeValues = @[@(-0.1), @0.1, @0.2, @1.2, @1.5]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { - if ( [self.plotSpace.xRange compareToNumber:@(inRangeValues[i])] == CPTPlotRangeComparisonResultNumberInRange ) { - XCTAssertTrue(drawFlags[i], @"Test that correct points included when some are in range, others out (%g).", inRangeValues[i]); + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:YES numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { + if ( [self.plotSpace.xRange compareToNumber:inRangeValues[i]] == CPTPlotRangeComparisonResultNumberInRange ) { + XCTAssertTrue(drawFlags[i], @"Test that correct points included when some are in range, others out (%@).", inRangeValues[i]); } else { - XCTAssertFalse(drawFlags[i], @"Test that correct points included when some are in range, others out (%g).", inRangeValues[i]); + XCTAssertFalse(drawFlags[i], @"Test that correct points included when some are in range, others out (%@).", inRangeValues[i]); } } + + free(drawFlags); } -(void)testCalculatePointsToDrawSomeInRangeCrossing { - BOOL drawFlags[5]; - double inRangeValues[5] = { -0.1, 1.1, 0.9, -0.1, -0.2 }; - BOOL expected[5] = { YES, YES, YES, YES, NO }; + CPTNumberArray *inRangeValues = @[@(-0.1), @1.1, @0.9, @(-0.1), @(-0.2)]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); + BOOL *expected = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; + for ( NSUInteger i = 0; i < inRangeValues.count - 1; i++ ) { + expected[i] = YES; } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:NO numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { + expected[inRangeValues.count] = NO; + + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:NO numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { if ( expected[i] ) { - XCTAssertTrue(drawFlags[i], @"Test that correct points included when some are in range, others out, crossing range (%g).", inRangeValues[i]); + XCTAssertTrue(drawFlags[i], @"Test that correct points included when some are in range, others out, crossing range (%@).", inRangeValues[i]); } else { - XCTAssertFalse(drawFlags[i], @"Test that correct points included when some are in range, others out, crossing range (%g).", inRangeValues[i]); + XCTAssertFalse(drawFlags[i], @"Test that correct points included when some are in range, others out, crossing range (%@).", inRangeValues[i]); } } + + free(drawFlags); + free(expected); } -(void)testCalculatePointsToDrawSomeInRangeCrossingVisibleOnly { - BOOL drawFlags[5]; - double inRangeValues[5] = { -0.1, 1.1, 0.9, -0.1, -0.2 }; + CPTNumberArray *inRangeValues = @[@(-0.1), @1.1, @0.9, @(-0.1), @(-0.2)]; - CPTMutableNumberArray values = [NSMutableArray array]; + BOOL *drawFlags = calloc(inRangeValues.count, sizeof(BOOL)); - for ( NSUInteger i = 0; i < 5; i++ ) { - [values addObject:@(inRangeValues[i])]; - } - [self.plot setXValues:values]; - [self.plot calculatePointsToDraw:drawFlags forPlotSpace:self.plotSpace includeVisiblePointsOnly:YES numberOfPoints:values.count]; - for ( NSUInteger i = 0; i < 5; i++ ) { - if ( [self.plotSpace.xRange compareToNumber:@(inRangeValues[i])] == CPTPlotRangeComparisonResultNumberInRange ) { - XCTAssertTrue(drawFlags[i], @"Test that correct points included when some are in range, others out, crossing range (%g).", inRangeValues[i]); + CPTXYPlotSpace *thePlotSpace = self.plotSpace; + + [self.plot setXValues:inRangeValues]; + [self.plot calculatePointsToDraw:drawFlags forPlotSpace:thePlotSpace includeVisiblePointsOnly:YES numberOfPoints:inRangeValues.count]; + + for ( NSUInteger i = 0; i < inRangeValues.count; i++ ) { + if ( [self.plotSpace.xRange compareToNumber:inRangeValues[i]] == CPTPlotRangeComparisonResultNumberInRange ) { + XCTAssertTrue(drawFlags[i], @"Test that correct points included when some are in range, others out, crossing range (%@).", inRangeValues[i]); } else { - XCTAssertFalse(drawFlags[i], @"Test that correct points included when some are in range, others out, crossing range (%g).", inRangeValues[i]); + XCTAssertFalse(drawFlags[i], @"Test that correct points included when some are in range, others out, crossing range (%@).", inRangeValues[i]); } } + + free(drawFlags); } @end diff --git a/framework/Source/CPTShadow.h b/framework/Source/CPTShadow.h index f07db0871..758ba528a 100644 --- a/framework/Source/CPTShadow.h +++ b/framework/Source/CPTShadow.h @@ -1,6 +1,6 @@ @class CPTColor; -@interface CPTShadow : NSObject +@interface CPTShadow : NSObject @property (nonatomic, readonly) CGSize shadowOffset; @property (nonatomic, readonly) CGFloat shadowBlurRadius; diff --git a/framework/Source/CPTShadow.m b/framework/Source/CPTShadow.m index f3426df6f..6204c3943 100644 --- a/framework/Source/CPTShadow.m +++ b/framework/Source/CPTShadow.m @@ -40,7 +40,7 @@ @implementation CPTShadow **/ @synthesize shadowBlurRadius; -/** @property CPTColor *shadowColor +/** @property nullable CPTColor *shadowColor * @brief The shadow color. If @nil (the default), the shadow will not be drawn. **/ @synthesize shadowColor; @@ -51,7 +51,7 @@ @implementation CPTShadow /** @brief Creates and returns a new CPTShadow instance. * @return A new CPTShadow instance. **/ -+(instancetype)shadow ++(nonnull instancetype)shadow { return [[self alloc] init]; } @@ -68,9 +68,9 @@ +(instancetype)shadow * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { shadowOffset = CGSizeZero; shadowBlurRadius = CPTFloat(0.0); shadowColor = nil; @@ -85,32 +85,45 @@ -(instancetype)init /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeCPTSize:self.shadowOffset forKey:@"CPTShadow.shadowOffset"]; [coder encodeCGFloat:self.shadowBlurRadius forKey:@"CPTShadow.shadowBlurRadius"]; [coder encodeObject:self.shadowColor forKey:@"CPTShadow.shadowColor"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { shadowOffset = [coder decodeCPTSizeForKey:@"CPTShadow.shadowOffset"]; shadowBlurRadius = [coder decodeCGFloatForKey:@"CPTShadow.shadowBlurRadius"]; - shadowColor = [coder decodeObjectForKey:@"CPTShadow.shadowColor"]; + shadowColor = [coder decodeObjectOfClass:[CPTColor class] + forKey:@"CPTShadow.shadowColor"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /** @brief Sets the shadow properties in the given graphics context. * @param context The graphics context. **/ --(void)setShadowInContext:(CGContextRef)context +-(void)setShadowInContext:(nonnull CGContextRef)context { CGContextSetShadowWithColor(context, self.shadowOffset, @@ -123,7 +136,7 @@ -(void)setShadowInContext:(CGContextRef)context /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTShadow *shadowCopy = [[CPTShadow allocWithZone:zone] init]; @@ -141,7 +154,7 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(id)mutableCopyWithZone:(NSZone *)zone +-(nonnull id)mutableCopyWithZone:(nullable NSZone *)zone { CPTShadow *shadowCopy = [[CPTMutableShadow allocWithZone:zone] init]; @@ -161,7 +174,7 @@ -(id)mutableCopyWithZone:(NSZone *)zone -(void)setShadowBlurRadius:(CGFloat)newShadowBlurRadius { - NSParameterAssert(newShadowBlurRadius >= 0.0); + NSParameterAssert(newShadowBlurRadius >= CPTFloat(0.0)); if ( newShadowBlurRadius != shadowBlurRadius ) { shadowBlurRadius = newShadowBlurRadius; diff --git a/framework/Source/CPTTestCase.h b/framework/Source/CPTTestCase.h index 5be665d34..b87b0c191 100644 --- a/framework/Source/CPTTestCase.h +++ b/framework/Source/CPTTestCase.h @@ -2,4 +2,7 @@ @interface CPTTestCase : XCTestCase +-(nullable id)archiveRoundTrip:(nonnull id)object toClass:(nonnull Class)archiveClass; +-(nullable id)archiveRoundTrip:(nonnull id)object; + @end diff --git a/framework/Source/CPTTestCase.m b/framework/Source/CPTTestCase.m index d1fffb5c9..effe3adec 100644 --- a/framework/Source/CPTTestCase.m +++ b/framework/Source/CPTTestCase.m @@ -2,4 +2,28 @@ @implementation CPTTestCase +-(nullable id)archiveRoundTrip:(nonnull id)object +{ + return [self archiveRoundTrip:object toClass:[object class]]; +} + +-(nullable id)archiveRoundTrip:(nonnull id)object toClass:(nonnull Class)archiveClass +{ + const BOOL secure = ![archiveClass isSubclassOfClass:[NSNumberFormatter class]]; + + NSMutableData *archiveData = [[NSMutableData alloc] init]; + + NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:archiveData]; + + archiver.requiresSecureCoding = secure; + + [archiver encodeObject:object forKey:@"test"]; + [archiver finishEncoding]; + + NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:archiveData]; + unarchiver.requiresSecureCoding = secure; + + return [unarchiver decodeObjectOfClass:archiveClass forKey:@"test"]; +} + @end diff --git a/framework/Source/CPTTextLayer.h b/framework/Source/CPTTextLayer.h index 9d9c85956..9f3c6773b 100644 --- a/framework/Source/CPTTextLayer.h +++ b/framework/Source/CPTTextLayer.h @@ -15,8 +15,11 @@ extern const CGFloat kCPTTextLayerMarginWidth; ///< Margin width around the text /// @name Initialization /// @{ -(nonnull instancetype)initWithText:(nullable NSString *)newText; --(nonnull instancetype)initWithText:(nullable NSString *)newText style:(nullable CPTTextStyle *)newStyle; +-(nonnull instancetype)initWithText:(nullable NSString *)newText style:(nullable CPTTextStyle *)newStyle NS_DESIGNATED_INITIALIZER; -(nonnull instancetype)initWithAttributedText:(nullable NSAttributedString *)newText; + +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithLayer:(nonnull id)layer NS_DESIGNATED_INITIALIZER; /// @} /// @name Layout diff --git a/framework/Source/CPTTextLayer.m b/framework/Source/CPTTextLayer.m index 05412a560..45a208f31 100644 --- a/framework/Source/CPTTextLayer.m +++ b/framework/Source/CPTTextLayer.m @@ -24,7 +24,7 @@ @interface CPTTextLayer() **/ @implementation CPTTextLayer -/** @property NSString *text +/** @property nullable NSString *text * @brief The text to display. * * Assigning a new value to this property also sets the value of the @ref attributedText property to @nil. @@ -32,14 +32,14 @@ @implementation CPTTextLayer **/ @synthesize text; -/** @property CPTTextStyle *textStyle +/** @property nullable CPTTextStyle *textStyle * @brief The text style used to draw the text. * * Assigning a new value to this property also sets the value of the @ref attributedText property to @nil. **/ @synthesize textStyle; -/** @property NSAttributedString *attributedText +/** @property nullable NSAttributedString *attributedText * @brief The styled text to display. * * Assigning a new value to this property also sets the value of the @ref text property to the @@ -69,9 +69,9 @@ @implementation CPTTextLayer * @param newStyle The text style used to draw the text. * @return The initialized CPTTextLayer object. **/ --(instancetype)initWithText:(NSString *)newText style:(CPTTextStyle *)newStyle +-(nonnull instancetype)initWithText:(nullable NSString *)newText style:(nullable CPTTextStyle *)newStyle { - if ( (self = [super initWithFrame:CGRectZero]) ) { + if ((self = [super initWithFrame:CGRectZero])) { textStyle = newStyle; text = [newText copy]; attributedText = nil; @@ -89,7 +89,7 @@ -(instancetype)initWithText:(NSString *)newText style:(CPTTextStyle *)newStyle * @param newText The text to display. * @return The initialized CPTTextLayer object. **/ --(instancetype)initWithText:(NSString *)newText +-(nonnull instancetype)initWithText:(nullable NSString *)newText { return [self initWithText:newText style:[CPTTextStyle textStyle]]; } @@ -98,11 +98,11 @@ -(instancetype)initWithText:(NSString *)newText * @param newText The styled text to display. * @return The initialized CPTTextLayer object. **/ --(instancetype)initWithAttributedText:(NSAttributedString *)newText +-(nonnull instancetype)initWithAttributedText:(nullable NSAttributedString *)newText { CPTTextStyle *newStyle = [CPTTextStyle textStyleWithAttributes:[newText attributesAtIndex:0 effectiveRange:NULL]]; - if ( (self = [self initWithText:newText.string style:newStyle]) ) { + if ((self = [self initWithText:newText.string style:newStyle])) { attributedText = [newText copy]; [self sizeToFit]; @@ -113,9 +113,9 @@ -(instancetype)initWithAttributedText:(NSAttributedString *)newText /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTTextLayer *theLayer = (CPTTextLayer *)layer; textStyle = theLayer->textStyle; @@ -141,7 +141,7 @@ -(instancetype)initWithLayer:(id)layer * @param newFrame The frame rectangle. * @return The initialized CPTTextLayer object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect __unused)newFrame { return [self initWithText:nil style:nil]; } @@ -153,7 +153,7 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -165,12 +165,15 @@ -(void)encodeWithCoder:(NSCoder *)coder // inTextUpdate } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - textStyle = [coder decodeObjectForKey:@"CPTTextLayer.textStyle"]; - text = [[coder decodeObjectForKey:@"CPTTextLayer.text"] copy]; - attributedText = [[coder decodeObjectForKey:@"CPTTextLayer.attributedText"] copy]; + if ((self = [super initWithCoder:coder])) { + textStyle = [coder decodeObjectOfClass:[CPTTextStyle class] + forKey:@"CPTTextLayer.textStyle"]; + text = [[coder decodeObjectOfClass:[NSString class] + forKey:@"CPTTextLayer.text"] copy]; + attributedText = [[coder decodeObjectOfClass:[NSAttributedString class] + forKey:@"CPTTextLayer.attributedText"] copy]; inTextUpdate = NO; } @@ -179,12 +182,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Accessors /// @cond --(void)setText:(NSString *)newValue +-(void)setText:(nullable NSString *)newValue { if ( text != newValue ) { text = [newValue copy]; @@ -199,7 +214,7 @@ -(void)setText:(NSString *)newValue } } --(void)setTextStyle:(CPTTextStyle *)newStyle +-(void)setTextStyle:(nullable CPTTextStyle *)newStyle { if ( textStyle != newStyle ) { textStyle = newStyle; @@ -214,7 +229,7 @@ -(void)setTextStyle:(CPTTextStyle *)newStyle } } --(void)setAttributedText:(NSAttributedString *)newValue +-(void)setAttributedText:(nullable NSAttributedString *)newValue { if ( attributedText != newValue ) { attributedText = [newValue copy]; @@ -240,16 +255,16 @@ -(void)setAttributedText:(NSAttributedString *)newValue -(void)setMaximumSize:(CGSize)newSize { - if ( !CGSizeEqualToSize(maximumSize, newSize) ) { + if ( !CGSizeEqualToSize(maximumSize, newSize)) { maximumSize = newSize; [self sizeToFit]; } } --(void)setShadow:(CPTShadow *)newShadow +-(void)setShadow:(nullable CPTShadow *)newShadow { if ( newShadow != self.shadow ) { - [super setShadow:newShadow]; + super.shadow = newShadow; [self sizeToFit]; } } @@ -257,7 +272,7 @@ -(void)setShadow:(CPTShadow *)newShadow -(void)setPaddingLeft:(CGFloat)newPadding { if ( newPadding != self.paddingLeft ) { - [super setPaddingLeft:newPadding]; + super.paddingLeft = newPadding; [self sizeToFit]; } } @@ -265,7 +280,7 @@ -(void)setPaddingLeft:(CGFloat)newPadding -(void)setPaddingRight:(CGFloat)newPadding { if ( newPadding != self.paddingRight ) { - [super setPaddingRight:newPadding]; + super.paddingRight = newPadding; [self sizeToFit]; } } @@ -273,7 +288,7 @@ -(void)setPaddingRight:(CGFloat)newPadding -(void)setPaddingTop:(CGFloat)newPadding { if ( newPadding != self.paddingTop ) { - [super setPaddingTop:newPadding]; + super.paddingTop = newPadding; [self sizeToFit]; } } @@ -281,7 +296,7 @@ -(void)setPaddingTop:(CGFloat)newPadding -(void)setPaddingBottom:(CGFloat)newPadding { if ( newPadding != self.paddingBottom ) { - [super setPaddingBottom:newPadding]; + super.paddingBottom = newPadding; [self sizeToFit]; } } @@ -301,12 +316,8 @@ -(CGSize)sizeThatFits if ( myText.length > 0 ) { NSAttributedString *styledText = self.attributedText; - if ( (styledText.length > 0) && [styledText respondsToSelector:@selector(size)] ) { -#if TARGET_IPHONE_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]; @@ -336,10 +347,10 @@ -(void)sizeToFit newBounds.size.height += self.paddingTop + self.paddingBottom; CGSize myMaxSize = self.maximumSize; - if ( myMaxSize.width > CPTFloat(0.0) ) { + if ( myMaxSize.width > CPTFloat(0.0)) { newBounds.size.width = MIN(newBounds.size.width, myMaxSize.width); } - if ( myMaxSize.height > CPTFloat(0.0) ) { + if ( myMaxSize.height > CPTFloat(0.0)) { newBounds.size.height = MIN(newBounds.size.height, myMaxSize.height); } @@ -357,7 +368,7 @@ -(void)sizeToFit /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -367,15 +378,15 @@ -(void)renderAsVectorInContext:(CGContextRef)context if ( myText.length > 0 ) { [super renderAsVectorInContext:context]; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGContextSaveGState(context); CGContextTranslateCTM(context, CPTFloat(0.0), self.bounds.size.height); - CGContextScaleCTM( context, CPTFloat(1.0), CPTFloat(-1.0) ); + CGContextScaleCTM(context, CPTFloat(1.0), CPTFloat(-1.0)); #endif CGRect newBounds = CGRectInset(self.bounds, kCPTTextLayerMarginWidth, kCPTTextLayerMarginWidth); newBounds.origin.x += self.paddingLeft; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE newBounds.origin.y += self.paddingTop; #else newBounds.origin.y += self.paddingBottom; @@ -384,7 +395,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context newBounds.size.height -= self.paddingTop + self.paddingBottom; NSAttributedString *styledText = self.attributedText; - if ( (styledText.length > 0) && [styledText respondsToSelector:@selector(drawInRect:)] ) { + if ((styledText.length > 0) && [styledText respondsToSelector:@selector(drawInRect:)] ) { [styledText drawInRect:newBounds inContext:context]; } @@ -394,7 +405,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context inContext:context]; } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGContextRestoreGState(context); #endif } @@ -407,9 +418,9 @@ -(void)renderAsVectorInContext:(CGContextRef)context /// @cond --(NSString *)description +-(nullable NSString *)description { - return [NSString stringWithFormat:@"<%@ \"%@\">", [super description], self.text]; + return [NSString stringWithFormat:@"<%@ \"%@\">", super.description, self.text]; } /// @endcond diff --git a/framework/Source/CPTTextStyle.h b/framework/Source/CPTTextStyle.h index 01605fe22..df94cd374 100644 --- a/framework/Source/CPTTextStyle.h +++ b/framework/Source/CPTTextStyle.h @@ -1,4 +1,5 @@ #import "CPTDefinitions.h" +#import "CPTPlatformSpecificDefines.h" #import "CPTTextStylePlatformSpecific.h" @class CPTColor; @@ -7,15 +8,17 @@ /** * @brief An array of text styles. **/ -typedef NSArray *CPTTextStyleArray; +typedef NSArray CPTTextStyleArray; /** * @brief A mutable array of text styles. **/ -typedef NSMutableArray *CPTMutableTextStyleArray; +typedef NSMutableArray CPTMutableTextStyleArray; -@interface CPTTextStyle : NSObject +@interface CPTTextStyle : NSObject +// font would override fontName/fontSize if not nil +@property (readonly, strong, nonatomic, nullable) CPTNativeFont *font; @property (readonly, copy, nonatomic, nullable) NSString *fontName; @property (readonly, nonatomic) CGFloat fontSize; @property (readonly, copy, nonatomic, nullable) CPTColor *color; @@ -37,11 +40,11 @@ typedef NSMutableArray *CPTMutableTextStyleArray; **/ @interface CPTTextStyle(CPTPlatformSpecificTextStyleExtensions) -@property (readonly, nonatomic, nonnull) CPTDictionary attributes; +@property (readonly, nonatomic, nonnull) CPTDictionary *attributes; /// @name Factory Methods /// @{ -+(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary)attributes; ++(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attributes; /// @} @end diff --git a/framework/Source/CPTTextStyle.m b/framework/Source/CPTTextStyle.m index e1e5cb648..f1c5c4628 100644 --- a/framework/Source/CPTTextStyle.m +++ b/framework/Source/CPTTextStyle.m @@ -7,6 +7,8 @@ /// @cond @interface CPTTextStyle() +// font would override fontName/fontSize if not nil +@property (readwrite, strong, nonatomic, nullable) CPTNativeFont *font; @property (readwrite, copy, nonatomic, nullable) NSString *fontName; @property (readwrite, assign, nonatomic) CGFloat fontSize; @property (readwrite, copy, nonatomic, nullable) CPTColor *color; @@ -26,17 +28,24 @@ @interface CPTTextStyle() @implementation CPTTextStyle +/** @property CPTNativeFont* font + * @brief The font. Default is @nil. + * + * Font will override fontName and fontSize if not @nil. + **/ +@synthesize font; + /** @property CGFloat fontSize - * @brief The font size. Default is @num{12.0}. + * @brief The font size. Default is @num{12.0}. Ignored if font is not @nil. **/ @synthesize fontSize; -/** @property NSString *fontName - * @brief The font name. Default is Helvetica. +/** @property nullable NSString *fontName + * @brief The font name. Default is Helvetica. Ignored if font is not @nil. **/ @synthesize fontName; -/** @property CPTColor *color +/** @property nullable CPTColor *color * @brief The current text color. Default is solid black. **/ @synthesize color; @@ -57,7 +66,7 @@ @implementation CPTTextStyle /** @brief Creates and returns a new CPTTextStyle instance. * @return A new CPTTextStyle instance. **/ -+(instancetype)textStyle ++(nonnull instancetype)textStyle { return [[self alloc] init]; } @@ -69,10 +78,11 @@ +(instancetype)textStyle * @param textStyle An existing CPTTextStyle. * @return A new text style instance. **/ -+(instancetype)textStyleWithStyle:(CPTTextStyle *)textStyle ++(nonnull instancetype)textStyleWithStyle:(nullable CPTTextStyle *)textStyle { CPTTextStyle *newTextStyle = [[self alloc] init]; + newTextStyle.font = textStyle.font; newTextStyle.color = textStyle.color; newTextStyle.fontName = textStyle.fontName; newTextStyle.fontSize = textStyle.fontSize; @@ -88,9 +98,10 @@ +(instancetype)textStyleWithStyle:(CPTTextStyle *)textStyle /// @name Initialization /// @{ -/** @brief Initializes a newly allocated CPTAnnotation object. +/** @brief Initializes a newly allocated CPTTextStyle object. * * The initialized object will have the following properties: + * - @ref font = nil * - @ref fontName = Helvetica * - @ref fontSize = @num{12.0} * - @ref color = opaque black @@ -99,9 +110,10 @@ +(instancetype)textStyleWithStyle:(CPTTextStyle *)textStyle * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { + font = nil; fontName = @"Helvetica"; fontSize = CPTFloat(12.0); color = [CPTColor blackColor]; @@ -118,8 +130,18 @@ -(instancetype)init /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV + if ( self.font ) { + // UIFont does not support NSCoding :( + [coder encodeObject:[self.font fontDescriptor] forKey:@"CPTTextStyle.font+descriptor"]; + } +#else + // NSFont supports NSCoding :) + [coder encodeObject:self.font forKey:@"CPTTextStyle.font"]; +#endif + [coder encodeObject:self.fontName forKey:@"CPTTextStyle.fontName"]; [coder encodeCGFloat:self.fontSize forKey:@"CPTTextStyle.fontSize"]; [coder encodeObject:self.color forKey:@"CPTTextStyle.color"]; @@ -127,29 +149,57 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeInteger:(NSInteger)self.lineBreakMode forKey:@"CPTTextStyle.lineBreakMode"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - fontName = [[coder decodeObjectForKey:@"CPTTextStyle.fontName"] copy]; - fontSize = [coder decodeCGFloatForKey:@"CPTTextStyle.fontSize"]; - color = [[coder decodeObjectForKey:@"CPTTextStyle.color"] copy]; - textAlignment = (CPTTextAlignment)[coder decodeIntegerForKey : @"CPTTextStyle.textAlignment"]; - lineBreakMode = (NSLineBreakMode)[coder decodeIntegerForKey : @"CPTTextStyle.lineBreakMode"]; + if ((self = [super init])) { +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE || TARGET_OS_TV + // UIFont does not support NSCoding :( + UIFontDescriptor *fontDescriptor = [coder decodeObjectOfClass:[UIFontDescriptor class] + forKey:@"CPTTextStyle.font+descriptor"]; + if ( fontDescriptor ) { + font = [UIFont fontWithDescriptor:fontDescriptor size:0]; // 0 will keep the same font size + } +#else + // NSFont supports NSCoding :) + font = [coder decodeObjectOfClass:[NSFont class] + forKey:@"CPTTextStyle.font"]; +#endif + + fontName = [[coder decodeObjectOfClass:[NSString class] + forKey:@"CPTTextStyle.fontName"] copy]; + fontSize = [coder decodeCGFloatForKey:@"CPTTextStyle.fontSize"]; + color = [[coder decodeObjectOfClass:[CPTColor class] + forKey:@"CPTTextStyle.color"] copy]; + textAlignment = (CPTTextAlignment)[coder decodeIntegerForKey:@"CPTTextStyle.textAlignment"]; + lineBreakMode = (NSLineBreakMode)[coder decodeIntegerForKey:@"CPTTextStyle.lineBreakMode"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark NSCopying Methods /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTTextStyle *newCopy = [[CPTTextStyle allocWithZone:zone] init]; + newCopy.font = self.font; newCopy.fontName = self.fontName; newCopy.color = self.color; newCopy.fontSize = self.fontSize; @@ -166,10 +216,11 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(id)mutableCopyWithZone:(NSZone *)zone +-(nonnull id)mutableCopyWithZone:(nullable NSZone *)zone { CPTTextStyle *newCopy = [[CPTMutableTextStyle allocWithZone:zone] init]; + newCopy.font = self.font; newCopy.fontName = self.fontName; newCopy.color = self.color; newCopy.fontSize = self.fontSize; @@ -186,11 +237,11 @@ -(id)mutableCopyWithZone:(NSZone *)zone /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { NSString *lorem = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."; - return [[NSAttributedString alloc] initWithString:lorem attributes:[self attributes]]; + return [[NSAttributedString alloc] initWithString:lorem attributes:self.attributes]; } /// @endcond diff --git a/framework/Source/CPTTextStyleTests.m b/framework/Source/CPTTextStyleTests.m index d2df4a71a..5e21ddcf7 100644 --- a/framework/Source/CPTTextStyleTests.m +++ b/framework/Source/CPTTextStyleTests.m @@ -22,7 +22,7 @@ -(void)testKeyedArchivingRoundTrip { CPTTextStyle *textStyle = [CPTTextStyle textStyle]; - CPTTextStyle *newTextStyle = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:textStyle]]; + CPTTextStyle *newTextStyle = [self archiveRoundTrip:textStyle]; XCTAssertEqualObjects(newTextStyle.fontName, textStyle.fontName, @"Font names not equal"); XCTAssertEqual(newTextStyle.fontSize, textStyle.fontSize, @"Font sizes not equal"); diff --git a/framework/Source/CPTTheme.h b/framework/Source/CPTTheme.h index 2825e914c..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; @@ -12,7 +19,7 @@ extern NSString *__nonnull const kCPTStocksTheme; ///< A graph theme with @class CPTAxisSet; @class CPTMutableTextStyle; -@interface CPTTheme : NSObject +@interface CPTTheme : NSObject @property (nonatomic, readwrite, strong, nullable) Class graphClass; @@ -20,13 +27,13 @@ extern NSString *__nonnull const kCPTStocksTheme; ///< A graph theme with /// @{ +(void)registerTheme:(nonnull Class)themeClass; +(nullable NSArray *)themeClasses; -+(nullable instancetype)themeNamed:(nullable NSString *)theme; -+(nonnull NSString *)name; ++(nullable instancetype)themeNamed:(nullable CPTThemeName)themeName; ++(nonnull CPTThemeName)name; /// @} /// @name Theme Usage /// @{ --(void)applyThemeToGraph:(nullable CPTGraph *)graph; +-(void)applyThemeToGraph:(nonnull CPTGraph *)graph; /// @} @end @@ -40,9 +47,9 @@ extern NSString *__nonnull const kCPTStocksTheme; ///< A graph theme with /// @{ -(nullable id)newGraph; --(void)applyThemeToBackground:(nullable CPTGraph *)graph; --(void)applyThemeToPlotArea:(nullable CPTPlotAreaFrame *)plotAreaFrame; --(void)applyThemeToAxisSet:(nullable CPTAxisSet *)axisSet; +-(void)applyThemeToBackground:(nonnull CPTGraph *)graph; +-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame; +-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet; /// @} @end diff --git a/framework/Source/CPTTheme.m b/framework/Source/CPTTheme.m index 7138d6344..9d17a6e00 100644 --- a/framework/Source/CPTTheme.m +++ b/framework/Source/CPTTheme.m @@ -20,7 +20,7 @@ **/ @implementation CPTTheme -/** @property Class graphClass +/** @property nullable Class graphClass * @brief The class used to create new graphs. Must be a subclass of CPTGraph. **/ @synthesize graphClass; @@ -38,9 +38,9 @@ @implementation CPTTheme * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { graphClass = Nil; } return self; @@ -53,7 +53,7 @@ -(instancetype)init /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeObject:[[self class] name] forKey:@"CPTTheme.name"]; @@ -63,12 +63,14 @@ -(void)encodeWithCoder:(NSCoder *)coder } } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - self = [CPTTheme themeNamed:[coder decodeObjectForKey:@"CPTTheme.name"]]; + self = [CPTTheme themeNamed:[coder decodeObjectOfClass:[NSString class] + forKey:@"CPTTheme.name"]]; if ( self ) { - NSString *className = [coder decodeObjectForKey:@"CPTTheme.graphClass"]; + NSString *className = [coder decodeObjectOfClass:[NSString class] + forKey:@"CPTTheme.graphClass"]; if ( className ) { self.graphClass = NSClassFromString(className); } @@ -78,13 +80,25 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Theme management /** @brief List of the available theme classes, sorted by name. * @return An NSArray containing all available theme classes, sorted by name. **/ -+(NSArray *)themeClasses ++(nullable NSArray *)themeClasses { NSSortDescriptor *nameSort = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES selector:@selector(caseInsensitiveCompare:)]; @@ -96,7 +110,7 @@ -(instancetype)initWithCoder:(NSCoder *)coder * @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. **/ -+(instancetype)themeNamed:(NSString *)themeName ++(nullable instancetype)themeNamed:(nullable CPTThemeName)themeName { CPTTheme *newTheme = nil; @@ -113,12 +127,11 @@ +(instancetype)themeNamed:(NSString *)themeName /** @brief Register a theme class. * @param themeClass Theme class to register. **/ -+(void)registerTheme:(Class)themeClass ++(void)registerTheme:(nonnull Class)themeClass { NSParameterAssert(themeClass); - @synchronized(self) - { + @synchronized ( self ) { if ( !themes ) { themes = [[NSMutableSet alloc] init]; } @@ -135,7 +148,7 @@ +(void)registerTheme:(Class)themeClass /** @brief The name used for this theme class. * @return The name. **/ -+(NSString *)name ++(nonnull CPTThemeName)name { return NSStringFromClass(self); } @@ -145,7 +158,7 @@ +(NSString *)name /// @cond --(void)setGraphClass:(Class)newGraphClass +-(void)setGraphClass:(nullable Class)newGraphClass { if ( graphClass != newGraphClass ) { if ( ![newGraphClass isSubclassOfClass:[CPTGraph class]] ) { @@ -168,11 +181,19 @@ -(void)setGraphClass:(Class)newGraphClass /** @brief Applies the theme to the provided graph. * @param graph The graph to style. **/ --(void)applyThemeToGraph:(CPTGraph *)graph +-(void)applyThemeToGraph:(nonnull CPTGraph *)graph { [self applyThemeToBackground:graph]; - [self applyThemeToPlotArea:graph.plotAreaFrame]; - [self applyThemeToAxisSet:graph.axisSet]; + + CPTPlotAreaFrame *plotAreaFrame = graph.plotAreaFrame; + if ( plotAreaFrame ) { + [self applyThemeToPlotArea:plotAreaFrame]; + } + + CPTAxisSet *axisSet = graph.axisSet; + if ( axisSet ) { + [self applyThemeToAxisSet:axisSet]; + } } @end @@ -184,7 +205,7 @@ @implementation CPTTheme(AbstractMethods) /** @brief Creates a new graph styled with the theme. * @return The new graph. **/ --(id)newGraph +-(nullable id)newGraph { return nil; } @@ -192,21 +213,21 @@ -(id)newGraph /** @brief Applies the background theme to the provided graph. * @param graph The graph to style. **/ --(void)applyThemeToBackground:(CPTGraph *)graph +-(void)applyThemeToBackground:(nonnull CPTGraph *__unused)graph { } /** @brief Applies the theme to the provided plot area. * @param plotAreaFrame The plot area to style. **/ --(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame +-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *__unused)plotAreaFrame { } /** @brief Applies the theme to the provided axis set. * @param axisSet The axis set to style. **/ --(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet +-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *__unused)axisSet { } diff --git a/framework/Source/CPTThemeTests.m b/framework/Source/CPTThemeTests.m index 9fe75004f..d0007cb38 100644 --- a/framework/Source/CPTThemeTests.m +++ b/framework/Source/CPTThemeTests.m @@ -1,13 +1,13 @@ #import "CPTThemeTests.h" -#import "CPTDerivedXYGraph.h" -#import "CPTExceptions.h" -#import "CPTTheme.h" #import "_CPTDarkGradientTheme.h" #import "_CPTPlainBlackTheme.h" #import "_CPTPlainWhiteTheme.h" #import "_CPTSlateTheme.h" #import "_CPTStocksTheme.h" +#import "CPTDerivedXYGraph.h" +#import "CPTExceptions.h" +#import "CPTTheme.h" @implementation CPTThemeTests @@ -15,7 +15,7 @@ -(void)testSetGraphClassUsingCPTXYGraphShouldWork { CPTTheme *theme = [[CPTTheme alloc] init]; - [theme setGraphClass:[CPTXYGraph class]]; + theme.graphClass = [CPTXYGraph class]; XCTAssertEqual([CPTXYGraph class], theme.graphClass, @"graphClass should be CPTXYGraph"); } @@ -23,7 +23,7 @@ -(void)testSetGraphUsingDerivedClassShouldWork { CPTTheme *theme = [[CPTTheme alloc] init]; - [theme setGraphClass:[CPTDerivedXYGraph class]]; + theme.graphClass = [CPTDerivedXYGraph class]; XCTAssertEqual([CPTDerivedXYGraph class], theme.graphClass, @"graphClass should be CPTDerivedXYGraph"); } @@ -52,6 +52,8 @@ -(void)testThemeNamedDarkGradientShouldReturnCPTDarkGradientTheme CPTTheme *theme = [CPTTheme themeNamed:kCPTDarkGradientTheme]; XCTAssertTrue([theme isKindOfClass:[_CPTDarkGradientTheme class]], @"Should be _CPTDarkGradientTheme"); + + [self archiveRoundTrip:theme toClass:[CPTTheme class]]; } -(void)testThemeNamedPlainBlackShouldReturnCPTPlainBlackTheme @@ -59,6 +61,8 @@ -(void)testThemeNamedPlainBlackShouldReturnCPTPlainBlackTheme CPTTheme *theme = [CPTTheme themeNamed:kCPTPlainBlackTheme]; XCTAssertTrue([theme isKindOfClass:[_CPTPlainBlackTheme class]], @"Should be _CPTPlainBlackTheme"); + + [self archiveRoundTrip:theme toClass:[CPTTheme class]]; } -(void)testThemeNamedPlainWhiteShouldReturnCPTPlainWhiteTheme @@ -66,6 +70,8 @@ -(void)testThemeNamedPlainWhiteShouldReturnCPTPlainWhiteTheme CPTTheme *theme = [CPTTheme themeNamed:kCPTPlainWhiteTheme]; XCTAssertTrue([theme isKindOfClass:[_CPTPlainWhiteTheme class]], @"Should be _CPTPlainWhiteTheme"); + + [self archiveRoundTrip:theme toClass:[CPTTheme class]]; } -(void)testThemeNamedStocksShouldReturnCPTStocksTheme @@ -73,6 +79,8 @@ -(void)testThemeNamedStocksShouldReturnCPTStocksTheme CPTTheme *theme = [CPTTheme themeNamed:kCPTStocksTheme]; XCTAssertTrue([theme isKindOfClass:[_CPTStocksTheme class]], @"Should be _CPTStocksTheme"); + + [self archiveRoundTrip:theme toClass:[CPTTheme class]]; } -(void)testThemeNamedSlateShouldReturnCPTSlateTheme @@ -80,6 +88,8 @@ -(void)testThemeNamedSlateShouldReturnCPTSlateTheme CPTTheme *theme = [CPTTheme themeNamed:kCPTSlateTheme]; XCTAssertTrue([theme isKindOfClass:[_CPTSlateTheme class]], @"Should be _CPTSlateTheme"); + + [self archiveRoundTrip:theme toClass:[CPTTheme class]]; } @end diff --git a/framework/Source/CPTTimeFormatter.h b/framework/Source/CPTTimeFormatter.h index afb81774e..9a5de1b9d 100644 --- a/framework/Source/CPTTimeFormatter.h +++ b/framework/Source/CPTTimeFormatter.h @@ -1,5 +1,3 @@ -/// @file - @interface CPTTimeFormatter : NSNumberFormatter @property (nonatomic, readwrite, strong, nullable) NSDateFormatter *dateFormatter; @@ -8,7 +6,7 @@ /// @name Initialization /// @{ -(nonnull instancetype)initWithDateFormatter:(nullable NSDateFormatter *)aDateFormatter NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} @end diff --git a/framework/Source/CPTTimeFormatter.m b/framework/Source/CPTTimeFormatter.m index bfa12b728..8d0ad4b51 100644 --- a/framework/Source/CPTTimeFormatter.m +++ b/framework/Source/CPTTimeFormatter.m @@ -8,12 +8,12 @@ **/ @implementation CPTTimeFormatter -/** @property NSDateFormatter *dateFormatter +/** @property nullable NSDateFormatter *dateFormatter * @brief The date formatter used to generate strings from time intervals. **/ @synthesize dateFormatter; -/** @property NSDate *referenceDate +/** @property nullable NSDate *referenceDate * @brief Date from which time intervals are taken. * If @nil, the standard reference date (1 January 2001, GMT) is used. **/ @@ -29,7 +29,7 @@ @implementation CPTTimeFormatter * The default formatter uses @ref NSDateFormatterMediumStyle for dates and times. * @return The new instance. **/ --(instancetype)init +-(nonnull instancetype)init { NSDateFormatter *newDateFormatter = [[NSDateFormatter alloc] init]; @@ -47,9 +47,9 @@ -(instancetype)init * @param aDateFormatter The date formatter. * @return The new instance. **/ --(instancetype)initWithDateFormatter:(NSDateFormatter *)aDateFormatter +-(nonnull instancetype)initWithDateFormatter:(nullable NSDateFormatter *)aDateFormatter { - if ( (self = [super init]) ) { + if ((self = [super init])) { dateFormatter = aDateFormatter; referenceDate = nil; } @@ -61,7 +61,7 @@ -(instancetype)initWithDateFormatter:(NSDateFormatter *)aDateFormatter /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -75,9 +75,9 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { dateFormatter = [coder decodeObjectForKey:@"CPTTimeFormatter.dateFormatter"]; referenceDate = [[coder decodeObjectForKey:@"CPTTimeFormatter.referenceDate"] copy]; } @@ -89,7 +89,7 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { CPTTimeFormatter *newFormatter = [[CPTTimeFormatter allocWithZone:zone] init]; @@ -116,7 +116,7 @@ -(id)copyWithZone:(NSZone *)zone * @param coordinateValue The time value. * @return The date string. **/ --(NSString *)stringForObjectValue:(id)coordinateValue +-(nullable NSString *)stringForObjectValue:(nullable id)coordinateValue { NSString *string = nil; diff --git a/framework/Source/CPTTimeFormatterTests.m b/framework/Source/CPTTimeFormatterTests.m index fbcf5b822..52d5fcfc1 100644 --- a/framework/Source/CPTTimeFormatterTests.m +++ b/framework/Source/CPTTimeFormatterTests.m @@ -18,7 +18,7 @@ -(void)testKeyedArchivingRoundTrip CPTTimeFormatter *timeFormatter = [[CPTTimeFormatter alloc] initWithDateFormatter:dateFormatter]; timeFormatter.referenceDate = refDate; - CPTTimeFormatter *newTimeFormatter = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:timeFormatter]]; + CPTTimeFormatter *newTimeFormatter = [self archiveRoundTrip:timeFormatter]; XCTAssertEqualObjects(timeFormatter.dateFormatter.dateFormat, newTimeFormatter.dateFormatter.dateFormat, @"Date formatter not equal"); XCTAssertEqualObjects(timeFormatter.referenceDate, newTimeFormatter.referenceDate, @"Reference date not equal"); diff --git a/framework/Source/CPTTradingRangePlot.h b/framework/Source/CPTTradingRangePlot.h index f9a4d4122..b32085afe 100644 --- a/framework/Source/CPTTradingRangePlot.h +++ b/framework/Source/CPTTradingRangePlot.h @@ -7,18 +7,24 @@ @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; +extern CPTTradingRangePlotBinding __nonnull const CPTTradingRangePlotBindingBarWidths; /// @} /** @@ -56,7 +62,7 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { * @param indexRange The range of the data indexes of interest. * @return An array of fills. **/ --(nullable CPTFillArray)increaseFillsForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTFillArray *)increaseFillsForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets the fill used with a candlestick plot when close >= open for the given plot. * This method will not be called if @@ -73,7 +79,7 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { * @param plot The trading range plot. * @param indexRange The range of the data indexes of interest. **/ --(nullable CPTFillArray)decreaseFillsForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTFillArray *)decreaseFillsForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets the fill used with a candlestick plot when close < open for the given plot. * This method will not be called if @@ -86,6 +92,23 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { **/ -(nullable CPTFill *)decreaseFillForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; +/** @brief @optional Gets an array of bar widths for the given trading range plot. + * @param plot The trading range plot. + * @param indexRange The range of the data indexes of interest. + * @return An array of bar widths. + **/ +-(nullable CPTNumberArray *)barWidthsForTradingRangePlot:(nonnull CPTTradingRangePlot *)barPlot recordIndexRange:(NSRange)indexRange; + +/** @brief @optional Gets a bar width for the given trading range plot. + * This method will not be called if + * @link CPTTradingRangePlotDataSource::barWidthForTradingRangePlot:recordIndexRange: -barWidthForTradingRangePlot:recordIndexRange: @endlink + * is also implemented in the datasource. + * @param plot The tradingrange plot. + * @param idx The data index of interest. + * @return The bar width for the bar with the given index. If the data source returns @nil, the default barWidth is used. + **/ +-(nullable NSNumber *)barWidthForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndex:(NSUInteger)idx; + /// @} /// @name Bar Line Styles @@ -96,7 +119,7 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { * @param indexRange The range of the data indexes of interest. * @return An array of line styles. **/ --(nullable CPTLineStyleArray)lineStylesForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTLineStyleArray *)lineStylesForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets the line style used to draw candlestick or OHLC symbols for the given trading range plot. * This method will not be called if @@ -114,7 +137,7 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { * @param indexRange The range of the data indexes of interest. * @return An array of line styles. **/ --(nullable CPTLineStyleArray)increaseLineStylesForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTLineStyleArray *)increaseLineStylesForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets the line style used to outline candlestick symbols when close >= open for the given trading range plot. * This method will not be called if @@ -132,7 +155,7 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { * @param indexRange The range of the data indexes of interest. * @return An array of line styles. **/ --(nullable CPTLineStyleArray)decreaseLineStylesForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; +-(nullable CPTLineStyleArray *)decreaseLineStylesForTradingRangePlot:(nonnull CPTTradingRangePlot *)plot recordIndexRange:(NSRange)indexRange; /** @brief @optional Gets the line style used to outline candlestick symbols when close < open for the given trading range plot. * This method will not be called if @@ -256,6 +279,8 @@ typedef NS_ENUM (NSInteger, CPTTradingRangePlotField) { -(void)reloadBarFillsInIndexRange:(NSRange)indexRange; -(void)reloadBarLineStyles; -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange; +-(void)reloadBarWidths; +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange; /// @} @end diff --git a/framework/Source/CPTTradingRangePlot.m b/framework/Source/CPTTradingRangePlot.m index 392dc1e38..3589b2870 100644 --- a/framework/Source/CPTTradingRangePlot.m +++ b/framework/Source/CPTTradingRangePlot.m @@ -12,6 +12,8 @@ #import "CPTUtilities.h" #import "CPTXYPlotSpace.h" #import "NSCoderExtensions.h" +#import "NSNumberExtensions.h" +#import "tgmath.h" /** @defgroup plotAnimationTradingRangePlot Trading Range Plot * @brief Trading range plot properties that can be animated using Core Animation. @@ -25,16 +27,17 @@ * @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. +CPTTradingRangePlotBinding const CPTTradingRangePlotBindingBarWidths = @"barWidths"; ///< Bar widths. static const CPTCoordinate independentCoord = CPTCoordinateX; static const CPTCoordinate dependentCoord = CPTCoordinateY; @@ -42,27 +45,30 @@ /// @cond @interface CPTTradingRangePlot() -@property (nonatomic, readwrite, copy) CPTMutableNumericData *xValues; -@property (nonatomic, readwrite, copy) CPTMutableNumericData *openValues; -@property (nonatomic, readwrite, copy) CPTMutableNumericData *highValues; -@property (nonatomic, readwrite, copy) CPTMutableNumericData *lowValues; -@property (nonatomic, readwrite, copy) CPTMutableNumericData *closeValues; -@property (nonatomic, readwrite, copy) CPTFillArray increaseFills; -@property (nonatomic, readwrite, copy) CPTFillArray decreaseFills; -@property (nonatomic, readwrite, copy) CPTLineStyleArray lineStyles; -@property (nonatomic, readwrite, copy) CPTLineStyleArray increaseLineStyles; -@property (nonatomic, readwrite, copy) CPTLineStyleArray decreaseLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *xValues; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *openValues; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *highValues; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *lowValues; +@property (nonatomic, readwrite, copy, nullable) CPTMutableNumericData *closeValues; +@property (nonatomic, readwrite, copy, nullable) CPTFillArray *increaseFills; +@property (nonatomic, readwrite, copy, nullable) CPTFillArray *decreaseFills; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *lineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *increaseLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *decreaseLineStyles; +@property (nonatomic, readwrite, copy, nullable) CPTLineStyleArray *barWidths; @property (nonatomic, readwrite, assign) NSUInteger pointingDeviceDownIndex; --(void)drawCandleStickInContext:(CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue alignPoints:(BOOL)alignPoints; --(void)drawOHLCInContext:(CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue alignPoints:(BOOL)alignPoints; +-(void)drawCandleStickInContext:(nonnull CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue width:(CGFloat)width alignPoints:(BOOL)alignPoints; +-(void)drawOHLCInContext:(nonnull CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue alignPoints:(BOOL)alignPoints; --(CPTFill *)increaseFillForIndex:(NSUInteger)idx; --(CPTFill *)decreaseFillForIndex:(NSUInteger)idx; +-(nullable CPTFill *)increaseFillForIndex:(NSUInteger)idx; +-(nullable CPTFill *)decreaseFillForIndex:(NSUInteger)idx; --(CPTLineStyle *)lineStyleForIndex:(NSUInteger)idx; --(CPTLineStyle *)increaseLineStyleForIndex:(NSUInteger)idx; --(CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx; +-(nullable CPTLineStyle *)lineStyleForIndex:(NSUInteger)idx; +-(nullable CPTLineStyle *)increaseLineStyleForIndex:(NSUInteger)idx; +-(nullable CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx; + +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx; @end @@ -89,30 +95,31 @@ @implementation CPTTradingRangePlot @dynamic lineStyles; @dynamic increaseLineStyles; @dynamic decreaseLineStyles; +@dynamic barWidths; -/** @property CPTLineStyle *lineStyle +/** @property nullable CPTLineStyle *lineStyle * @brief The line style used to draw candlestick or OHLC symbols. **/ @synthesize lineStyle; -/** @property CPTLineStyle *increaseLineStyle +/** @property nullable CPTLineStyle *increaseLineStyle * @brief The line style used to outline candlestick symbols or draw OHLC symbols when close >= open. * If @nil, will use @ref lineStyle instead. **/ @synthesize increaseLineStyle; -/** @property CPTLineStyle *decreaseLineStyle +/** @property nullable CPTLineStyle *decreaseLineStyle * @brief The line style used to outline candlestick symbols or draw OHLC symbols when close < open. * If @nil, will use @ref lineStyle instead. **/ @synthesize decreaseLineStyle; -/** @property CPTFill *increaseFill +/** @property nullable CPTFill *increaseFill * @brief The fill used with a candlestick plot when close >= open. **/ @synthesize increaseFill; -/** @property CPTFill *decreaseFill +/** @property nullable CPTFill *decreaseFill * @brief The fill used with a candlestick plot when close < open. **/ @synthesize decreaseFill; @@ -158,7 +165,7 @@ @implementation CPTTradingRangePlot /// @cond -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else +(void)initialize { @@ -173,8 +180,10 @@ +(void)initialize [self exposeBinding:CPTTradingRangePlotBindingLineStyles]; [self exposeBinding:CPTTradingRangePlotBindingIncreaseLineStyles]; [self exposeBinding:CPTTradingRangePlotBindingDecreaseLineStyles]; + [self exposeBinding:CPTTradingRangePlotBindingBarWidths]; } } + #endif /// @endcond @@ -200,9 +209,9 @@ +(void)initialize * @param newFrame The frame rectangle. * @return The initialized CPTTradingRangePlot object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { plotStyle = CPTTradingRangePlotStyleOHLC; lineStyle = [[CPTLineStyle alloc] init]; increaseLineStyle = nil; @@ -225,9 +234,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTTradingRangePlot *theLayer = (CPTTradingRangePlot *)layer; plotStyle = theLayer->plotStyle; @@ -253,7 +262,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -272,19 +281,24 @@ -(void)encodeWithCoder:(NSCoder *)coder // pointingDeviceDownIndex } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - lineStyle = [[coder decodeObjectForKey:@"CPTTradingRangePlot.lineStyle"] copy]; - increaseLineStyle = [[coder decodeObjectForKey:@"CPTTradingRangePlot.increaseLineStyle"] copy]; - decreaseLineStyle = [[coder decodeObjectForKey:@"CPTTradingRangePlot.decreaseLineStyle"] copy]; - increaseFill = [[coder decodeObjectForKey:@"CPTTradingRangePlot.increaseFill"] copy]; - decreaseFill = [[coder decodeObjectForKey:@"CPTTradingRangePlot.decreaseFill"] copy]; - plotStyle = (CPTTradingRangePlotStyle)[coder decodeIntegerForKey : @"CPTTradingRangePlot.plotStyle"]; - barWidth = [coder decodeCGFloatForKey:@"CPTTradingRangePlot.barWidth"]; - stickLength = [coder decodeCGFloatForKey:@"CPTTradingRangePlot.stickLength"]; - barCornerRadius = [coder decodeCGFloatForKey:@"CPTTradingRangePlot.barCornerRadius"]; - showBarBorder = [coder decodeBoolForKey:@"CPTTradingRangePlot.showBarBorder"]; + if ((self = [super initWithCoder:coder])) { + lineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTTradingRangePlot.lineStyle"] copy]; + increaseLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTTradingRangePlot.increaseLineStyle"] copy]; + decreaseLineStyle = [[coder decodeObjectOfClass:[CPTLineStyle class] + forKey:@"CPTTradingRangePlot.decreaseLineStyle"] copy]; + increaseFill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTTradingRangePlot.increaseFill"] copy]; + decreaseFill = [[coder decodeObjectOfClass:[CPTFill class] + forKey:@"CPTTradingRangePlot.decreaseFill"] copy]; + plotStyle = (CPTTradingRangePlotStyle)[coder decodeIntegerForKey:@"CPTTradingRangePlot.plotStyle"]; + barWidth = [coder decodeCGFloatForKey:@"CPTTradingRangePlot.barWidth"]; + stickLength = [coder decodeCGFloatForKey:@"CPTTradingRangePlot.stickLength"]; + barCornerRadius = [coder decodeCGFloatForKey:@"CPTTradingRangePlot.barCornerRadius"]; + showBarBorder = [coder decodeBoolForKey:@"CPTTradingRangePlot.showBarBorder"]; pointingDeviceDownIndex = NSNotFound; } @@ -293,6 +307,18 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Data Loading @@ -307,6 +333,9 @@ -(void)reloadDataInIndexRange:(NSRange)indexRange // Line styles [self reloadBarLineStylesInIndexRange:indexRange]; + + // Bar widths + [self reloadBarWidthsInIndexRange:indexRange]; } -(void)reloadPlotDataInIndexRange:(NSRange)indexRange @@ -368,9 +397,9 @@ -(void)reloadBarFillsInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(increaseFillForTradingRangePlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableFillArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableFillArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTFill *dataSourceFill = [theDataSource increaseFillForTradingRangePlot:self recordIndex:idx]; @@ -396,9 +425,9 @@ -(void)reloadBarFillsInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(decreaseFillForTradingRangePlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableFillArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableFillArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTFill *dataSourceFill = [theDataSource decreaseFillForTradingRangePlot:self recordIndex:idx]; @@ -449,9 +478,9 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(lineStyleForTradingRangePlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableLineStyleArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableLineStyleArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTLineStyle *dataSourceLineStyle = [theDataSource lineStyleForTradingRangePlot:self recordIndex:idx]; @@ -477,9 +506,9 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(increaseLineStyleForTradingRangePlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableLineStyleArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableLineStyleArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTLineStyle *dataSourceLineStyle = [theDataSource increaseLineStyleForTradingRangePlot:self recordIndex:idx]; @@ -505,9 +534,9 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange else if ( [theDataSource respondsToSelector:@selector(decreaseLineStyleForTradingRangePlot:recordIndex:)] ) { needsLegendUpdate = YES; - id nilObject = [CPTPlot nilData]; - CPTMutableLineStyleArray array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; - NSUInteger maxIndex = NSMaxRange(indexRange); + id nilObject = [CPTPlot nilData]; + CPTMutableLineStyleArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { CPTLineStyle *dataSourceLineStyle = [theDataSource decreaseLineStyleForTradingRangePlot:self recordIndex:idx]; @@ -530,12 +559,55 @@ -(void)reloadBarLineStylesInIndexRange:(NSRange)indexRange [self setNeedsDisplay]; } +/** + * @brief Reload all bar widths from the data source immediately. + **/ +-(void)reloadBarWidths +{ + [self reloadBarWidthsInIndexRange:NSMakeRange(0, self.cachedDataCount)]; +} + +/** @brief Reload bar widths in the given index range from the data source immediately. + * @param indexRange The index range to load. + **/ +-(void)reloadBarWidthsInIndexRange:(NSRange)indexRange +{ + id theDataSource = (id)self.dataSource; + + if ( [theDataSource respondsToSelector:@selector(barWidthsForTradingRangePlot:recordIndexRange:)] ) { + [self cacheArray:[theDataSource barWidthsForTradingRangePlot:self recordIndexRange:indexRange] + forKey:CPTTradingRangePlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + else if ( [theDataSource respondsToSelector:@selector(barWidthForTradingRangePlot:recordIndex:)] ) { + id nilObject = [CPTPlot nilData]; + CPTMutableNumberArray *array = [[NSMutableArray alloc] initWithCapacity:indexRange.length]; + NSUInteger maxIndex = NSMaxRange(indexRange); + + for ( NSUInteger idx = indexRange.location; idx < maxIndex; idx++ ) { + NSNumber *width = [theDataSource barWidthForTradingRangePlot:self recordIndex:idx]; + if ( width ) { + [array addObject:width]; + } + else { + [array addObject:nilObject]; + } + } + + [self cacheArray:array + forKey:CPTTradingRangePlotBindingBarWidths + atRecordIndex:indexRange.location]; + } + + [self setNeedsDisplay]; +} + #pragma mark - #pragma mark Drawing /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -551,11 +623,11 @@ -(void)renderAsVectorInContext:(CGContextRef)context if ( sampleCount == 0 ) { return; } - if ( (opens == nil) || (highs == nil) || (lows == nil) || (closes == nil) ) { + if ((opens == nil) || (highs == nil) || (lows == nil) || (closes == nil)) { return; } - if ( (opens.numberOfSamples != sampleCount) || (highs.numberOfSamples != sampleCount) || (lows.numberOfSamples != sampleCount) || (closes.numberOfSamples != sampleCount) ) { + if ((opens.numberOfSamples != sampleCount) || (highs.numberOfSamples != sampleCount) || (lows.numberOfSamples != sampleCount) || (closes.numberOfSamples != sampleCount)) { [NSException raise:CPTException format:@"Mismatching number of data values in trading range plot"]; } @@ -579,7 +651,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context for ( NSUInteger i = 0; i < sampleCount; i++ ) { double plotPoint[2]; plotPoint[independentCoord] = *locationBytes++; - if ( isnan(plotPoint[independentCoord]) ) { + if ( isnan(plotPoint[independentCoord])) { openBytes++; highBytes++; lowBytes++; @@ -589,7 +661,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context // open point plotPoint[dependentCoord] = *openBytes++; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { openPoint = CPTPointMake(NAN, NAN); } else { @@ -598,7 +670,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context // high point plotPoint[dependentCoord] = *highBytes++; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { highPoint = CPTPointMake(NAN, NAN); } else { @@ -607,7 +679,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context // low point plotPoint[dependentCoord] = *lowBytes++; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { lowPoint = CPTPointMake(NAN, NAN); } else { @@ -616,7 +688,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context // close point plotPoint[dependentCoord] = *closeBytes++; - if ( isnan(plotPoint[dependentCoord]) ) { + if ( isnan(plotPoint[dependentCoord])) { closePoint = CPTPointMake(NAN, NAN); } else { @@ -624,17 +696,17 @@ -(void)renderAsVectorInContext:(CGContextRef)context } CGFloat xCoord = openPoint.x; - if ( isnan(xCoord) ) { + if ( isnan(xCoord)) { xCoord = highPoint.x; } - else if ( isnan(xCoord) ) { + else if ( isnan(xCoord)) { xCoord = lowPoint.x; } - else if ( isnan(xCoord) ) { + else if ( isnan(xCoord)) { xCoord = closePoint.x; } - if ( !isnan(xCoord) ) { + if ( !isnan(xCoord)) { // Draw switch ( thePlotStyle ) { case CPTTradingRangePlotStyleOHLC: @@ -656,6 +728,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context close:closePoint.y high:highPoint.y low:lowPoint.y + width:[self barWidthForIndex:i].cgFloatValue alignPoints:alignPoints]; break; } @@ -672,7 +745,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context for ( NSUInteger i = 0; i < sampleCount; i++ ) { NSDecimal plotPoint[2]; plotPoint[independentCoord] = *locationBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[independentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[independentCoord])) { openBytes++; highBytes++; lowBytes++; @@ -682,7 +755,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context // open point plotPoint[dependentCoord] = *openBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { openPoint = CPTPointMake(NAN, NAN); } else { @@ -691,7 +764,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context // high point plotPoint[dependentCoord] = *highBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { highPoint = CPTPointMake(NAN, NAN); } else { @@ -700,7 +773,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context // low point plotPoint[dependentCoord] = *lowBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { lowPoint = CPTPointMake(NAN, NAN); } else { @@ -709,7 +782,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context // close point plotPoint[dependentCoord] = *closeBytes++; - if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord]) ) { + if ( NSDecimalIsNotANumber(&plotPoint[dependentCoord])) { closePoint = CPTPointMake(NAN, NAN); } else { @@ -717,17 +790,17 @@ -(void)renderAsVectorInContext:(CGContextRef)context } CGFloat xCoord = openPoint.x; - if ( isnan(xCoord) ) { + if ( isnan(xCoord)) { xCoord = highPoint.x; } - else if ( isnan(xCoord) ) { + else if ( isnan(xCoord)) { xCoord = lowPoint.x; } - else if ( isnan(xCoord) ) { + else if ( isnan(xCoord)) { xCoord = closePoint.x; } - if ( !isnan(xCoord) ) { + if ( !isnan(xCoord)) { // Draw switch ( thePlotStyle ) { case CPTTradingRangePlotStyleOHLC: @@ -749,6 +822,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context close:closePoint.y high:highPoint.y low:lowPoint.y + width:[self barWidthForIndex:i].cgFloatValue alignPoints:alignPoints]; break; } @@ -759,20 +833,22 @@ -(void)renderAsVectorInContext:(CGContextRef)context CGContextEndTransparencyLayer(context); } --(void)drawCandleStickInContext:(CGContextRef)context +-(void)drawCandleStickInContext:(nonnull CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue close:(CGFloat)closeValue high:(CGFloat)highValue low:(CGFloat)lowValue + width:(CGFloat)width alignPoints:(BOOL)alignPoints { - const CGFloat halfBarWidth = CPTFloat(0.5) * self.barWidth; + const CGFloat halfBarWidth = CPTFloat(0.5) * width; + CPTFill *currentBarFill = nil; CPTLineStyle *theBorderLineStyle = nil; - if ( !isnan(openValue) && !isnan(closeValue) ) { + if ( !isnan(openValue) && !isnan(closeValue)) { if ( openValue < closeValue ) { theBorderLineStyle = [self increaseLineStyleForIndex:idx]; currentBarFill = [self increaseFillForIndex:idx]; @@ -797,13 +873,13 @@ -(void)drawCandleStickInContext:(CGContextRef)context [theBorderLineStyle setLineStyleInContext:context]; CGFloat lineWidth = theBorderLineStyle.lineWidth; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } } // high - low only - if ( hasLineStyle && !isnan(highValue) && !isnan(lowValue) && ( isnan(openValue) || isnan(closeValue) ) ) { + if ( hasLineStyle && !isnan(highValue) && !isnan(lowValue) && (isnan(openValue) || isnan(closeValue))) { CGPoint alignedHighPoint = CPTPointMake(x, highValue); CGPoint alignedLowPoint = CPTPointMake(x, lowValue); if ( alignPoints ) { @@ -823,10 +899,10 @@ -(void)drawCandleStickInContext:(CGContextRef)context } // open-close - if ( !isnan(openValue) && !isnan(closeValue) ) { + if ( !isnan(openValue) && !isnan(closeValue)) { if ( currentBarFill || hasLineStyle ) { CGFloat radius = MIN(self.barCornerRadius, halfBarWidth); - radius = MIN( radius, ABS(closeValue - openValue) ); + radius = MIN(radius, ABS(closeValue - openValue)); CGPoint alignedPoint1 = CPTPointMake(x + halfBarWidth, openValue); CGPoint alignedPoint2 = CPTPointMake(x + halfBarWidth, closeValue); @@ -850,7 +926,7 @@ -(void)drawCandleStickInContext:(CGContextRef)context } } - if ( hasLineStyle && (openValue == closeValue) ) { + if ( hasLineStyle && (openValue == closeValue)) { // #285 Draw a cross with open/close values marked const CGFloat halfLineWidth = CPTFloat(0.5) * theBorderLineStyle.lineWidth; @@ -880,9 +956,9 @@ -(void)drawCandleStickInContext:(CGContextRef)context path = CGPathCreateMutable(); } - if ( !isnan(lowValue) ) { - if ( lowValue < MIN(openValue, closeValue) ) { - CGPoint alignedStartPoint = CPTPointMake( x, MIN(openValue, closeValue) ); + if ( !isnan(lowValue)) { + if ( lowValue < MIN(openValue, closeValue)) { + CGPoint alignedStartPoint = CPTPointMake(x, MIN(openValue, closeValue)); CGPoint alignedLowPoint = CPTPointMake(x, lowValue); if ( alignPoints ) { alignedStartPoint = alignmentFunction(context, alignedStartPoint); @@ -893,9 +969,9 @@ -(void)drawCandleStickInContext:(CGContextRef)context CGPathAddLineToPoint(path, NULL, alignedLowPoint.x, alignedLowPoint.y); } } - if ( !isnan(highValue) ) { - if ( highValue > MAX(openValue, closeValue) ) { - CGPoint alignedStartPoint = CPTPointMake( x, MAX(openValue, closeValue) ); + if ( !isnan(highValue)) { + if ( highValue > MAX(openValue, closeValue)) { + CGPoint alignedStartPoint = CPTPointMake(x, MAX(openValue, closeValue)); CGPoint alignedHighPoint = CPTPointMake(x, highValue); if ( alignPoints ) { alignedStartPoint = alignmentFunction(context, alignedStartPoint); @@ -916,7 +992,7 @@ -(void)drawCandleStickInContext:(CGContextRef)context } } --(void)drawOHLCInContext:(CGContextRef)context +-(void)drawOHLCInContext:(nonnull CGContextRef)context atIndex:(NSUInteger)idx x:(CGFloat)x open:(CGFloat)openValue @@ -927,7 +1003,7 @@ -(void)drawOHLCInContext:(CGContextRef)context { CPTLineStyle *theLineStyle = [self lineStyleForIndex:idx]; - if ( !isnan(openValue) && !isnan(closeValue) ) { + if ( !isnan(openValue) && !isnan(closeValue)) { if ( openValue < closeValue ) { CPTLineStyle *lineStyleForIncrease = [self increaseLineStyleForIndex:idx]; if ( [lineStyleForIncrease isKindOfClass:[CPTLineStyle class]] ) { @@ -949,12 +1025,12 @@ -(void)drawOHLCInContext:(CGContextRef)context CPTAlignPointFunction alignmentFunction = CPTAlignPointToUserSpace; CGFloat lineWidth = theLineStyle.lineWidth; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } // high-low - if ( !isnan(highValue) && !isnan(lowValue) ) { + if ( !isnan(highValue) && !isnan(lowValue)) { CGPoint alignedHighPoint = CPTPointMake(x, highValue); CGPoint alignedLowPoint = CPTPointMake(x, lowValue); if ( alignPoints ) { @@ -966,7 +1042,7 @@ -(void)drawOHLCInContext:(CGContextRef)context } // open - if ( !isnan(openValue) ) { + if ( !isnan(openValue)) { CGPoint alignedOpenStartPoint = CPTPointMake(x, openValue); CGPoint alignedOpenEndPoint = CPTPointMake(x - theStickLength, openValue); // left side if ( alignPoints ) { @@ -978,7 +1054,7 @@ -(void)drawOHLCInContext:(CGContextRef)context } // close - if ( !isnan(closeValue) ) { + if ( !isnan(closeValue)) { CGPoint alignedCloseStartPoint = CPTPointMake(x, closeValue); CGPoint alignedCloseEndPoint = CPTPointMake(x + theStickLength, closeValue); // right side if ( alignPoints ) { @@ -997,7 +1073,7 @@ -(void)drawOHLCInContext:(CGContextRef)context } } --(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawSwatchForLegend:(nonnull CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(CGRect)rect inContext:(nonnull CGContextRef)context { [super drawSwatchForLegend:legend atIndex:idx inRect:rect inContext:context]; @@ -1007,7 +1083,7 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C switch ( self.plotStyle ) { case CPTTradingRangePlotStyleOHLC: [self drawOHLCInContext:context - atIndex:idx + atIndex:0 x:CGRectGetMidX(rect) open:CGRectGetMinY(rect) + rect.size.height / CPTFloat(3.0) close:CGRectGetMinY(rect) + rect.size.height * (CGFloat)(2.0 / 3.0) @@ -1018,56 +1094,57 @@ -(void)drawSwatchForLegend:(CPTLegend *)legend atIndex:(NSUInteger)idx inRect:(C case CPTTradingRangePlotStyleCandleStick: [self drawCandleStickInContext:context - atIndex:idx + atIndex:0 x:CGRectGetMidX(rect) open:CGRectGetMinY(rect) + rect.size.height / CPTFloat(3.0) close:CGRectGetMinY(rect) + rect.size.height * (CGFloat)(2.0 / 3.0) high:CGRectGetMaxY(rect) low:CGRectGetMinY(rect) + width:rect.size.width * CPTFloat(0.8) alignPoints:YES]; break; } } } --(CPTFill *)increaseFillForIndex:(NSUInteger)idx +-(nullable CPTFill *)increaseFillForIndex:(NSUInteger)idx { CPTFill *theFill = [self cachedValueForKey:CPTTradingRangePlotBindingIncreaseFills recordIndex:idx]; - if ( (theFill == nil) || (theFill == [CPTPlot nilData]) ) { + if ((theFill == nil) || (theFill == [CPTPlot nilData])) { theFill = self.increaseFill; } return theFill; } --(CPTFill *)decreaseFillForIndex:(NSUInteger)idx +-(nullable CPTFill *)decreaseFillForIndex:(NSUInteger)idx { CPTFill *theFill = [self cachedValueForKey:CPTTradingRangePlotBindingDecreaseFills recordIndex:idx]; - if ( (theFill == nil) || (theFill == [CPTPlot nilData]) ) { + if ((theFill == nil) || (theFill == [CPTPlot nilData])) { theFill = self.decreaseFill; } return theFill; } --(CPTLineStyle *)lineStyleForIndex:(NSUInteger)idx +-(nullable CPTLineStyle *)lineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theLineStyle = [self cachedValueForKey:CPTTradingRangePlotBindingLineStyles recordIndex:idx]; - if ( (theLineStyle == nil) || (theLineStyle == [CPTPlot nilData]) ) { + if ((theLineStyle == nil) || (theLineStyle == [CPTPlot nilData])) { theLineStyle = self.lineStyle; } return theLineStyle; } --(CPTLineStyle *)increaseLineStyleForIndex:(NSUInteger)idx +-(nullable CPTLineStyle *)increaseLineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theLineStyle = [self cachedValueForKey:CPTTradingRangePlotBindingIncreaseLineStyles recordIndex:idx]; - if ( (theLineStyle == nil) || (theLineStyle == [CPTPlot nilData]) ) { + if ((theLineStyle == nil) || (theLineStyle == [CPTPlot nilData])) { theLineStyle = self.increaseLineStyle; } @@ -1078,11 +1155,11 @@ -(CPTLineStyle *)increaseLineStyleForIndex:(NSUInteger)idx return theLineStyle; } --(CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx +-(nullable CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx { CPTLineStyle *theLineStyle = [self cachedValueForKey:CPTTradingRangePlotBindingDecreaseLineStyles recordIndex:idx]; - if ( (theLineStyle == nil) || (theLineStyle == [CPTPlot nilData]) ) { + if ((theLineStyle == nil) || (theLineStyle == [CPTPlot nilData])) { theLineStyle = self.decreaseLineStyle; } @@ -1093,6 +1170,17 @@ -(CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx return theLineStyle; } +-(nonnull NSNumber *)barWidthForIndex:(NSUInteger)idx +{ + NSNumber *theBarWidth = [self cachedValueForKey:CPTTradingRangePlotBindingBarWidths recordIndex:idx]; + + if ((theBarWidth == nil) || (theBarWidth == [CPTPlot nilData])) { + theBarWidth = @(self.barWidth); + } + + return theBarWidth; +} + /// @endcond #pragma mark - @@ -1100,7 +1188,7 @@ -(CPTLineStyle *)decreaseLineStyleForIndex:(NSUInteger)idx /// @cond -+(BOOL)needsDisplayForKey:(NSString *)aKey ++(BOOL)needsDisplayForKey:(nonnull NSString *)aKey { static NSSet *keys = nil; static dispatch_once_t onceToken = 0; @@ -1132,7 +1220,7 @@ -(NSUInteger)numberOfFields return 5; } --(CPTNumberArray)fieldIdentifiers +-(nonnull CPTNumberArray *)fieldIdentifiers { return @[@(CPTTradingRangePlotFieldX), @(CPTTradingRangePlotFieldOpen), @@ -1141,21 +1229,21 @@ -(CPTNumberArray)fieldIdentifiers @(CPTTradingRangePlotFieldLow)]; } --(CPTNumberArray)fieldIdentifiersForCoordinate:(CPTCoordinate)coord +-(nonnull CPTNumberArray *)fieldIdentifiersForCoordinate:(CPTCoordinate)coord { - CPTNumberArray result = nil; + CPTNumberArray *result = nil; switch ( coord ) { case CPTCoordinateX: result = @[@(CPTTradingRangePlotFieldX)]; - break; + break; case CPTCoordinateY: result = @[@(CPTTradingRangePlotFieldOpen), @(CPTTradingRangePlotFieldLow), @(CPTTradingRangePlotFieldHigh), @(CPTTradingRangePlotFieldClose)]; - break; + break; default: [NSException raise:CPTException format:@"Invalid coordinate passed to fieldIdentifiersForCoordinate:"]; @@ -1194,24 +1282,29 @@ -(CPTCoordinate)coordinateForFieldIdentifier:(NSUInteger)field /// @cond --(void)positionLabelAnnotation:(CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx +-(void)positionLabelAnnotation:(nonnull CPTPlotSpaceAnnotation *)label forIndex:(NSUInteger)idx { BOOL positiveDirection = YES; CPTPlotRange *yRange = [self.plotSpace plotRangeForCoordinate:CPTCoordinateY]; - if ( CPTDecimalLessThan( yRange.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalLessThan(yRange.lengthDecimal, CPTDecimalFromInteger(0))) { positiveDirection = !positiveDirection; } - NSNumber *xValue = [self cachedNumberForField:CPTTradingRangePlotFieldX recordIndex:idx]; + NSNumber *xValue = [self cachedNumberForField:CPTTradingRangePlotFieldX recordIndex:idx]; + NSNumber *openValue = [self cachedNumberForField:CPTTradingRangePlotFieldOpen recordIndex:idx]; + NSNumber *closeValue = [self cachedNumberForField:CPTTradingRangePlotFieldClose recordIndex:idx]; + NSNumber *highValue = [self cachedNumberForField:CPTTradingRangePlotFieldHigh recordIndex:idx]; + NSNumber *lowValue = [self cachedNumberForField:CPTTradingRangePlotFieldLow recordIndex:idx]; + NSNumber *yValue; - CPTNumberArray yValues = @[[self cachedNumberForField:CPTTradingRangePlotFieldOpen recordIndex:idx], - [self cachedNumberForField:CPTTradingRangePlotFieldClose recordIndex:idx], - [self cachedNumberForField:CPTTradingRangePlotFieldHigh recordIndex:idx], - [self cachedNumberForField:CPTTradingRangePlotFieldLow recordIndex:idx]]; - CPTNumberArray yValuesSorted = [yValues sortedArrayUsingSelector:@selector(compare:)]; + CPTNumberArray *yValues = @[openValue, + closeValue, + highValue, + lowValue]; + CPTNumberArray *yValuesSorted = [yValues sortedArrayUsingSelector:@selector(compare:)]; if ( positiveDirection ) { - yValue = [yValuesSorted lastObject]; + yValue = yValuesSorted.lastObject; } else { yValue = yValuesSorted[0]; @@ -1257,7 +1350,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point CGFloat lastViewMax = CPTFloat(0.0); NSUInteger result = NSNotFound; - CGFloat minimumDistanceSquared = NAN; + CGFloat minimumDistanceSquared = CPTNAN; if ( self.doublePrecisionCache ) { const double *locationBytes = (const double *)locations.data.bytes; @@ -1283,7 +1376,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !isnan(plotPoint[dependentCoord]) && [yRange containsDouble:plotPoint[dependentCoord]] ) { openPoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, openPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1297,7 +1390,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !isnan(plotPoint[dependentCoord]) && [yRange containsDouble:plotPoint[dependentCoord]] ) { highPoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, highPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1311,7 +1404,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !isnan(plotPoint[dependentCoord]) && [yRange containsDouble:plotPoint[dependentCoord]] ) { lowPoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, lowPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1325,7 +1418,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !isnan(plotPoint[dependentCoord]) && [yRange containsDouble:plotPoint[dependentCoord]] ) { closePoint = [thePlotSpace plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, closePoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1336,18 +1429,18 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( result == i ) { lastViewX = openPoint.x; - if ( isnan(lastViewX) ) { + if ( isnan(lastViewX)) { lastViewX = highPoint.x; } - else if ( isnan(lastViewX) ) { + else if ( isnan(lastViewX)) { lastViewX = lowPoint.x; } - else if ( isnan(lastViewX) ) { + else if ( isnan(lastViewX)) { lastViewX = closePoint.x; } - lastViewMin = MIN( MIN(openPoint.y, closePoint.y), MIN(highPoint.y, lowPoint.y) ); - lastViewMax = MAX( MAX(openPoint.y, closePoint.y), MAX(highPoint.y, lowPoint.y) ); + lastViewMin = MIN(MIN(openPoint.y, closePoint.y), MIN(highPoint.y, lowPoint.y)); + lastViewMax = MAX(MAX(openPoint.y, closePoint.y), MAX(highPoint.y, lowPoint.y)); } } } @@ -1376,7 +1469,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !NSDecimalIsNotANumber(&plotPoint[dependentCoord]) && [yRange contains:plotPoint[dependentCoord]] ) { openPoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, openPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1390,7 +1483,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !NSDecimalIsNotANumber(&plotPoint[dependentCoord]) && [yRange contains:plotPoint[dependentCoord]] ) { highPoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, highPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1404,7 +1497,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !NSDecimalIsNotANumber(&plotPoint[dependentCoord]) && [yRange contains:plotPoint[dependentCoord]] ) { lowPoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, lowPoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1418,7 +1511,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( !NSDecimalIsNotANumber(&plotPoint[dependentCoord]) && [yRange contains:plotPoint[dependentCoord]] ) { closePoint = [thePlotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; CGFloat distanceSquared = squareOfDistanceBetweenPoints(point, closePoint); - if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared) ) { + if ( isnan(minimumDistanceSquared) || (distanceSquared < minimumDistanceSquared)) { minimumDistanceSquared = distanceSquared; result = i; } @@ -1429,18 +1522,18 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point if ( result == i ) { lastViewX = openPoint.x; - if ( isnan(lastViewX) ) { + if ( isnan(lastViewX)) { lastViewX = highPoint.x; } - else if ( isnan(lastViewX) ) { + else if ( isnan(lastViewX)) { lastViewX = lowPoint.x; } - else if ( isnan(lastViewX) ) { + else if ( isnan(lastViewX)) { lastViewX = closePoint.x; } - lastViewMin = MIN( MIN(openPoint.y, closePoint.y), MIN(highPoint.y, lowPoint.y) ); - lastViewMax = MAX( MAX(openPoint.y, closePoint.y), MAX(highPoint.y, lowPoint.y) ); + lastViewMin = MIN(MIN(openPoint.y, closePoint.y), MIN(highPoint.y, lowPoint.y)); + lastViewMax = MAX(MAX(openPoint.y, closePoint.y), MAX(highPoint.y, lowPoint.y)); } } } @@ -1454,14 +1547,14 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point break; case CPTTradingRangePlotStyleCandleStick: - offset = self.barWidth * CPTFloat(0.5); + offset = [self barWidthForIndex:result].cgFloatValue * CPTFloat(0.5); break; } - if ( ( point.x < (lastViewX - offset) ) || ( point.x > (lastViewX + offset) ) ) { + if ((point.x < (lastViewX - offset)) || (point.x > (lastViewX + offset))) { result = NSNotFound; } - if ( (point.y < lastViewMin) || (point.y > lastViewMax) ) { + if ((point.y < lastViewMin) || (point.y > lastViewMax)) { result = NSNotFound; } } @@ -1492,7 +1585,7 @@ -(NSUInteger)dataIndexFromInteractionPoint:(CGPoint)point * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { CPTGraph *theGraph = self.graph; CPTPlotArea *thePlotArea = self.plotArea; @@ -1501,7 +1594,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact 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:)] || @@ -1557,7 +1650,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { NSUInteger selectedDownIndex = self.pointingDeviceDownIndex; @@ -1570,7 +1663,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio 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:)] || @@ -1629,7 +1722,7 @@ -(void)setPlotStyle:(CPTTradingRangePlotStyle)newPlotStyle } } --(void)setLineStyle:(CPTLineStyle *)newLineStyle +-(void)setLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( lineStyle != newLineStyle ) { lineStyle = [newLineStyle copy]; @@ -1638,7 +1731,7 @@ -(void)setLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setIncreaseLineStyle:(CPTLineStyle *)newLineStyle +-(void)setIncreaseLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( increaseLineStyle != newLineStyle ) { increaseLineStyle = [newLineStyle copy]; @@ -1647,7 +1740,7 @@ -(void)setIncreaseLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setDecreaseLineStyle:(CPTLineStyle *)newLineStyle +-(void)setDecreaseLineStyle:(nullable CPTLineStyle *)newLineStyle { if ( decreaseLineStyle != newLineStyle ) { decreaseLineStyle = [newLineStyle copy]; @@ -1656,7 +1749,7 @@ -(void)setDecreaseLineStyle:(CPTLineStyle *)newLineStyle } } --(void)setIncreaseFill:(CPTFill *)newFill +-(void)setIncreaseFill:(nullable CPTFill *)newFill { if ( increaseFill != newFill ) { increaseFill = [newFill copy]; @@ -1665,7 +1758,7 @@ -(void)setIncreaseFill:(CPTFill *)newFill } } --(void)setDecreaseFill:(CPTFill *)newFill +-(void)setDecreaseFill:(nullable CPTFill *)newFill { if ( decreaseFill != newFill ) { decreaseFill = [newFill copy]; @@ -1708,106 +1801,106 @@ -(void)setShowBarBorder:(BOOL)newShowBarBorder } } --(void)setXValues:(CPTMutableNumericData *)newValues +-(void)setXValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTTradingRangePlotFieldX]; } --(CPTMutableNumericData *)xValues +-(nullable CPTMutableNumericData *)xValues { return [self cachedNumbersForField:CPTTradingRangePlotFieldX]; } --(CPTMutableNumericData *)openValues +-(nullable CPTMutableNumericData *)openValues { return [self cachedNumbersForField:CPTTradingRangePlotFieldOpen]; } --(void)setOpenValues:(CPTMutableNumericData *)newValues +-(void)setOpenValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTTradingRangePlotFieldOpen]; } --(CPTMutableNumericData *)highValues +-(nullable CPTMutableNumericData *)highValues { return [self cachedNumbersForField:CPTTradingRangePlotFieldHigh]; } --(void)setHighValues:(CPTMutableNumericData *)newValues +-(void)setHighValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTTradingRangePlotFieldHigh]; } --(CPTMutableNumericData *)lowValues +-(nullable CPTMutableNumericData *)lowValues { return [self cachedNumbersForField:CPTTradingRangePlotFieldLow]; } --(void)setLowValues:(CPTMutableNumericData *)newValues +-(void)setLowValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTTradingRangePlotFieldLow]; } --(CPTMutableNumericData *)closeValues +-(nullable CPTMutableNumericData *)closeValues { return [self cachedNumbersForField:CPTTradingRangePlotFieldClose]; } --(void)setCloseValues:(CPTMutableNumericData *)newValues +-(void)setCloseValues:(nullable CPTMutableNumericData *)newValues { [self cacheNumbers:newValues forField:CPTTradingRangePlotFieldClose]; } --(CPTFillArray)increaseFills +-(nullable CPTFillArray *)increaseFills { return [self cachedArrayForKey:CPTTradingRangePlotBindingIncreaseFills]; } --(void)setIncreaseFills:(CPTFillArray)newFills +-(void)setIncreaseFills:(nullable CPTFillArray *)newFills { [self cacheArray:newFills forKey:CPTTradingRangePlotBindingIncreaseFills]; [self setNeedsDisplay]; } --(CPTFillArray)decreaseFills +-(nullable CPTFillArray *)decreaseFills { return [self cachedArrayForKey:CPTTradingRangePlotBindingDecreaseFills]; } --(void)setDecreaseFills:(CPTFillArray)newFills +-(void)setDecreaseFills:(nullable CPTFillArray *)newFills { [self cacheArray:newFills forKey:CPTTradingRangePlotBindingDecreaseFills]; [self setNeedsDisplay]; } --(CPTLineStyleArray)lineStyles +-(nullable CPTLineStyleArray *)lineStyles { return [self cachedArrayForKey:CPTTradingRangePlotBindingLineStyles]; } --(void)setLineStyles:(CPTLineStyleArray)newLineStyles +-(void)setLineStyles:(nullable CPTLineStyleArray *)newLineStyles { [self cacheArray:newLineStyles forKey:CPTTradingRangePlotBindingLineStyles]; [self setNeedsDisplay]; } --(CPTLineStyleArray)increaseLineStyles +-(nullable CPTLineStyleArray *)increaseLineStyles { return [self cachedArrayForKey:CPTTradingRangePlotBindingIncreaseLineStyles]; } --(void)setIncreaseLineStyles:(CPTLineStyleArray)newLineStyles +-(void)setIncreaseLineStyles:(nullable CPTLineStyleArray *)newLineStyles { [self cacheArray:newLineStyles forKey:CPTTradingRangePlotBindingIncreaseLineStyles]; [self setNeedsDisplay]; } --(CPTLineStyleArray)decreaseLineStyles +-(nullable CPTLineStyleArray *)decreaseLineStyles { return [self cachedArrayForKey:CPTTradingRangePlotBindingDecreaseLineStyles]; } --(void)setDecreaseLineStyles:(CPTLineStyleArray)newLineStyles +-(void)setDecreaseLineStyles:(nullable CPTLineStyleArray *)newLineStyles { [self cacheArray:newLineStyles forKey:CPTTradingRangePlotBindingDecreaseLineStyles]; [self setNeedsDisplay]; diff --git a/framework/Source/CPTUtilities.h b/framework/Source/CPTUtilities.h index 8835dc852..691923cec 100644 --- a/framework/Source/CPTUtilities.h +++ b/framework/Source/CPTUtilities.h @@ -30,7 +30,7 @@ float CPTDecimalFloatValue(NSDecimal decimalNumber); double CPTDecimalDoubleValue(NSDecimal decimalNumber); CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber); -NSString *CPTDecimalStringValue(NSDecimal decimalNumber); +NSString *__nonnull CPTDecimalStringValue(NSDecimal decimalNumber); /// @} @@ -54,7 +54,7 @@ NSDecimal CPTDecimalFromFloat(float aFloat); NSDecimal CPTDecimalFromDouble(double aDouble); NSDecimal CPTDecimalFromCGFloat(CGFloat aCGFloat); -NSDecimal CPTDecimalFromString(NSString *stringRepresentation); +NSDecimal CPTDecimalFromString(NSString *__nonnull stringRepresentation); /// @} @@ -100,7 +100,7 @@ CPTCoordinate CPTOrthogonalCoordinate(CPTCoordinate coord); /// @name Gradient Colors /// @{ -CPTRGBAColor CPTRGBAColorFromCGColor(CGColorRef color); +CPTRGBAColor CPTRGBAColorFromCGColor(__nonnull CGColorRef color); /// @} @@ -110,29 +110,30 @@ CPTRGBAColor CPTRGBAColorFromCGColor(CGColorRef color); /** * @brief A function called to align a point in a CGContext. **/ -typedef CGPoint (*CPTAlignPointFunction)(CGContextRef, CGPoint); +typedef CGPoint (*CPTAlignPointFunction)(__nonnull CGContextRef, CGPoint); /** * @brief A function called to align a rectangle in a CGContext. **/ -typedef CGRect (*CPTAlignRectFunction)(CGContextRef, CGRect); +typedef CGRect (*CPTAlignRectFunction)(__nonnull CGContextRef, CGRect); -CGPoint CPTAlignPointToUserSpace(CGContextRef context, CGPoint point); -CGSize CPTAlignSizeToUserSpace(CGContextRef context, CGSize size); -CGRect CPTAlignRectToUserSpace(CGContextRef context, CGRect rect); +CGPoint CPTAlignPointToUserSpace(__nonnull CGContextRef context, CGPoint point); +CGSize CPTAlignSizeToUserSpace(__nonnull CGContextRef context, CGSize size); +CGRect CPTAlignRectToUserSpace(__nonnull CGContextRef context, CGRect rect); -CGPoint CPTAlignIntegralPointToUserSpace(CGContextRef context, CGPoint point); -CGRect CPTAlignIntegralRectToUserSpace(CGContextRef context, CGRect rect); +CGPoint CPTAlignIntegralPointToUserSpace(__nonnull CGContextRef context, CGPoint point); +CGRect CPTAlignIntegralRectToUserSpace(__nonnull CGContextRef context, CGRect rect); -CGRect CPTAlignBorderedRectToUserSpace(CGContextRef context, CGRect rect, CPTLineStyle *borderLineStyle); +CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect rect, CPTLineStyle *__nonnull borderLineStyle); /// @} /// @name String Formatting for Core Graphics Structs /// @{ -NSString *CPTStringFromPoint(CGPoint point); -NSString *CPTStringFromSize(CGSize size); -NSString *CPTStringFromRect(CGRect rect); +NSString *__nonnull CPTStringFromPoint(CGPoint point); +NSString *__nonnull CPTStringFromSize(CGSize size); +NSString *__nonnull CPTStringFromRect(CGRect rect); +NSString *__nonnull CPTStringFromVector(CGVector vector); /// @} diff --git a/framework/Source/CPTUtilities.m b/framework/Source/CPTUtilities.m index 5b64efeeb..1a4641de6 100644 --- a/framework/Source/CPTUtilities.m +++ b/framework/Source/CPTUtilities.m @@ -20,7 +20,7 @@ **/ int8_t CPTDecimalCharValue(NSDecimal decimalNumber) { - return (int8_t)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] charValue]; + return (int8_t)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].charValue; } /** @@ -30,7 +30,7 @@ int8_t CPTDecimalCharValue(NSDecimal decimalNumber) **/ int16_t CPTDecimalShortValue(NSDecimal decimalNumber) { - return (int16_t)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] shortValue]; + return (int16_t)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].shortValue; } /** @@ -40,7 +40,17 @@ int16_t CPTDecimalShortValue(NSDecimal decimalNumber) **/ int32_t CPTDecimalLongValue(NSDecimal decimalNumber) { - return (int32_t)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] longValue]; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (int32_t)d.longValue; } /** @@ -50,7 +60,17 @@ int32_t CPTDecimalLongValue(NSDecimal decimalNumber) **/ int64_t CPTDecimalLongLongValue(NSDecimal decimalNumber) { - return (int64_t)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] longLongValue]; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (int64_t)d.longLongValue; } /** @@ -60,7 +80,7 @@ int64_t CPTDecimalLongLongValue(NSDecimal decimalNumber) **/ int CPTDecimalIntValue(NSDecimal decimalNumber) { - return [[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] intValue]; + return [NSDecimalNumber decimalNumberWithDecimal:decimalNumber].intValue; } /** @@ -70,7 +90,17 @@ int CPTDecimalIntValue(NSDecimal decimalNumber) **/ NSInteger CPTDecimalIntegerValue(NSDecimal decimalNumber) { - return (NSInteger)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] integerValue]; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (NSInteger)d.integerValue; } /** @@ -80,7 +110,7 @@ NSInteger CPTDecimalIntegerValue(NSDecimal decimalNumber) **/ uint8_t CPTDecimalUnsignedCharValue(NSDecimal decimalNumber) { - return (uint8_t)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] unsignedCharValue]; + return (uint8_t)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].unsignedCharValue; } /** @@ -90,7 +120,7 @@ uint8_t CPTDecimalUnsignedCharValue(NSDecimal decimalNumber) **/ uint16_t CPTDecimalUnsignedShortValue(NSDecimal decimalNumber) { - return (uint16_t)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] unsignedShortValue]; + return (uint16_t)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].unsignedShortValue; } /** @@ -100,7 +130,17 @@ uint16_t CPTDecimalUnsignedShortValue(NSDecimal decimalNumber) **/ uint32_t CPTDecimalUnsignedLongValue(NSDecimal decimalNumber) { - return (uint32_t)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] unsignedLongValue]; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (uint32_t)d.unsignedLongValue; } /** @@ -110,7 +150,17 @@ uint32_t CPTDecimalUnsignedLongValue(NSDecimal decimalNumber) **/ uint64_t CPTDecimalUnsignedLongLongValue(NSDecimal decimalNumber) { - return (uint64_t)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] unsignedLongLongValue]; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (uint64_t)d.unsignedLongLongValue; } /** @@ -120,7 +170,7 @@ uint64_t CPTDecimalUnsignedLongLongValue(NSDecimal decimalNumber) **/ unsigned int CPTDecimalUnsignedIntValue(NSDecimal decimalNumber) { - return [[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] unsignedIntValue]; + return [NSDecimalNumber decimalNumberWithDecimal:decimalNumber].unsignedIntValue; } /** @@ -130,7 +180,17 @@ unsigned int CPTDecimalUnsignedIntValue(NSDecimal decimalNumber) **/ NSUInteger CPTDecimalUnsignedIntegerValue(NSDecimal decimalNumber) { - return (NSUInteger)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] unsignedIntegerValue]; + NSDecimalNumber *d = [NSDecimalNumber decimalNumberWithDecimal:decimalNumber]; + + d = [d decimalNumberByRoundingAccordingToBehavior: + [NSDecimalNumberHandler decimalNumberHandlerWithRoundingMode:NSRoundDown + scale:0 + raiseOnExactness:NO + raiseOnOverflow:NO + raiseOnUnderflow:NO + raiseOnDivideByZero:NO]]; + + return (NSUInteger)d.unsignedIntegerValue; } /** @@ -140,7 +200,7 @@ NSUInteger CPTDecimalUnsignedIntegerValue(NSDecimal decimalNumber) **/ float CPTDecimalFloatValue(NSDecimal decimalNumber) { - return [[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] floatValue]; + return [NSDecimalNumber decimalNumberWithDecimal:decimalNumber].floatValue; } /** @@ -150,7 +210,7 @@ float CPTDecimalFloatValue(NSDecimal decimalNumber) **/ double CPTDecimalDoubleValue(NSDecimal decimalNumber) { - return [[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] doubleValue]; + return [NSDecimalNumber decimalNumberWithDecimal:decimalNumber].doubleValue; } /** @@ -161,8 +221,7 @@ float CPTDecimalFloatValue(NSDecimal decimalNumber) CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber) { #if CGFLOAT_IS_DOUBLE - return (CGFloat)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] doubleValue]; - + return (CGFloat)[NSDecimalNumber decimalNumberWithDecimal:decimalNumber].doubleValue; #else return (CGFloat)[[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] floatValue]; #endif @@ -173,9 +232,9 @@ CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber) * @param decimalNumber The @ref NSDecimal value. * @return The converted value. **/ -NSString *CPTDecimalStringValue(NSDecimal decimalNumber) +NSString *__nonnull CPTDecimalStringValue(NSDecimal decimalNumber) { - return [[NSDecimalNumber decimalNumberWithDecimal:decimalNumber] stringValue]; + return [NSDecimalNumber decimalNumberWithDecimal:decimalNumber].stringValue; } #pragma mark - @@ -188,7 +247,7 @@ CGFloat CPTDecimalCGFloatValue(NSDecimal decimalNumber) **/ NSDecimal CPTDecimalFromChar(int8_t anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%hhd", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -211,7 +270,7 @@ NSDecimal CPTDecimalFromChar(int8_t anInt) **/ NSDecimal CPTDecimalFromShort(int16_t anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%hd", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -234,7 +293,7 @@ NSDecimal CPTDecimalFromShort(int16_t anInt) **/ NSDecimal CPTDecimalFromLong(int32_t anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%d", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -257,7 +316,7 @@ NSDecimal CPTDecimalFromLong(int32_t anInt) **/ NSDecimal CPTDecimalFromLongLong(int64_t anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%lld", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -280,7 +339,7 @@ NSDecimal CPTDecimalFromLongLong(int64_t anInt) **/ NSDecimal CPTDecimalFromInt(int anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%d", anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -303,7 +362,7 @@ NSDecimal CPTDecimalFromInt(int anInt) **/ NSDecimal CPTDecimalFromInteger(NSInteger anInt) { - if ( (anInt >= 0) && (anInt < kCacheSize) ) { + if ((anInt >= 0) && (anInt < kCacheSize)) { if ( !cacheValueInitialized[anInt] ) { NSString *stringValue = [[NSString alloc] initWithFormat:@"%ld", (long)anInt]; cache[anInt] = CPTDecimalFromString(stringValue); @@ -464,11 +523,11 @@ NSDecimal CPTDecimalFromUnsignedInteger(NSUInteger anInt) **/ NSDecimal CPTDecimalFromFloat(float aFloat) { - if ( isnan(aFloat) ) { + if ( isnan(aFloat) || isinf(aFloat)) { return CPTDecimalNaN(); } else { - NSString *stringValue = [[NSString alloc] initWithFormat:@"%f", aFloat]; + NSString *stringValue = [[NSString alloc] initWithFormat:@"%f", (double)aFloat]; NSDecimal result = CPTDecimalFromString(stringValue); return result; @@ -482,7 +541,7 @@ NSDecimal CPTDecimalFromFloat(float aFloat) **/ NSDecimal CPTDecimalFromDouble(double aDouble) { - if ( isnan(aDouble) ) { + if ( isnan(aDouble) || isinf(aDouble)) { return CPTDecimalNaN(); } else { @@ -500,11 +559,11 @@ NSDecimal CPTDecimalFromDouble(double aDouble) **/ NSDecimal CPTDecimalFromCGFloat(CGFloat aCGFloat) { - if ( isnan(aCGFloat) ) { + if ( isnan(aCGFloat) || isinf(aCGFloat)) { return CPTDecimalNaN(); } else { - NSString *stringValue = [[NSString alloc] initWithFormat:@"%f", aCGFloat]; + NSString *stringValue = [[NSString alloc] initWithFormat:@"%f", (double)aCGFloat]; NSDecimal result = CPTDecimalFromString(stringValue); return result; @@ -516,7 +575,7 @@ NSDecimal CPTDecimalFromCGFloat(CGFloat aCGFloat) * @param stringRepresentation The string value. * @return The numeric value extracted from the string. **/ -NSDecimal CPTDecimalFromString(NSString *stringRepresentation) +NSDecimal CPTDecimalFromString(NSString *__nonnull stringRepresentation) { // The following NSDecimalNumber-based creation of NSDecimal structs from strings is slower than // the NSScanner-based method: (307000 operations per second vs. 582000 operations per second for NSScanner) @@ -588,7 +647,18 @@ NSDecimal CPTDecimalDivide(NSDecimal numerator, NSDecimal denominator) { NSDecimal result; - NSDecimalDivide(&result, &numerator, &denominator, NSRoundBankers); + NSCalculationError calcError = NSDecimalDivide(&result, &numerator, &denominator, NSRoundBankers); + + switch ( calcError ) { + case NSCalculationUnderflow: + case NSCalculationDivideByZero: + result = CPTDecimalFromInteger(0); + break; + + default: + // no error--return the result of the division + break; + } return result; } @@ -662,7 +732,7 @@ BOOL CPTDecimalEquals(NSDecimal leftOperand, NSDecimal rightOperand) **/ NSDecimal CPTDecimalNaN(void) { - return [[NSDecimalNumber notANumber] decimalValue]; + return [NSDecimalNumber notANumber].decimalValue; } /** @@ -673,7 +743,13 @@ NSDecimal CPTDecimalNaN(void) **/ NSDecimal CPTDecimalMin(NSDecimal leftOperand, NSDecimal rightOperand) { - if ( NSDecimalCompare(&leftOperand, &rightOperand) == NSOrderedAscending ) { + if ( NSDecimalIsNotANumber(&leftOperand)) { + return rightOperand; + } + else if ( NSDecimalIsNotANumber(&rightOperand)) { + return leftOperand; + } + else if ( NSDecimalCompare(&leftOperand, &rightOperand) == NSOrderedAscending ) { return leftOperand; } else { @@ -689,7 +765,13 @@ NSDecimal CPTDecimalMin(NSDecimal leftOperand, NSDecimal rightOperand) **/ NSDecimal CPTDecimalMax(NSDecimal leftOperand, NSDecimal rightOperand) { - if ( NSDecimalCompare(&leftOperand, &rightOperand) == NSOrderedDescending ) { + if ( NSDecimalIsNotANumber(&leftOperand)) { + return rightOperand; + } + else if ( NSDecimalIsNotANumber(&rightOperand)) { + return leftOperand; + } + else if ( NSDecimalCompare(&leftOperand, &rightOperand) == NSOrderedDescending ) { return leftOperand; } else { @@ -704,11 +786,11 @@ NSDecimal CPTDecimalMax(NSDecimal leftOperand, NSDecimal rightOperand) **/ NSDecimal CPTDecimalAbs(NSDecimal value) { - if ( CPTDecimalGreaterThanOrEqualTo( value, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalGreaterThanOrEqualTo(value, CPTDecimalFromInteger(0))) { return value; } else { - return CPTDecimalMultiply( value, CPTDecimalFromInteger(-1) ); + return CPTDecimalMultiply(value, CPTDecimalFromInteger(-1)); } } @@ -730,7 +812,7 @@ NSRange CPTExpandedRange(NSRange range, NSInteger expandBy) NSInteger lowerExpansion = (NSInteger)range.location - loc; NSInteger length = MAX(0, (NSInteger)range.length + lowerExpansion + expandBy); - return NSMakeRange( (NSUInteger)loc, (NSUInteger)length ); + return NSMakeRange((NSUInteger)loc, (NSUInteger)length); } #pragma mark - @@ -744,7 +826,7 @@ NSRange CPTExpandedRange(NSRange range, NSInteger expandBy) * @param color The color. * @return The RGBA components of the color. **/ -CPTRGBAColor CPTRGBAColorFromCGColor(CGColorRef color) +CPTRGBAColor CPTRGBAColorFromCGColor(__nonnull CGColorRef color) { CPTRGBAColor rgbColor; @@ -798,14 +880,14 @@ CPTCoordinate CPTOrthogonalCoordinate(CPTCoordinate coord) * @param point The point in user space. * @return The device aligned point in user space. **/ -CGPoint CPTAlignPointToUserSpace(CGContextRef context, CGPoint point) +CGPoint CPTAlignPointToUserSpace(__nonnull CGContextRef context, CGPoint point) { // Compute the coordinates of the point in device space. point = CGContextConvertPointToDeviceSpace(context, point); // Ensure that coordinates are at exactly the corner // of a device pixel. - point.x = round( point.x - CPTFloat(0.5) ) + CPTFloat(0.5); + point.x = round(point.x - CPTFloat(0.5)) + CPTFloat(0.5); point.y = ceil(point.y) - CPTFloat(0.5); // Convert the device aligned coordinate back to user space. @@ -822,7 +904,7 @@ CGPoint CPTAlignPointToUserSpace(CGContextRef context, CGPoint point) * @param size The size in user space. * @return The device aligned size in user space. **/ -CGSize CPTAlignSizeToUserSpace(CGContextRef context, CGSize size) +CGSize CPTAlignSizeToUserSpace(__nonnull CGContextRef context, CGSize size) { // Compute the size in device space. size = CGContextConvertSizeToDeviceSpace(context, size); @@ -846,17 +928,17 @@ CGSize CPTAlignSizeToUserSpace(CGContextRef context, CGSize size) * @param rect The rectangle in user space. * @return The device aligned rectangle in user space. **/ -CGRect CPTAlignRectToUserSpace(CGContextRef context, CGRect rect) +CGRect CPTAlignRectToUserSpace(__nonnull CGContextRef context, CGRect rect) { rect = CGContextConvertRectToDeviceSpace(context, rect); CGPoint oldOrigin = rect.origin; - rect.origin.x = round( rect.origin.x - CPTFloat(0.5) ); - rect.size.width = round( oldOrigin.x + rect.size.width - CPTFloat(0.5) ) - rect.origin.x; + rect.origin.x = round(rect.origin.x - CPTFloat(0.5)); + rect.size.width = round(oldOrigin.x + rect.size.width - CPTFloat(0.5)) - rect.origin.x; rect.origin.x += CPTFloat(0.5); - rect.origin.y = ceil( CGRectGetMaxY(rect) ) - CPTFloat(0.5); + rect.origin.y = ceil(CGRectGetMaxY(rect)) - CPTFloat(0.5); rect.size.height = ceil(oldOrigin.y - CPTFloat(0.5) - rect.origin.y); return CGContextConvertRectToUserSpace(context, rect); @@ -874,12 +956,12 @@ CGRect CPTAlignRectToUserSpace(CGContextRef context, CGRect rect) * @param point The point in user space. * @return The device aligned point in user space. **/ -CGPoint CPTAlignIntegralPointToUserSpace(CGContextRef context, CGPoint point) +CGPoint CPTAlignIntegralPointToUserSpace(__nonnull CGContextRef context, CGPoint point) { point = CGContextConvertPointToDeviceSpace(context, point); point.x = round(point.x); - point.y = ceil( point.y - CPTFloat(0.5) ); + point.y = ceil(point.y - CPTFloat(0.5)); return CGContextConvertPointToUserSpace(context, point); } @@ -894,7 +976,7 @@ CGPoint CPTAlignIntegralPointToUserSpace(CGContextRef context, CGPoint point) * @param rect The rectangle in user space. * @return The device aligned rectangle in user space. **/ -CGRect CPTAlignIntegralRectToUserSpace(CGContextRef context, CGRect rect) +CGRect CPTAlignIntegralRectToUserSpace(__nonnull CGContextRef context, CGRect rect) { rect = CGContextConvertRectToDeviceSpace(context, rect); @@ -903,25 +985,25 @@ CGRect CPTAlignIntegralRectToUserSpace(CGContextRef context, CGRect rect) rect.origin.x = round(rect.origin.x); rect.size.width = round(oldOrigin.x + rect.size.width) - rect.origin.x; - rect.origin.y = ceil( CGRectGetMaxY(rect) - CPTFloat(0.5) ); + rect.origin.y = ceil(CGRectGetMaxY(rect) - CPTFloat(0.5)); rect.size.height = ceil(oldOrigin.y - CPTFloat(0.5) - rect.origin.y); return CGContextConvertRectToUserSpace(context, rect); } -CGRect CPTAlignBorderedRectToUserSpace(CGContextRef context, CGRect rect, CPTLineStyle *borderLineStyle) +CGRect CPTAlignBorderedRectToUserSpace(__nonnull CGContextRef context, CGRect rect, CPTLineStyle *__nonnull borderLineStyle) { CGRect borderRect; CGFloat contextScale = CPTFloat(1.0); - if ( rect.size.height != CPTFloat(0.0) ) { + if ( rect.size.height != CPTFloat(0.0)) { CGRect deviceRect = CGContextConvertRectToDeviceSpace(context, rect); contextScale = deviceRect.size.height / rect.size.height; } - if ( contextScale != CPTFloat(1.0) ) { + if ( contextScale != CPTFloat(1.0)) { CGFloat borderWidth = borderLineStyle.lineWidth; - if ( ( borderWidth > CPTFloat(0.0) ) && ( borderWidth == round(borderWidth) ) ) { + if ((borderWidth > CPTFloat(0.0)) && (borderWidth == round(borderWidth))) { borderRect = CPTAlignIntegralRectToUserSpace(context, rect); } else { @@ -942,27 +1024,36 @@ CGRect CPTAlignBorderedRectToUserSpace(CGContextRef context, CGRect rect, CPTLin * @param point The point. * @return A string with the format {x, y}. **/ -NSString *CPTStringFromPoint(CGPoint point) +NSString *__nonnull CPTStringFromPoint(CGPoint point) { - return [NSString stringWithFormat:@"{%g, %g}", point.x, point.y]; + return [NSString stringWithFormat:@"{%g, %g}", (double)point.x, (double)point.y]; } /** @brief Creates a string representation of the given size. * @param size The size. * @return A string with the format {width, height}. **/ -NSString *CPTStringFromSize(CGSize size) +NSString *__nonnull CPTStringFromSize(CGSize size) { - return [NSString stringWithFormat:@"{%g, %g}", size.width, size.height]; + return [NSString stringWithFormat:@"{%g, %g}", (double)size.width, (double)size.height]; } /** @brief Creates a string representation of the given rectangle. * @param rect The rectangle. * @return A string with the format {{x, y}, {width, height}}. **/ -NSString *CPTStringFromRect(CGRect rect) +NSString *__nonnull CPTStringFromRect(CGRect rect) +{ + return [NSString stringWithFormat:@"{{%g, %g}, {%g, %g}}", (double)rect.origin.x, (double)rect.origin.y, (double)rect.size.width, (double)rect.size.height]; +} + +/** @brief Creates a string representation of the given vector. + * @param vector The vector. + * @return A string with the format {dx, dy}. + **/ +NSString *__nonnull CPTStringFromVector(CGVector vector) { - return [NSString stringWithFormat:@"{{%g, %g}, {%g, %g}}", rect.origin.x, rect.origin.y, rect.size.width, rect.size.height]; + return [NSString stringWithFormat:@"{%g, %g}", (double)vector.dx, (double)vector.dy]; } #pragma mark - @@ -1046,7 +1137,7 @@ BOOL CPTEdgeInsetsEqualToEdgeInsets(CPTEdgeInsets insets1, CPTEdgeInsets insets2 if ( value != 0.0 ) { double sign = (signbit(value) ? -1.0 : +1.0); - return sign * (pow( 10.0, fabs(value) ) - 1.0); + return sign * (pow(10.0, fabs(value)) - 1.0); } else { return 0.0; diff --git a/framework/Source/CPTUtilitiesTests.m b/framework/Source/CPTUtilitiesTests.m index 75726a79e..c8335a100 100644 --- a/framework/Source/CPTUtilitiesTests.m +++ b/framework/Source/CPTUtilitiesTests.m @@ -15,7 +15,7 @@ -(void)setUp const size_t height = 50; const size_t bitsPerComponent = 8; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); #else CGColorSpaceRef colorSpace = CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB); @@ -50,7 +50,7 @@ -(void)testCPTDecimalIntegerValue XCTAssertEqual(CPTDecimalIntegerValue([d decimalValue]), (NSInteger)42, @"Result incorrect"); d = [NSDecimalNumber decimalNumberWithString:@"42.1"]; - XCTAssertEqual( (NSInteger)CPTDecimalIntegerValue([d decimalValue]), (NSInteger)42, @"Result incorrect" ); + XCTAssertEqual((NSInteger)CPTDecimalIntegerValue([d decimalValue]), (NSInteger)42, @"Result incorrect"); } -(void)testCPTDecimalFloatValue @@ -82,14 +82,14 @@ -(void)testToDecimalConversion XCTAssertEqualObjects([NSDecimalNumber decimalNumberWithString:@"100"], [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromInteger(i)], @"NSInteger to NSDecimal conversion failed"); XCTAssertEqualObjects([NSDecimalNumber decimalNumberWithString:@"100"], [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromUnsignedInteger(unsignedI)], @"NSUInteger to NSDecimal conversion failed"); - XCTAssertEqualWithAccuracy([@(f)floatValue], [[NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromFloat(f)] floatValue], 1.0e-7, @"float to NSDecimal conversion failed"); + XCTAssertEqualWithAccuracy([@(f) floatValue], [[NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromFloat(f)] floatValue], 1.0e-7f, @"float to NSDecimal conversion failed"); XCTAssertEqualObjects(@(d), [NSDecimalNumber decimalNumberWithDecimal:CPTDecimalFromDouble(d)], @"double to NSDecimal conversion failed."); } -(void)testConvertNegativeOne { - NSDecimal zero = [[NSDecimalNumber zero] decimalValue]; - NSDecimal one = [[NSDecimalNumber one] decimalValue]; + NSDecimal zero = [NSDecimalNumber zero].decimalValue; + NSDecimal one = [NSDecimalNumber one].decimalValue; NSDecimal negativeOne; NSDecimalSubtract(&negativeOne, &zero, &one, NSRoundPlain); @@ -122,12 +122,136 @@ -(void)testConvertNegativeOne XCTAssertTrue(NSDecimalCompare(&testValue, &negativeOne) == NSOrderedSame, @"%@", errMessage); } +#pragma mark - +#pragma mark Decimal utilities + +-(void)testDecimalMax +{ + NSDecimal zero = CPTDecimalFromInteger(0); + NSDecimal one = CPTDecimalFromInteger(1); + NSDecimal dNAN = CPTDecimalNaN(); + + NSDecimal testValue; + NSString *errMessage; + + testValue = CPTDecimalMin(zero, one); + errMessage = [NSString stringWithFormat:@"test min(0, 1), expected %@", NSDecimalString(&zero, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &zero) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(one, zero); + errMessage = [NSString stringWithFormat:@"test min(1, 0), expected %@", NSDecimalString(&zero, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &zero) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(one, dNAN); + errMessage = [NSString stringWithFormat:@"test min(1, NAN), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(dNAN, one); + errMessage = [NSString stringWithFormat:@"test min(NAN, 1), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(dNAN, dNAN); + errMessage = [NSString stringWithFormat:@"test min(NAN, NAN), expected %@", NSDecimalString(&dNAN, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &dNAN) == NSOrderedSame, @"%@", errMessage); +} + +-(void)testDecimalMin +{ + NSDecimal zero = CPTDecimalFromInteger(0); + NSDecimal one = CPTDecimalFromInteger(1); + NSDecimal dNAN = CPTDecimalNaN(); + + NSDecimal testValue; + NSString *errMessage; + + testValue = CPTDecimalMax(zero, one); + errMessage = [NSString stringWithFormat:@"test min(0, 1), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMax(one, zero); + errMessage = [NSString stringWithFormat:@"test min(1, 0), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMax(one, dNAN); + errMessage = [NSString stringWithFormat:@"test min(1, NAN), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMax(dNAN, one); + errMessage = [NSString stringWithFormat:@"test min(NAN, 1), expected %@", NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalMin(dNAN, dNAN); + errMessage = [NSString stringWithFormat:@"test min(NAN, NAN), expected %@", NSDecimalString(&dNAN, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &dNAN) == NSOrderedSame, @"%@", errMessage); +} + +-(void)testDecimalAbs +{ + NSDecimal zero = CPTDecimalFromInteger(0); + NSDecimal one = CPTDecimalFromInteger(1); + NSDecimal negativeOne = CPTDecimalFromInteger(-1); + + NSDecimal testValue; + NSString *errMessage; + + testValue = CPTDecimalAbs(one); + errMessage = [NSString stringWithFormat:@"test value was %@, expected %@", NSDecimalString(&testValue, nil), NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalAbs(zero); + errMessage = [NSString stringWithFormat:@"test value was %@, expected %@", NSDecimalString(&testValue, nil), NSDecimalString(&zero, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &zero) == NSOrderedSame, @"%@", errMessage); + + testValue = CPTDecimalAbs(negativeOne); + errMessage = [NSString stringWithFormat:@"test value was %@, expected %@", NSDecimalString(&testValue, nil), NSDecimalString(&one, nil)]; + XCTAssertTrue(NSDecimalCompare(&testValue, &one) == NSOrderedSame, @"%@", errMessage); +} + +#pragma mark - +#pragma mark NSDecimalNumber tests + +// Fix issues with incorrect values when converting NSDecimalNumber to non-double values (due to bugs in NSDecimalNumber, see radar #32520109) +-(void)testNSDecimalNumberBugFix +{ + NSArray *strings = + @[ + @"0", // validation tests + @"1", + @"1.8446744073709551615", // 64/65 bit tests (radar 32520109) + @"1.8446744073709551616", + @"9.821426272392280061", // radar 25465729 tests + @"9.821426272392280060", + ]; + + for ( NSString *string in strings ) { + NSDecimalNumber *v = [NSDecimalNumber decimalNumberWithString:string]; + NSDecimal d = v.decimalValue; + double expectedDouble = v.doubleValue; + + XCTAssertEqual(CPTDecimalCharValue(d), (char)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedCharValue(d), (unsigned char)expectedDouble); + XCTAssertEqual(CPTDecimalShortValue(d), (short)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedShortValue(d), (unsigned short)expectedDouble); + XCTAssertEqual(CPTDecimalIntValue(d), (int)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedIntValue(d), (unsigned int)expectedDouble); + XCTAssertEqual(CPTDecimalLongValue(d), (long)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedLongValue(d), (unsigned long)expectedDouble); + XCTAssertEqual(CPTDecimalLongLongValue(d), (long long)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedLongLongValue(d), (unsigned long long)expectedDouble); + + XCTAssertEqual(CPTDecimalFloatValue(d), (float)expectedDouble); + + XCTAssertEqual(CPTDecimalIntegerValue(d), (NSInteger)expectedDouble); + XCTAssertEqual(CPTDecimalUnsignedIntegerValue(d), (NSUInteger)expectedDouble); + } +} + #pragma mark - #pragma mark Cached values -(void)testCachedZero { - NSDecimal zero = [[NSDecimalNumber zero] decimalValue]; + NSDecimal zero = [NSDecimalNumber zero].decimalValue; NSDecimal testValue; NSString *errMessage; @@ -184,7 +308,7 @@ -(void)testCachedZero -(void)testCachedOne { - NSDecimal one = [[NSDecimalNumber one] decimalValue]; + NSDecimal one = [NSDecimalNumber one].decimalValue; NSDecimal testValue; NSString *errMessage; @@ -595,11 +719,11 @@ -(void)testInverseLogModulus { XCTAssertEqual(CPTInverseLogModulus(0.0), 0.0, @"CPTInverseLogModulus(0.0)"); - XCTAssertEqualWithAccuracy(CPTInverseLogModulus( log10(11.0) ), 10.0, 1.0e-7, @"CPTInverseLogModulus(log10(11.0))"); - XCTAssertEqualWithAccuracy(CPTInverseLogModulus( -log10(11.0) ), -10.0, 1.0e-7, @"CPTInverseLogModulus(-log10(11.0))"); + XCTAssertEqualWithAccuracy(CPTInverseLogModulus(log10(11.0)), 10.0, 1.0e-7, @"CPTInverseLogModulus(log10(11.0))"); + XCTAssertEqualWithAccuracy(CPTInverseLogModulus(-log10(11.0)), -10.0, 1.0e-7, @"CPTInverseLogModulus(-log10(11.0))"); - XCTAssertEqualWithAccuracy(CPTInverseLogModulus( log10(101.0) ), 100.0, 1.0e-7, @"CPTInverseLogModulus(log10(101.0))"); - XCTAssertEqualWithAccuracy(CPTInverseLogModulus( -log10(101.0) ), -100.0, 1.0e-7, @"CPTInverseLogModulus(-log10(101.0))"); + XCTAssertEqualWithAccuracy(CPTInverseLogModulus(log10(101.0)), 100.0, 1.0e-7, @"CPTInverseLogModulus(log10(101.0))"); + XCTAssertEqualWithAccuracy(CPTInverseLogModulus(-log10(101.0)), -100.0, 1.0e-7, @"CPTInverseLogModulus(-log10(101.0))"); } /// @endcond @@ -609,7 +733,7 @@ -(void)testInverseLogModulus /// @cond --(void)setContext:(CGContextRef)newContext +-(void)setContext:(nonnull CGContextRef)newContext { if ( context != newContext ) { CGContextRetain(newContext); diff --git a/framework/Source/CPTXYAxis.m b/framework/Source/CPTXYAxis.m index 92e8bdaee..9b0c117a4 100644 --- a/framework/Source/CPTXYAxis.m +++ b/framework/Source/CPTXYAxis.m @@ -16,11 +16,13 @@ /// @cond @interface CPTXYAxis() --(void)drawTicksInContext:(nonnull CGContextRef)context atLocations:(nullable CPTNumberSet)locations withLength:(CGFloat)length inRange:(nullable CPTPlotRange *)labeledRange isMajor:(BOOL)major; +-(void)drawTicksInContext:(nonnull CGContextRef)context atLocations:(nullable CPTNumberSet *)locations withLength:(CGFloat)length inRange:(nullable CPTPlotRange *)labeledRange isMajor:(BOOL)major; -(void)orthogonalCoordinateViewLowerBound:(nonnull CGFloat *)lower upperBound:(nonnull CGFloat *)upper; -(CGPoint)viewPointForOrthogonalCoordinate:(nullable NSNumber *)orthogonalCoord axisCoordinate:(nullable NSNumber *)coordinateValue; +-(NSUInteger)initialBandIndexForSortedLocations:(nonnull CPTNumberArray *)sortedLocations inRange:(nullable CPTMutablePlotRange *)range; + @end /// @endcond @@ -32,14 +34,14 @@ -(CGPoint)viewPointForOrthogonalCoordinate:(nullable NSNumber *)orthogonalCoord **/ @implementation CPTXYAxis -/** @property NSNumber *orthogonalPosition +/** @property nullable NSNumber *orthogonalPosition * @brief The data coordinate value where the axis crosses the orthogonal axis. * If the @ref axisConstraints is non-nil, the constraints take priority and this property is ignored. * @see @ref axisConstraints **/ @synthesize orthogonalPosition; -/** @property CPTConstraints *axisConstraints +/** @property nullable CPTConstraints *axisConstraints * @brief The constraints used when positioning relative to the plot area. * If @nil (the default), the axis is fixed relative to the plot space coordinates, * crossing the orthogonal axis at @ref orthogonalPosition and moves only @@ -63,9 +65,9 @@ @implementation CPTXYAxis * @param newFrame The frame rectangle. * @return The initialized CPTXYAxis object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { orthogonalPosition = @0.0; axisConstraints = nil; self.tickDirection = CPTSignNone; @@ -77,9 +79,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTXYAxis *theLayer = (CPTXYAxis *)layer; orthogonalPosition = theLayer->orthogonalPosition; @@ -95,7 +97,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -103,23 +105,37 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeObject:self.axisConstraints forKey:@"CPTXYAxis.axisConstraints"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - orthogonalPosition = [coder decodeObjectForKey:@"CPTXYAxis.orthogonalPosition"]; - axisConstraints = [coder decodeObjectForKey:@"CPTXYAxis.axisConstraints"]; + if ((self = [super initWithCoder:coder])) { + orthogonalPosition = [coder decodeObjectOfClass:[NSNumber class] + forKey:@"CPTXYAxis.orthogonalPosition"]; + axisConstraints = [coder decodeObjectOfClass:[CPTConstraints class] + forKey:@"CPTXYAxis.axisConstraints"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Coordinate Transforms /// @cond --(void)orthogonalCoordinateViewLowerBound:(CGFloat *)lower upperBound:(CGFloat *)upper +-(void)orthogonalCoordinateViewLowerBound:(nonnull CGFloat *)lower upperBound:(nonnull CGFloat *)upper { CPTCoordinate orthogonalCoordinate = CPTOrthogonalCoordinate(self.coordinate); CPTXYPlotSpace *xyPlotSpace = (CPTXYPlotSpace *)self.plotSpace; @@ -142,13 +158,13 @@ -(void)orthogonalCoordinateViewLowerBound:(CGFloat *)lower upperBound:(CGFloat * break; default: - *lower = NAN; - *upper = NAN; + *lower = CPTNAN; + *upper = CPTNAN; break; } } --(CGPoint)viewPointForOrthogonalCoordinate:(NSNumber *)orthogonalCoord axisCoordinate:(NSNumber *)coordinateValue +-(CGPoint)viewPointForOrthogonalCoordinate:(nullable NSNumber *)orthogonalCoord axisCoordinate:(nullable NSNumber *)coordinateValue { CPTCoordinate myCoordinate = self.coordinate; CPTCoordinate orthogonalCoordinate = CPTOrthogonalCoordinate(myCoordinate); @@ -163,7 +179,7 @@ -(CGPoint)viewPointForOrthogonalCoordinate:(NSNumber *)orthogonalCoord axisCoord return [self convertPoint:[self.plotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2] fromLayer:thePlotArea]; } --(CGPoint)viewPointForCoordinateValue:(NSNumber *)coordinateValue +-(CGPoint)viewPointForCoordinateValue:(nullable NSNumber *)coordinateValue { CGPoint point = [self viewPointForOrthogonalCoordinate:self.orthogonalPosition axisCoordinate:coordinateValue]; @@ -189,13 +205,13 @@ -(CGPoint)viewPointForCoordinateValue:(NSNumber *)coordinateValue } } - if ( isnan(point.x) || isnan(point.y) ) { - NSLog( @"[CPTXYAxis viewPointForCoordinateValue:%@] was %@", coordinateValue, CPTStringFromPoint(point) ); + if ( isnan(point.x) || isnan(point.y)) { + NSLog(@"[CPTXYAxis viewPointForCoordinateValue:%@] was %@", coordinateValue, CPTStringFromPoint(point)); - if ( isnan(point.x) ) { + if ( isnan(point.x)) { point.x = CPTFloat(0.0); } - if ( isnan(point.y) ) { + if ( isnan(point.y)) { point.y = CPTFloat(0.0); } } @@ -210,7 +226,7 @@ -(CGPoint)viewPointForCoordinateValue:(NSNumber *)coordinateValue /// @cond --(void)drawTicksInContext:(CGContextRef)context atLocations:(CPTNumberSet)locations withLength:(CGFloat)length inRange:(CPTPlotRange *)labeledRange isMajor:(BOOL)major +-(void)drawTicksInContext:(nonnull CGContextRef)context atLocations:(nullable CPTNumberSet *)locations withLength:(CGFloat)length inRange:(nullable CPTPlotRange *)labeledRange isMajor:(BOOL)major { CPTLineStyle *lineStyle = (major ? self.majorTickLineStyle : self.minorTickLineStyle); @@ -221,7 +237,7 @@ -(void)drawTicksInContext:(CGContextRef)context atLocations:(CPTNumberSet)locati CGFloat lineWidth = lineStyle.lineWidth; CPTAlignPointFunction alignmentFunction = NULL; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } else { @@ -284,7 +300,7 @@ -(void)drawTicksInContext:(CGContextRef)context atLocations:(CPTNumberSet)locati [lineStyle strokePathInContext:context]; } --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -332,7 +348,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context CPTAlignPointFunction alignmentFunction = CPTAlignPointToUserSpace; if ( theLineStyle ) { CGFloat lineWidth = theLineStyle.lineWidth; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } @@ -349,11 +365,11 @@ -(void)renderAsVectorInContext:(CGContextRef)context if ( minCap || maxCap ) { switch ( self.coordinate ) { case CPTCoordinateX: - axisDirection = ( range.lengthDouble >= CPTFloat(0.0) ) ? CPTPointMake(1.0, 0.0) : CPTPointMake(-1.0, 0.0); + axisDirection = (range.lengthDouble >= 0.0) ? CPTPointMake(1.0, 0.0) : CPTPointMake(-1.0, 0.0); break; case CPTCoordinateY: - axisDirection = ( range.lengthDouble >= CPTFloat(0.0) ) ? CPTPointMake(0.0, 1.0) : CPTPointMake(0.0, -1.0); + axisDirection = (range.lengthDouble >= 0.0) ? CPTPointMake(0.0, 1.0) : CPTPointMake(0.0, -1.0); break; default: @@ -380,7 +396,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context /// @cond --(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major +-(void)drawGridLinesInContext:(nonnull CGContextRef)context isMajor:(BOOL)major { CPTLineStyle *lineStyle = (major ? self.majorGridLineStyle : self.minorGridLineStyle); @@ -390,7 +406,7 @@ -(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major [self relabel]; CPTPlotSpace *thePlotSpace = self.plotSpace; - CPTNumberSet locations = (major ? self.majorTickLocations : self.minorTickLocations); + CPTNumberSet *locations = (major ? self.majorTickLocations : self.minorTickLocations); CPTCoordinate selfCoordinate = self.coordinate; CPTCoordinate orthogonalCoordinate = CPTOrthogonalCoordinate(selfCoordinate); CPTMutablePlotRange *orthogonalRange = [[thePlotSpace plotRangeForCoordinate:orthogonalCoordinate] mutableCopy]; @@ -427,7 +443,7 @@ -(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major CGFloat lineWidth = lineStyle.lineWidth; CPTAlignPointFunction alignmentFunction = NULL; - if ( ( self.contentsScale > CPTFloat(1.0) ) && (round(lineWidth) == lineWidth) ) { + if ((self.contentsScale > CPTFloat(1.0)) && (round(lineWidth) == lineWidth)) { alignmentFunction = CPTAlignIntegralPointToUserSpace; } else { @@ -478,13 +494,110 @@ -(void)drawGridLinesInContext:(CGContextRef)context isMajor:(BOOL)major /// @cond --(void)drawBackgroundBandsInContext:(CGContextRef)context +-(NSUInteger)initialBandIndexForSortedLocations:(CPTNumberArray *)sortedLocations inRange:(CPTMutablePlotRange *)range +{ + NSUInteger bandIndex = 0; + + NSNumber *bandAnchor = self.alternatingBandAnchor; + NSUInteger bandCount = self.alternatingBandFills.count; + + if ( bandAnchor && (bandCount > 0)) { + NSDecimal anchor = bandAnchor.decimalValue; + + CPTPlotRange *theVisibleRange = self.visibleRange; + if ( theVisibleRange ) { + [range intersectionPlotRange:theVisibleRange]; + } + + NSDecimal rangeStart; + if ( range.lengthDouble >= 0.0 ) { + rangeStart = range.minLimitDecimal; + } + else { + rangeStart = range.maxLimitDecimal; + } + + NSDecimal origin = self.labelingOrigin.decimalValue; + NSDecimal offset = CPTDecimalSubtract(anchor, origin); + NSDecimalRound(&offset, &offset, 0, NSRoundDown); + + const NSDecimal zero = CPTDecimalFromInteger(0); + + // Set starting coord--should be the smallest value >= rangeMin that is a whole multiple of majorInterval away from the alternatingBandAnchor + NSDecimal coord = zero; + NSDecimal majorInterval = zero; + + switch ( self.labelingPolicy ) { + case CPTAxisLabelingPolicyAutomatic: + case CPTAxisLabelingPolicyEqualDivisions: + if ( sortedLocations.count > 1 ) { + if ( range.lengthDouble >= 0.0 ) { + majorInterval = CPTDecimalSubtract(sortedLocations[1].decimalValue, sortedLocations[0].decimalValue); + } + else { + majorInterval = CPTDecimalSubtract(sortedLocations[0].decimalValue, sortedLocations[1].decimalValue); + } + } + break; + + case CPTAxisLabelingPolicyFixedInterval: + { + majorInterval = self.majorIntervalLength.decimalValue; + } + break; + + case CPTAxisLabelingPolicyLocationsProvided: + case CPTAxisLabelingPolicyNone: + { + // user provided tick locations; they're not guaranteed to be evenly spaced, but band drawing always starts with the first location + if ( range.lengthDouble >= 0.0 ) { + for ( NSNumber *location in sortedLocations ) { + if ( CPTDecimalLessThan(anchor, location.decimalValue)) { + break; + } + + bandIndex++; + } + } + else { + for ( NSNumber *location in sortedLocations ) { + if ( CPTDecimalGreaterThanOrEqualTo(anchor, location.decimalValue)) { + break; + } + + bandIndex++; + } + } + + bandIndex = bandIndex % bandCount; + } + break; + } + + if ( !CPTDecimalEquals(majorInterval, zero)) { + coord = CPTDecimalDivide(CPTDecimalSubtract(rangeStart, origin), majorInterval); + NSDecimalRound(&coord, &coord, 0, NSRoundUp); + NSInteger stepCount = CPTDecimalIntegerValue(coord) + CPTDecimalIntegerValue(offset) + 1; + + if ( stepCount >= 0 ) { + bandIndex = (NSUInteger)(stepCount % (NSInteger)bandCount); + } + else { + bandIndex = (NSUInteger)(-stepCount % (NSInteger)bandCount); + } + } + } + + return bandIndex; +} + +-(void)drawBackgroundBandsInContext:(nonnull CGContextRef)context { - CPTFillArray bandArray = self.alternatingBandFills; - NSUInteger bandCount = bandArray.count; + CPTFillArray *bandArray = self.alternatingBandFills; + NSUInteger bandCount = bandArray.count; if ( bandCount > 0 ) { - CPTNumberArray locations = [self.majorTickLocations allObjects]; + CPTNumberArray *locations = self.majorTickLocations.allObjects; if ( locations.count > 0 ) { CPTPlotSpace *thePlotSpace = self.plotSpace; @@ -506,10 +619,10 @@ -(void)drawBackgroundBandsInContext:(CGContextRef)context [orthogonalRange intersectionPlotRange:theGridLineRange]; } - NSDecimal zero = CPTDecimalFromInteger(0); + const NSDecimal zero = CPTDecimalFromInteger(0); NSSortDescriptor *sortDescriptor = nil; if ( range ) { - if ( CPTDecimalGreaterThanOrEqualTo(range.lengthDecimal, zero) ) { + if ( CPTDecimalGreaterThanOrEqualTo(range.lengthDecimal, zero)) { sortDescriptor = [[NSSortDescriptor alloc] initWithKey:nil ascending:YES]; } else { @@ -521,8 +634,10 @@ -(void)drawBackgroundBandsInContext:(CGContextRef)context } locations = [locations sortedArrayUsingDescriptors:@[sortDescriptor]]; - NSUInteger bandIndex = 0; - id null = [NSNull null]; + NSUInteger bandIndex = [self initialBandIndexForSortedLocations:locations inRange:range]; + + const id null = [NSNull null]; + NSDecimal lastLocation; if ( range ) { lastLocation = range.locationDecimal; @@ -543,8 +658,8 @@ -(void)drawBackgroundBandsInContext:(CGContextRef)context } for ( NSDecimalNumber *location in locations ) { - NSDecimal currentLocation = [location decimalValue]; - if ( !CPTDecimalEquals(CPTDecimalSubtract(currentLocation, lastLocation), zero) ) { + NSDecimal currentLocation = location.decimalValue; + if ( !CPTDecimalEquals(CPTDecimalSubtract(currentLocation, lastLocation), zero)) { CPTFill *bandFill = bandArray[bandIndex++]; bandIndex %= bandCount; @@ -558,10 +673,10 @@ -(void)drawBackgroundBandsInContext:(CGContextRef)context CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint numberOfCoordinates:2]; // Fill band - CGRect fillRect = CPTRectMake( MIN(startViewPoint.x, endViewPoint.x), - MIN(startViewPoint.y, endViewPoint.y), - ABS(endViewPoint.x - startViewPoint.x), - ABS(endViewPoint.y - startViewPoint.y) ); + CGRect fillRect = CPTRectMake(MIN(startViewPoint.x, endViewPoint.x), + MIN(startViewPoint.y, endViewPoint.y), + ABS(endViewPoint.x - startViewPoint.x), + ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPTAlignIntegralRectToUserSpace(context, fillRect) inContext:context]; } } @@ -577,7 +692,7 @@ -(void)drawBackgroundBandsInContext:(CGContextRef)context else { endLocation = CPTDecimalNaN(); } - if ( !CPTDecimalEquals(lastLocation, endLocation) ) { + if ( !CPTDecimalEquals(lastLocation, endLocation)) { CPTFill *bandFill = bandArray[bandIndex]; if ( bandFill != null ) { @@ -590,10 +705,10 @@ -(void)drawBackgroundBandsInContext:(CGContextRef)context CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint numberOfCoordinates:2]; // Fill band - CGRect fillRect = CPTRectMake( MIN(startViewPoint.x, endViewPoint.x), - MIN(startViewPoint.y, endViewPoint.y), - ABS(endViewPoint.x - startViewPoint.x), - ABS(endViewPoint.y - startViewPoint.y) ); + CGRect fillRect = CPTRectMake(MIN(startViewPoint.x, endViewPoint.x), + MIN(startViewPoint.y, endViewPoint.y), + ABS(endViewPoint.x - startViewPoint.x), + ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPTAlignIntegralRectToUserSpace(context, fillRect) inContext:context]; } } @@ -601,9 +716,9 @@ -(void)drawBackgroundBandsInContext:(CGContextRef)context } } --(void)drawBackgroundLimitsInContext:(CGContextRef)context +-(void)drawBackgroundLimitsInContext:(nonnull CGContextRef)context { - CPTLimitBandArray limitArray = self.backgroundLimitBands; + CPTLimitBandArray *limitArray = self.backgroundLimitBands; if ( limitArray.count > 0 ) { CPTPlotSpace *thePlotSpace = self.plotSpace; @@ -648,10 +763,10 @@ -(void)drawBackgroundLimitsInContext:(CGContextRef)context CGPoint endViewPoint = [thePlotSpace plotAreaViewPointForPlotPoint:endPlotPoint numberOfCoordinates:2]; // Fill band - CGRect fillRect = CPTRectMake( MIN(startViewPoint.x, endViewPoint.x), - MIN(startViewPoint.y, endViewPoint.y), - ABS(endViewPoint.x - startViewPoint.x), - ABS(endViewPoint.y - startViewPoint.y) ); + CGRect fillRect = CPTRectMake(MIN(startViewPoint.x, endViewPoint.x), + MIN(startViewPoint.y, endViewPoint.y), + ABS(endViewPoint.x - startViewPoint.x), + ABS(endViewPoint.y - startViewPoint.y)); [bandFill fillRect:CPTAlignIntegralRectToUserSpace(context, fillRect) inContext:context]; } } @@ -666,14 +781,14 @@ -(void)drawBackgroundLimitsInContext:(CGContextRef)context /// @cond --(NSString *)description +-(nullable NSString *)description { CPTPlotRange *range = [self.plotSpace plotRangeForCoordinate:self.coordinate]; CGPoint startViewPoint = [self viewPointForCoordinateValue:range.location]; CGPoint endViewPoint = [self viewPointForCoordinateValue:range.end]; return [NSString stringWithFormat:@"<%@ with range: %@ viewCoordinates: %@ to %@>", - [super description], + super.description, range, CPTStringFromPoint(startViewPoint), CPTStringFromPoint(endViewPoint)]; @@ -687,7 +802,7 @@ -(NSString *)description /// @cond // Center title in the plot range by default --(NSNumber *)defaultTitleLocation +-(nonnull NSNumber *)defaultTitleLocation { NSNumber *location; @@ -709,8 +824,8 @@ -(NSNumber *)defaultTitleLocation double loc = axisRange.locationDouble; double end = axisRange.endDouble; - if ( (loc > 0.0) && (end >= 0.0) ) { - location = @( pow(10.0, ( log10(loc) + log10(end) ) / 2.0) ); + if ((loc > 0.0) && (end >= 0.0)) { + location = @(pow(10.0, (log10(loc) + log10(end)) / 2.0)); } else { location = axisRange.midPoint; @@ -723,7 +838,7 @@ -(NSNumber *)defaultTitleLocation double loc = axisRange.locationDouble; double end = axisRange.endDouble; - location = @( CPTInverseLogModulus( ( CPTLogModulus(loc) + CPTLogModulus(end) ) / 2.0 ) ); + location = @(CPTInverseLogModulus((CPTLogModulus(loc) + CPTLogModulus(end)) / 2.0)); } break; @@ -746,7 +861,7 @@ -(NSNumber *)defaultTitleLocation /// @cond --(void)setAxisConstraints:(CPTConstraints *)newConstraints +-(void)setAxisConstraints:(nullable CPTConstraints *)newConstraints { if ( ![axisConstraints isEqualToConstraint:newConstraints] ) { axisConstraints = newConstraints; @@ -755,12 +870,13 @@ -(void)setAxisConstraints:(CPTConstraints *)newConstraints } } --(void)setOrthogonalPosition:(NSNumber *)newPosition +-(void)setOrthogonalPosition:(nullable NSNumber *)newPosition { BOOL needsUpdate = YES; if ( newPosition ) { - needsUpdate = ![orthogonalPosition isEqualToNumber:newPosition]; + NSNumber *position = newPosition; + needsUpdate = ![orthogonalPosition isEqualToNumber:position]; } if ( needsUpdate ) { @@ -773,7 +889,7 @@ -(void)setOrthogonalPosition:(NSNumber *)newPosition -(void)setCoordinate:(CPTCoordinate)newCoordinate { if ( self.coordinate != newCoordinate ) { - [super setCoordinate:newCoordinate]; + super.coordinate = newCoordinate; switch ( newCoordinate ) { case CPTCoordinateX: switch ( self.labelAlignment ) { diff --git a/framework/Source/CPTXYAxisSet.m b/framework/Source/CPTXYAxisSet.m index b4aa6703a..70c48c5bf 100644 --- a/framework/Source/CPTXYAxisSet.m +++ b/framework/Source/CPTXYAxisSet.m @@ -10,12 +10,12 @@ **/ @implementation CPTXYAxisSet -/** @property CPTXYAxis *xAxis +/** @property nullable CPTXYAxis *xAxis * @brief The x-axis. **/ @dynamic xAxis; -/** @property CPTXYAxis *yAxis +/** @property nullable CPTXYAxis *yAxis * @brief The y-axis. **/ @dynamic yAxis; @@ -40,9 +40,9 @@ @implementation CPTXYAxisSet * @param newFrame The frame rectangle. * @return The initialized CPTXYAxisSet object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { CPTXYAxis *xAxis = [[CPTXYAxis alloc] initWithFrame:newFrame]; xAxis.coordinate = CPTCoordinateX; xAxis.tickDirection = CPTSignNegative; @@ -63,7 +63,7 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -80,7 +80,7 @@ -(void)renderAsVectorInContext:(CGContextRef)context CGFloat radius = superlayer.cornerRadius; - if ( radius > CPTFloat(0.0) ) { + if ( radius > CPTFloat(0.0)) { CGContextBeginPath(context); CPTAddRoundedRectPath(context, borderRect, radius); @@ -97,6 +97,9 @@ -(void)renderAsVectorInContext:(CGContextRef)context #pragma mark - #pragma mark Layout +/// @name Layout +/// @{ + /** * @brief Updates the layout of all sublayers. Sublayers (the axes) fill the plot area frame’s bounds. * @@ -118,8 +121,8 @@ -(void)layoutSublayers sublayerPosition = CGPointMake(-sublayerPosition.x, -sublayerPosition.y); CGRect subLayerFrame = CGRectMake(sublayerPosition.x, sublayerPosition.y, sublayerBounds.size.width, sublayerBounds.size.height); - CPTSublayerSet excludedSublayers = [self sublayersExcludedFromAutomaticLayout]; - Class layerClass = [CPTLayer class]; + CPTSublayerSet *excludedSublayers = self.sublayersExcludedFromAutomaticLayout; + Class layerClass = [CPTLayer class]; for ( CALayer *subLayer in self.sublayers ) { if ( [subLayer isKindOfClass:layerClass] && ![excludedSublayers containsObject:subLayer] ) { subLayer.frame = subLayerFrame; @@ -128,17 +131,19 @@ -(void)layoutSublayers } } +/// @} + #pragma mark - #pragma mark Accessors /// @cond --(CPTXYAxis *)xAxis +-(nullable CPTXYAxis *)xAxis { return (CPTXYAxis *)[self axisForCoordinate:CPTCoordinateX atIndex:0]; } --(CPTXYAxis *)yAxis +-(nullable CPTXYAxis *)yAxis { return (CPTXYAxis *)[self axisForCoordinate:CPTCoordinateY atIndex:0]; } diff --git a/framework/Source/CPTXYGraph.h b/framework/Source/CPTXYGraph.h index 90bca7639..a761dbd88 100644 --- a/framework/Source/CPTXYGraph.h +++ b/framework/Source/CPTXYGraph.h @@ -5,7 +5,10 @@ /// @name Initialization /// @{ --(nonnull instancetype)initWithFrame:(CGRect)newFrame xScaleType:(CPTScaleType)newXScaleType yScaleType:(CPTScaleType)newYScaleType; +-(nonnull instancetype)initWithFrame:(CGRect)newFrame xScaleType:(CPTScaleType)newXScaleType yScaleType:(CPTScaleType)newYScaleType NS_DESIGNATED_INITIALIZER; + +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithLayer:(nonnull id)layer NS_DESIGNATED_INITIALIZER; /// @} @end diff --git a/framework/Source/CPTXYGraph.m b/framework/Source/CPTXYGraph.m index 242619ad2..480c28bb6 100644 --- a/framework/Source/CPTXYGraph.m +++ b/framework/Source/CPTXYGraph.m @@ -21,12 +21,14 @@ @interface CPTXYGraph() **/ @implementation CPTXYGraph -/** @property CPTScaleType xScaleType +/** @internal + * @property CPTScaleType xScaleType * @brief The scale type for the x-axis. **/ @synthesize xScaleType; -/** @property CPTScaleType yScaleType +/** @internal + * @property CPTScaleType yScaleType * @brief The scale type for the y-axis. **/ @synthesize yScaleType; @@ -43,9 +45,9 @@ @implementation CPTXYGraph * @param newYScaleType The scale type for the y-axis. * @return The initialized CPTXYGraph object. **/ --(instancetype)initWithFrame:(CGRect)newFrame xScaleType:(CPTScaleType)newXScaleType yScaleType:(CPTScaleType)newYScaleType +-(nonnull instancetype)initWithFrame:(CGRect)newFrame xScaleType:(CPTScaleType)newXScaleType yScaleType:(CPTScaleType)newYScaleType { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { xScaleType = newXScaleType; yScaleType = newYScaleType; } @@ -65,7 +67,7 @@ -(instancetype)initWithFrame:(CGRect)newFrame xScaleType:(CPTScaleType)newXScale * @return The initialized CPTXYGraph object. * @see @link CPTXYGraph::initWithFrame:xScaleType:yScaleType: -initWithFrame:xScaleType:yScaleType: @endlink **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { return [self initWithFrame:newFrame xScaleType:CPTScaleTypeLinear yScaleType:CPTScaleTypeLinear]; } @@ -74,9 +76,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTXYGraph *theLayer = (CPTXYGraph *)layer; xScaleType = theLayer->xScaleType; @@ -92,7 +94,7 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -100,23 +102,35 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeInteger:self.yScaleType forKey:@"CPTXYGraph.yScaleType"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - xScaleType = (CPTScaleType)[coder decodeIntegerForKey : @"CPTXYGraph.xScaleType"]; - yScaleType = (CPTScaleType)[coder decodeIntegerForKey : @"CPTXYGraph.yScaleType"]; + if ((self = [super initWithCoder:coder])) { + xScaleType = (CPTScaleType)[coder decodeIntegerForKey:@"CPTXYGraph.xScaleType"]; + yScaleType = (CPTScaleType)[coder decodeIntegerForKey:@"CPTXYGraph.yScaleType"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Factory Methods /// @cond --(CPTPlotSpace *)newPlotSpace +-(nullable CPTPlotSpace *)newPlotSpace { CPTXYPlotSpace *space = [[CPTXYPlotSpace alloc] init]; @@ -125,7 +139,7 @@ -(CPTPlotSpace *)newPlotSpace return space; } --(CPTAxisSet *)newAxisSet +-(nullable CPTAxisSet *)newAxisSet { CPTXYAxisSet *newAxisSet = [[CPTXYAxisSet alloc] initWithFrame:self.bounds]; diff --git a/framework/Source/CPTXYPlotSpace.m b/framework/Source/CPTXYPlotSpace.m index 4896b0827..3b2750488 100644 --- a/framework/Source/CPTXYPlotSpace.m +++ b/framework/Source/CPTXYPlotSpace.m @@ -17,27 +17,27 @@ #import /// @cond -typedef NSMutableArray *CPTMutableAnimationArray; +typedef NSMutableArray CPTMutableAnimationArray; @interface CPTXYPlotSpace() --(CGFloat)viewCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(nullable CPTPlotRange *)range plotCoordinateValue:(NSDecimal)plotCoord; --(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(nullable CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord; +-(CGFloat)viewCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(nonnull CPTPlotRange *)range plotCoordinateValue:(NSDecimal)plotCoord; +-(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(nonnull CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord; --(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nullable CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord; +-(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nonnull CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord; --(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(nullable CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord; +-(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(nonnull CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord; --(NSDecimal)plotCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(nullable CPTPlotRange *)range boundsLength:(NSDecimal)boundsLength; --(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(nullable CPTPlotRange *)range boundsLength:(CGFloat)boundsLength; +-(NSDecimal)plotCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(nonnull CPTPlotRange *)range boundsLength:(NSDecimal)boundsLength; +-(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength; --(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nullable CPTPlotRange *)range boundsLength:(CGFloat)boundsLength; +-(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength; --(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(nullable CPTPlotRange *)range boundsLength:(CGFloat)boundsLength; +-(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength; --(CPTPlotRange *)constrainRange:(nonnull CPTPlotRange *)existingRange toGlobalRange:(nullable CPTPlotRange *)globalRange; +-(nonnull CPTPlotRange *)constrainRange:(nonnull CPTPlotRange *)existingRange toGlobalRange:(nullable CPTPlotRange *)globalRange; -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shift momentumTime:(CGFloat)momentumTime speed:(CGFloat)speed acceleration:(CGFloat)acceleration; --(CPTPlotRange *)shiftRange:(nonnull CPTPlotRange *)oldRange by:(NSDecimal)shift usingMomentum:(BOOL)momentum inGlobalRange:(nullable CPTPlotRange *)globalRange withDisplacement:(CGFloat *)displacement; +-(nullable CPTPlotRange *)shiftRange:(nonnull CPTPlotRange *)oldRange by:(NSDecimal)shift usingMomentum:(BOOL)momentum inGlobalRange:(nullable CPTPlotRange *)globalRange withDisplacement:(CGFloat *)displacement; -(CGFloat)viewCoordinateForRange:(nullable CPTPlotRange *)range coordinate:(CPTCoordinate)coordinate direction:(BOOL)direction; @@ -48,7 +48,7 @@ -(CGFloat)viewCoordinateForRange:(nullable CPTPlotRange *)range coordinate:(CPTC @property (nonatomic, readwrite) CGPoint lastDisplacement; @property (nonatomic, readwrite) NSTimeInterval lastDragTime; @property (nonatomic, readwrite) NSTimeInterval lastDeltaTime; -@property (nonatomic, readwrite, retain, nonnull) CPTMutableAnimationArray animations; +@property (nonatomic, readwrite, retain, nonnull) CPTMutableAnimationArray *animations; @end @@ -73,7 +73,7 @@ -(CGFloat)viewCoordinateForRange:(nullable CPTPlotRange *)range coordinate:(CPTC **/ @implementation CPTXYPlotSpace -/** @property CPTPlotRange *xRange +/** @property nonnull CPTPlotRange *xRange * @brief The range of the x coordinate. Defaults to a range with @link CPTPlotRange::location location @endlink zero (@num{0}) * and a @link CPTPlotRange::length length @endlink of one (@num{1}). * @@ -84,7 +84,7 @@ @implementation CPTXYPlotSpace **/ @synthesize xRange; -/** @property CPTPlotRange *yRange +/** @property nonnull CPTPlotRange *yRange * @brief The range of the y coordinate. Defaults to a range with @link CPTPlotRange::location location @endlink zero (@num{0}) * and a @link CPTPlotRange::length length @endlink of one (@num{1}). * @@ -95,7 +95,7 @@ @implementation CPTXYPlotSpace **/ @synthesize yRange; -/** @property CPTPlotRange *globalXRange +/** @property nullable CPTPlotRange *globalXRange * @brief The global range of the x coordinate to which the @ref xRange is constrained. * * If non-@nil, the @ref xRange and any changes to it will @@ -104,7 +104,7 @@ @implementation CPTXYPlotSpace **/ @synthesize globalXRange; -/** @property CPTPlotRange *globalYRange +/** @property nullable CPTPlotRange *globalYRange * @brief The global range of the y coordinate to which the @ref yRange is constrained. * * If non-@nil, the @ref yRange and any changes to it will @@ -196,9 +196,9 @@ @implementation CPTXYPlotSpace * * @return The initialized object. **/ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { xRange = [[CPTPlotRange alloc] initWithLocation:@0.0 length:@1.0]; yRange = [[CPTPlotRange alloc] initWithLocation:@0.0 length:@1.0]; globalXRange = nil; @@ -229,7 +229,7 @@ -(instancetype)init /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -241,8 +241,8 @@ -(void)encodeWithCoder:(NSCoder *)coder [coder encodeInteger:self.yScaleType forKey:@"CPTXYPlotSpace.yScaleType"]; [coder encodeBool:self.allowsMomentumX forKey:@"CPTXYPlotSpace.allowsMomentumX"]; [coder encodeBool:self.allowsMomentumY forKey:@"CPTXYPlotSpace.allowsMomentumY"]; - [coder encodeInt:self.momentumAnimationCurve forKey:@"CPTXYPlotSpace.momentumAnimationCurve"]; - [coder encodeInt:self.bounceAnimationCurve forKey:@"CPTXYPlotSpace.bounceAnimationCurve"]; + [coder encodeInteger:self.momentumAnimationCurve forKey:@"CPTXYPlotSpace.momentumAnimationCurve"]; + [coder encodeInteger:self.bounceAnimationCurve forKey:@"CPTXYPlotSpace.bounceAnimationCurve"]; [coder encodeCGFloat:self.momentumAcceleration forKey:@"CPTXYPlotSpace.momentumAcceleration"]; [coder encodeCGFloat:self.bounceAcceleration forKey:@"CPTXYPlotSpace.bounceAcceleration"]; [coder encodeCGFloat:self.minimumDisplacementToDrag forKey:@"CPTXYPlotSpace.minimumDisplacementToDrag"]; @@ -255,21 +255,25 @@ -(void)encodeWithCoder:(NSCoder *)coder // animations } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - CPTPlotRange *range = [coder decodeObjectForKey:@"CPTXYPlotSpace.xRange"]; + if ((self = [super initWithCoder:coder])) { + CPTPlotRange *range = [coder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTXYPlotSpace.xRange"]; if ( range ) { xRange = [range copy]; } - range = [coder decodeObjectForKey:@"CPTXYPlotSpace.yRange"]; + range = [coder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTXYPlotSpace.yRange"]; if ( range ) { yRange = [range copy]; } - globalXRange = [[coder decodeObjectForKey:@"CPTXYPlotSpace.globalXRange"] copy]; - globalYRange = [[coder decodeObjectForKey:@"CPTXYPlotSpace.globalYRange"] copy]; - xScaleType = (CPTScaleType)[coder decodeIntegerForKey : @"CPTXYPlotSpace.xScaleType"]; - yScaleType = (CPTScaleType)[coder decodeIntegerForKey : @"CPTXYPlotSpace.yScaleType"]; + globalXRange = [[coder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTXYPlotSpace.globalXRange"] copy]; + globalYRange = [[coder decodeObjectOfClass:[CPTPlotRange class] + forKey:@"CPTXYPlotSpace.globalYRange"] copy]; + xScaleType = (CPTScaleType)[coder decodeIntegerForKey:@"CPTXYPlotSpace.xScaleType"]; + yScaleType = (CPTScaleType)[coder decodeIntegerForKey:@"CPTXYPlotSpace.yScaleType"]; if ( [coder containsValueForKey:@"CPTXYPlotSpace.allowsMomentum"] ) { self.allowsMomentum = [coder decodeBoolForKey:@"CPTXYPlotSpace.allowsMomentum"]; @@ -278,8 +282,8 @@ -(instancetype)initWithCoder:(NSCoder *)coder allowsMomentumX = [coder decodeBoolForKey:@"CPTXYPlotSpace.allowsMomentumX"]; allowsMomentumY = [coder decodeBoolForKey:@"CPTXYPlotSpace.allowsMomentumY"]; } - momentumAnimationCurve = (CPTAnimationCurve)[coder decodeIntForKey : @"CPTXYPlotSpace.momentumAnimationCurve"]; - bounceAnimationCurve = (CPTAnimationCurve)[coder decodeIntForKey : @"CPTXYPlotSpace.bounceAnimationCurve"]; + momentumAnimationCurve = (CPTAnimationCurve)[coder decodeIntegerForKey:@"CPTXYPlotSpace.momentumAnimationCurve"]; + bounceAnimationCurve = (CPTAnimationCurve)[coder decodeIntegerForKey:@"CPTXYPlotSpace.bounceAnimationCurve"]; momentumAcceleration = [coder decodeCGFloatForKey:@"CPTXYPlotSpace.momentumAcceleration"]; bounceAcceleration = [coder decodeCGFloatForKey:@"CPTXYPlotSpace.bounceAcceleration"]; minimumDisplacementToDrag = [coder decodeCGFloatForKey:@"CPTXYPlotSpace.minimumDisplacementToDrag"]; @@ -295,12 +299,24 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Ranges /// @cond --(void)setPlotRange:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate +-(void)setPlotRange:(nonnull CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordinate { switch ( coordinate ) { case CPTCoordinateX: @@ -317,7 +333,7 @@ -(void)setPlotRange:(CPTPlotRange *)newRange forCoordinate:(CPTCoordinate)coordi } } --(CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate +-(nullable CPTPlotRange *)plotRangeForCoordinate:(CPTCoordinate)coordinate { CPTPlotRange *theRange = nil; @@ -376,7 +392,7 @@ -(CPTScaleType)scaleTypeForCoordinate:(CPTCoordinate)coordinate return theScaleType; } --(void)setXRange:(CPTPlotRange *)range +-(void)setXRange:(nonnull CPTPlotRange *)range { NSParameterAssert(range); @@ -402,14 +418,14 @@ -(void)setXRange:(CPTPlotRange *)range if ( xRange && constrainedRange ) { isScrolling = !CPTDecimalEquals(constrainedRange.locationDecimal, xRange.locationDecimal) && CPTDecimalEquals(constrainedRange.lengthDecimal, xRange.lengthDecimal); - if ( isScrolling && ( displacement == CPTFloat(0.0) ) ) { + if ( isScrolling && (displacement == CPTFloat(0.0))) { CPTGraph *theGraph = self.graph; CPTPlotArea *plotArea = theGraph.plotAreaFrame.plotArea; if ( plotArea ) { NSDecimal rangeLength = constrainedRange.lengthDecimal; - if ( !CPTDecimalEquals( rangeLength, CPTDecimalFromInteger(0) ) ) { + if ( !CPTDecimalEquals(rangeLength, CPTDecimalFromInteger(0))) { NSDecimal diff = CPTDecimalDivide(CPTDecimalSubtract(constrainedRange.locationDecimal, xRange.locationDecimal), rangeLength); displacement = plotArea.bounds.size.width * CPTDecimalCGFloatValue(diff); @@ -440,7 +456,7 @@ -(void)setXRange:(CPTPlotRange *)range } } --(void)setYRange:(CPTPlotRange *)range +-(void)setYRange:(nonnull CPTPlotRange *)range { NSParameterAssert(range); @@ -466,14 +482,14 @@ -(void)setYRange:(CPTPlotRange *)range if ( yRange && constrainedRange ) { isScrolling = !CPTDecimalEquals(constrainedRange.locationDecimal, yRange.locationDecimal) && CPTDecimalEquals(constrainedRange.lengthDecimal, yRange.lengthDecimal); - if ( isScrolling && ( displacement == CPTFloat(0.0) ) ) { + if ( isScrolling && (displacement == CPTFloat(0.0))) { CPTGraph *theGraph = self.graph; CPTPlotArea *plotArea = theGraph.plotAreaFrame.plotArea; if ( plotArea ) { NSDecimal rangeLength = constrainedRange.lengthDecimal; - if ( !CPTDecimalEquals( rangeLength, CPTDecimalFromInteger(0) ) ) { + if ( !CPTDecimalEquals(rangeLength, CPTDecimalFromInteger(0))) { NSDecimal diff = CPTDecimalDivide(CPTDecimalSubtract(constrainedRange.locationDecimal, yRange.locationDecimal), rangeLength); displacement = plotArea.bounds.size.height * CPTDecimalCGFloatValue(diff); @@ -504,7 +520,7 @@ -(void)setYRange:(CPTPlotRange *)range } } --(CPTPlotRange *)constrainRange:(CPTPlotRange *)existingRange toGlobalRange:(CPTPlotRange *)globalRange +-(nonnull CPTPlotRange *)constrainRange:(nonnull CPTPlotRange *)existingRange toGlobalRange:(nullable CPTPlotRange *)globalRange { if ( !globalRange ) { return existingRange; @@ -513,20 +529,22 @@ -(CPTPlotRange *)constrainRange:(CPTPlotRange *)existingRange toGlobalRange:(CPT return nil; } - if ( CPTDecimalGreaterThanOrEqualTo(existingRange.lengthDecimal, globalRange.lengthDecimal) ) { - return [globalRange copy]; + CPTPlotRange *theGlobalRange = globalRange; + + if ( CPTDecimalGreaterThanOrEqualTo(existingRange.lengthDecimal, theGlobalRange.lengthDecimal)) { + return [theGlobalRange copy]; } else { CPTMutablePlotRange *newRange = [existingRange mutableCopy]; - [newRange shiftEndToFitInRange:globalRange]; - [newRange shiftLocationToFitInRange:globalRange]; + [newRange shiftEndToFitInRange:theGlobalRange]; + [newRange shiftLocationToFitInRange:theGlobalRange]; return newRange; } } -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shift momentumTime:(CGFloat)momentumTime speed:(CGFloat)speed acceleration:(CGFloat)acceleration { - CPTMutableAnimationArray animationArray = self.animations; + CPTMutableAnimationArray *animationArray = self.animations; CPTAnimationOperation *op; NSString *property = nil; @@ -547,6 +565,8 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif break; default: + property = @""; + oldRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@0]; break; } @@ -575,12 +595,12 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif CPTPlotRange *constrainedRange = [self constrainRange:newRange toGlobalRange:globalRange]; if ( ![newRange isEqualToRange:constrainedRange] && ![globalRange containsRange:newRange] ) { - BOOL direction = ( CPTDecimalGreaterThan(shift, zero) && CPTDecimalGreaterThan(oldRange.lengthDecimal, zero) ) || - ( CPTDecimalLessThan(shift, zero) && CPTDecimalLessThan(oldRange.lengthDecimal, zero) ); + BOOL direction = (CPTDecimalGreaterThan(shift, zero) && CPTDecimalGreaterThan(oldRange.lengthDecimal, zero)) || + (CPTDecimalLessThan(shift, zero) && CPTDecimalLessThan(oldRange.lengthDecimal, zero)); // decelerate at the global range if ( hasShift ) { - CGFloat brakingDelay = CPTFloat(NAN); + CGFloat brakingDelay = CPTNAN; if ( [globalRange containsRange:oldRange] ) { // momentum started inside the global range; coast until we hit the global range @@ -590,11 +610,11 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif CGFloat brakingOffset = globalPoint - oldPoint; brakingDelay = CPTFirstPositiveRoot(acceleration, speed, brakingOffset); - if ( !isnan(brakingDelay) ) { + if ( !isnan(brakingDelay)) { speed -= brakingDelay * acceleration; // slow down quickly - while ( momentumTime > CPTFloat(0.1) ) { + while ( momentumTime > CPTFloat(0.1)) { acceleration *= CPTFloat(2.0); momentumTime = speed / (CPTFloat(2.0) * acceleration); } @@ -631,10 +651,10 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif brakingDelay = CPTFloat(0.0); // slow down quickly - while ( momentumTime > CPTFloat(0.1) ) { + while ( momentumTime > CPTFloat(0.1)) { momentumTime *= CPTFloat(0.5); - shift = CPTDecimalDivide( shift, CPTDecimalFromInteger(2) ); + shift = CPTDecimalDivide(shift, CPTDecimalFromInteger(2)); } newRange = [oldRange mutableCopy]; @@ -642,7 +662,7 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif newRange.locationDecimal = CPTDecimalAdd(newRange.locationDecimal, shift); } - if ( !isnan(brakingDelay) ) { + if ( !isnan(brakingDelay)) { op = [CPTAnimation animate:self property:property fromPlotRange:constrainedRange @@ -678,7 +698,7 @@ -(void)animateRangeForCoordinate:(CPTCoordinate)coordinate shift:(NSDecimal)shif } } --(CGFloat)viewCoordinateForRange:(CPTPlotRange *)range coordinate:(CPTCoordinate)coordinate direction:(BOOL)direction +-(CGFloat)viewCoordinateForRange:(nullable CPTPlotRange *)range coordinate:(CPTCoordinate)coordinate direction:(BOOL)direction { CPTCoordinate orthogonalCoordinate = CPTOrthogonalCoordinate(coordinate); @@ -688,7 +708,7 @@ -(CGFloat)viewCoordinateForRange:(CPTPlotRange *)range coordinate:(CPTCoordinate point[orthogonalCoordinate] = CPTDecimalFromInteger(1); CGPoint viewPoint = [self plotAreaViewPointForPlotPoint:point numberOfCoordinates:2]; - CGFloat pointCoordinate = CPTFloat(NAN); + CGFloat pointCoordinate = CPTNAN; switch ( coordinate ) { case CPTCoordinateX: @@ -709,18 +729,18 @@ -(CGFloat)viewCoordinateForRange:(CPTPlotRange *)range coordinate:(CPTCoordinate // return NAN if no positive roots CGFloat CPTFirstPositiveRoot(CGFloat a, CGFloat b, CGFloat c) { - CGFloat root = CPTFloat(NAN); + CGFloat root = CPTNAN; CGFloat discriminant = sqrt(b * b - CPTFloat(4.0) * a * c); CGFloat root1 = (-b + discriminant) / (CPTFloat(2.0) * a); CGFloat root2 = (-b - discriminant) / (CPTFloat(2.0) * a); - if ( !isnan(root1) && !isnan(root2) ) { - if ( root1 >= CPTFloat(0.0) ) { + if ( !isnan(root1) && !isnan(root2)) { + if ( root1 >= CPTFloat(0.0)) { root = root1; } - if ( ( root2 >= CPTFloat(0.0) ) && ( isnan(root) || (root2 < root) ) ) { + if ((root2 >= CPTFloat(0.0)) && (isnan(root) || (root2 < root))) { root = root2; } } @@ -728,7 +748,7 @@ CGFloat CPTFirstPositiveRoot(CGFloat a, CGFloat b, CGFloat c) return root; } --(void)setGlobalXRange:(CPTPlotRange *)newRange +-(void)setGlobalXRange:(nullable CPTPlotRange *)newRange { if ( ![newRange isEqualToRange:globalXRange] ) { globalXRange = [newRange copy]; @@ -736,7 +756,7 @@ -(void)setGlobalXRange:(CPTPlotRange *)newRange } } --(void)setGlobalYRange:(CPTPlotRange *)newRange +-(void)setGlobalYRange:(nullable CPTPlotRange *)newRange { if ( ![newRange isEqualToRange:globalYRange] ) { globalYRange = [newRange copy]; @@ -744,7 +764,7 @@ -(void)setGlobalYRange:(CPTPlotRange *)newRange } } --(void)scaleToFitPlots:(CPTPlotArray)plots +-(void)scaleToFitPlots:(nullable CPTPlotArray *)plots { if ( plots.count == 0 ) { return; @@ -769,13 +789,51 @@ -(void)scaleToFitPlots:(CPTPlotArray)plots // Set range NSDecimal zero = CPTDecimalFromInteger(0); if ( unionXRange ) { - if ( CPTDecimalEquals(unionXRange.lengthDecimal, zero) ) { + if ( CPTDecimalEquals(unionXRange.lengthDecimal, zero)) { [unionXRange unionPlotRange:self.xRange]; } self.xRange = unionXRange; } if ( unionYRange ) { - if ( CPTDecimalEquals(unionYRange.lengthDecimal, zero) ) { + if ( CPTDecimalEquals(unionYRange.lengthDecimal, zero)) { + [unionYRange unionPlotRange:self.yRange]; + } + self.yRange = unionYRange; + } +} + +-(void)scaleToFitEntirePlots:(nullable CPTPlotArray *)plots +{ + if ( plots.count == 0 ) { + return; + } + + // Determine union of ranges + CPTMutablePlotRange *unionXRange = nil; + CPTMutablePlotRange *unionYRange = nil; + for ( CPTPlot *plot in plots ) { + CPTPlotRange *currentXRange = [plot plotRangeEnclosingCoordinate:CPTCoordinateX]; + CPTPlotRange *currentYRange = [plot plotRangeEnclosingCoordinate:CPTCoordinateY]; + if ( !unionXRange ) { + unionXRange = [currentXRange mutableCopy]; + } + if ( !unionYRange ) { + unionYRange = [currentYRange mutableCopy]; + } + [unionXRange unionPlotRange:currentXRange]; + [unionYRange unionPlotRange:currentYRange]; + } + + // Set range + NSDecimal zero = CPTDecimalFromInteger(0); + if ( unionXRange ) { + if ( CPTDecimalEquals(unionXRange.lengthDecimal, zero)) { + [unionXRange unionPlotRange:self.xRange]; + } + self.xRange = unionXRange; + } + if ( unionYRange ) { + if ( CPTDecimalEquals(unionYRange.lengthDecimal, zero)) { [unionYRange unionPlotRange:self.yRange]; } self.yRange = unionYRange; @@ -826,14 +884,14 @@ -(void)setYScaleType:(CPTScaleType)newScaleType /// @cond // Linear --(CGFloat)viewCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(CPTPlotRange *)range plotCoordinateValue:(NSDecimal)plotCoord +-(CGFloat)viewCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(nonnull CPTPlotRange *)range plotCoordinateValue:(NSDecimal)plotCoord { if ( !range ) { return CPTFloat(0.0); } NSDecimal factor = CPTDecimalDivide(CPTDecimalSubtract(plotCoord, range.locationDecimal), range.lengthDecimal); - if ( NSDecimalIsNotANumber(&factor) ) { + if ( NSDecimalIsNotANumber(&factor)) { factor = CPTDecimalFromInteger(0); } @@ -842,19 +900,19 @@ -(CGFloat)viewCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(CPT return CPTDecimalCGFloatValue(viewCoordinate); } --(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord +-(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(nonnull CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord { - if ( !range || (range.lengthDouble == 0.0) ) { + if ( !range || (range.lengthDouble == 0.0)) { return CPTFloat(0.0); } - return viewLength * (CGFloat)( (plotCoord - range.locationDouble) / range.lengthDouble ); + return viewLength * (CGFloat)((plotCoord - range.locationDouble) / range.lengthDouble); } --(NSDecimal)plotCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(CPTPlotRange *)range boundsLength:(NSDecimal)boundsLength +-(NSDecimal)plotCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(nonnull CPTPlotRange *)range boundsLength:(NSDecimal)boundsLength { const NSDecimal zero = CPTDecimalFromInteger(0); - if ( CPTDecimalEquals(boundsLength, zero) ) { + if ( CPTDecimalEquals(boundsLength, zero)) { return zero; } @@ -869,13 +927,13 @@ -(NSDecimal)plotCoordinateForViewLength:(NSDecimal)viewLength linearPlotRange:(C return coordinate; } --(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(CPTPlotRange *)range boundsLength:(CGFloat)boundsLength +-(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength linearPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength { - if ( boundsLength == 0.0 ) { + if ( boundsLength == CPTFloat(0.0)) { return 0.0; } - double coordinate = viewLength / boundsLength; + double coordinate = (double)viewLength / (double)boundsLength; coordinate *= range.lengthDouble; coordinate += range.locationDouble; @@ -883,9 +941,9 @@ -(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength linearPl } // Log (only one version since there are no transcendental functions for NSDecimal) --(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord +-(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nonnull CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord { - if ( (range.minLimitDouble <= 0.0) || (range.maxLimitDouble <= 0.0) || (plotCoord <= 0.0) ) { + if ((range.minLimitDouble <= 0.0) || (range.maxLimitDouble <= 0.0) || (plotCoord <= 0.0)) { return CPTFloat(0.0); } @@ -893,25 +951,25 @@ -(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(CPTPlotR double logCoord = log10(plotCoord); double logEnd = log10(range.endDouble); - return viewLength * (CGFloat)( (logCoord - logLoc) / (logEnd - logLoc) ); + return viewLength * (CGFloat)((logCoord - logLoc) / (logEnd - logLoc)); } --(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(CPTPlotRange *)range boundsLength:(CGFloat)boundsLength +-(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength { - if ( boundsLength == 0.0 ) { + if ( boundsLength == CPTFloat(0.0)) { return 0.0; } double logLoc = log10(range.locationDouble); double logEnd = log10(range.endDouble); - double coordinate = viewLength * (logEnd - logLoc) / boundsLength + logLoc; + double coordinate = (double)viewLength * (logEnd - logLoc) / (double)boundsLength + logLoc; return pow(10.0, coordinate); } // Log-modulus (only one version since there are no transcendental functions for NSDecimal) --(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord +-(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(nonnull CPTPlotRange *)range doublePrecisionPlotCoordinateValue:(double)plotCoord { if ( !range ) { return CPTFloat(0.0); @@ -921,18 +979,18 @@ -(CGFloat)viewCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(C double logCoord = CPTLogModulus(plotCoord); double logEnd = CPTLogModulus(range.endDouble); - return viewLength * (CGFloat)( (logCoord - logLoc) / (logEnd - logLoc) ); + return viewLength * (CGFloat)((logCoord - logLoc) / (logEnd - logLoc)); } --(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(CPTPlotRange *)range boundsLength:(CGFloat)boundsLength +-(double)doublePrecisionPlotCoordinateForViewLength:(CGFloat)viewLength logModulusPlotRange:(nonnull CPTPlotRange *)range boundsLength:(CGFloat)boundsLength { - if ( boundsLength == 0.0 ) { + if ( boundsLength == CPTFloat(0.0)) { return 0.0; } double logLoc = CPTLogModulus(range.locationDouble); double logEnd = CPTLogModulus(range.endDouble); - double coordinate = viewLength * (logEnd - logLoc) / boundsLength + logLoc; + double coordinate = (double)viewLength * (logEnd - logLoc) / (double)boundsLength + logLoc; return CPTInverseLogModulus(coordinate); } @@ -950,7 +1008,7 @@ -(NSUInteger)numberOfCoordinates } // Plot area view point for plot point --(CGPoint)plotAreaViewPointForPlotPoint:(CPTNumberArray)plotPoint +-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull CPTNumberArray *)plotPoint { CGPoint viewPoint = [super plotAreaViewPointForPlotPoint:plotPoint]; @@ -968,18 +1026,18 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(CPTNumberArray)plotPoint switch ( self.xScaleType ) { case CPTScaleTypeLinear: case CPTScaleTypeCategory: - viewPoint.x = [self viewCoordinateForViewLength:plotArea.widthDecimal linearPlotRange:self.xRange plotCoordinateValue:[plotPoint[CPTCoordinateX] decimalValue]]; + viewPoint.x = [self viewCoordinateForViewLength:plotArea.widthDecimal linearPlotRange:self.xRange plotCoordinateValue:plotPoint[CPTCoordinateX].decimalValue]; break; case CPTScaleTypeLog: { - viewPoint.x = [self viewCoordinateForViewLength:layerSize.width logPlotRange:self.xRange doublePrecisionPlotCoordinateValue:[plotPoint[CPTCoordinateX] doubleValue]]; + viewPoint.x = [self viewCoordinateForViewLength:layerSize.width logPlotRange:self.xRange doublePrecisionPlotCoordinateValue:plotPoint[CPTCoordinateX].doubleValue]; } break; case CPTScaleTypeLogModulus: { - viewPoint.x = [self viewCoordinateForViewLength:layerSize.width logModulusPlotRange:self.xRange doublePrecisionPlotCoordinateValue:[plotPoint[CPTCoordinateX] doubleValue]]; + viewPoint.x = [self viewCoordinateForViewLength:layerSize.width logModulusPlotRange:self.xRange doublePrecisionPlotCoordinateValue:plotPoint[CPTCoordinateX].doubleValue]; } break; @@ -990,18 +1048,18 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(CPTNumberArray)plotPoint switch ( self.yScaleType ) { case CPTScaleTypeLinear: case CPTScaleTypeCategory: - viewPoint.y = [self viewCoordinateForViewLength:plotArea.heightDecimal linearPlotRange:self.yRange plotCoordinateValue:[plotPoint[CPTCoordinateY] decimalValue]]; + viewPoint.y = [self viewCoordinateForViewLength:plotArea.heightDecimal linearPlotRange:self.yRange plotCoordinateValue:plotPoint[CPTCoordinateY].decimalValue]; break; case CPTScaleTypeLog: { - viewPoint.y = [self viewCoordinateForViewLength:layerSize.height logPlotRange:self.yRange doublePrecisionPlotCoordinateValue:[plotPoint[CPTCoordinateY] doubleValue]]; + viewPoint.y = [self viewCoordinateForViewLength:layerSize.height logPlotRange:self.yRange doublePrecisionPlotCoordinateValue:plotPoint[CPTCoordinateY].doubleValue]; } break; case CPTScaleTypeLogModulus: { - viewPoint.y = [self viewCoordinateForViewLength:layerSize.height logModulusPlotRange:self.yRange doublePrecisionPlotCoordinateValue:[plotPoint[CPTCoordinateY] doubleValue]]; + viewPoint.y = [self viewCoordinateForViewLength:layerSize.height logModulusPlotRange:self.yRange doublePrecisionPlotCoordinateValue:plotPoint[CPTCoordinateY].doubleValue]; } break; @@ -1012,7 +1070,7 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(CPTNumberArray)plotPoint return viewPoint; } --(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count +-(CGPoint)plotAreaViewPointForPlotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count { CGPoint viewPoint = [super plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:count]; @@ -1078,7 +1136,7 @@ -(CGPoint)plotAreaViewPointForPlotPoint:(NSDecimal *)plotPoint numberOfCoordinat return viewPoint; } --(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count +-(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count { CGPoint viewPoint = [super plotAreaViewPointForDoublePrecisionPlotPoint:plotPoint numberOfCoordinates:count]; @@ -1133,9 +1191,9 @@ -(CGPoint)plotAreaViewPointForDoublePrecisionPlotPoint:(double *)plotPoint numbe } // Plot point for view point --(CPTNumberArray)plotPointForPlotAreaViewPoint:(CGPoint)point +-(nullable CPTNumberArray *)plotPointForPlotAreaViewPoint:(CGPoint)point { - CPTMutableNumberArray plotPoint = [[super plotPointForPlotAreaViewPoint:point] mutableCopy]; + CPTMutableNumberArray *plotPoint = [[super plotPointForPlotAreaViewPoint:point] mutableCopy]; CGSize boundsSize; CPTGraph *theGraph = self.graph; @@ -1195,7 +1253,7 @@ -(CPTNumberArray)plotPointForPlotAreaViewPoint:(CGPoint)point return plotPoint; } --(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point +-(void)plotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point { [super plotPoint:plotPoint numberOfCoordinates:count forPlotAreaViewPoint:point]; @@ -1250,7 +1308,7 @@ -(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count fo } } --(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point +-(void)doublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count forPlotAreaViewPoint:(CGPoint)point { [super doublePrecisionPlotPoint:plotPoint numberOfCoordinates:count forPlotAreaViewPoint:point]; @@ -1305,7 +1363,7 @@ -(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInte } // Plot area view point for event --(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event +-(CGPoint)plotAreaViewPointForEvent:(nonnull CPTNativeEvent *)event { CGPoint plotAreaViewPoint = CGPointZero; @@ -1314,7 +1372,7 @@ -(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event CPTPlotArea *thePlotArea = theGraph.plotAreaFrame.plotArea; if ( theHostingView && thePlotArea ) { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE CGPoint interactionPoint = [[[event touchesForView:theHostingView] anyObject] locationInView:theHostingView]; if ( theHostingView.collapsesLayers ) { interactionPoint.y = theHostingView.frame.size.height - interactionPoint.y; @@ -1324,7 +1382,7 @@ -(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event plotAreaViewPoint = [theHostingView.layer convertPoint:interactionPoint toLayer:thePlotArea]; } #else - CGPoint interactionPoint = NSPointToCGPoint([theHostingView convertPoint:[event locationInWindow] fromView:nil]); + CGPoint interactionPoint = NSPointToCGPoint([theHostingView convertPoint:event.locationInWindow fromView:nil]); plotAreaViewPoint = [theHostingView.layer convertPoint:interactionPoint toLayer:thePlotArea]; #endif } @@ -1333,17 +1391,17 @@ -(CGPoint)plotAreaViewPointForEvent:(CPTNativeEvent *)event } // Plot point for event --(CPTNumberArray)plotPointForEvent:(CPTNativeEvent *)event +-(nullable CPTNumberArray *)plotPointForEvent:(nonnull CPTNativeEvent *)event { return [self plotPointForPlotAreaViewPoint:[self plotAreaViewPointForEvent:event]]; } --(void)plotPoint:(NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(CPTNativeEvent *)event +-(void)plotPoint:(nonnull NSDecimal *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(nonnull CPTNativeEvent *)event { [self plotPoint:plotPoint numberOfCoordinates:count forPlotAreaViewPoint:[self plotAreaViewPointForEvent:event]]; } --(void)doublePrecisionPlotPoint:(double *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(CPTNativeEvent *)event +-(void)doublePrecisionPlotPoint:(nonnull double *)plotPoint numberOfCoordinates:(NSUInteger)count forEvent:(nonnull CPTNativeEvent *)event { [self doublePrecisionPlotPoint:plotPoint numberOfCoordinates:count forPlotAreaViewPoint:[self plotAreaViewPointForEvent:event]]; } @@ -1360,7 +1418,7 @@ -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)plotAreaPoint CPTGraph *theGraph = self.graph; CPTPlotArea *plotArea = theGraph.plotAreaFrame.plotArea; - if ( !plotArea || (interactionScale <= 1.e-6) ) { + if ( !plotArea || (interactionScale <= CPTFloat(1.e-6))) { return; } if ( ![plotArea containsPoint:plotAreaPoint] ) { @@ -1393,7 +1451,7 @@ -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)plotAreaPoint // New locations NSDecimal newLocationX; - if ( CPTDecimalGreaterThanOrEqualTo( oldRangeX.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalGreaterThanOrEqualTo(oldRangeX.lengthDecimal, CPTDecimalFromInteger(0))) { NSDecimal oldFirstLengthX = CPTDecimalSubtract(plotInteractionPoint[CPTCoordinateX], oldRangeX.minLimitDecimal); // x - minX NSDecimal newFirstLengthX = CPTDecimalDivide(oldFirstLengthX, decimalScale); // (x - minX) / scale newLocationX = CPTDecimalSubtract(plotInteractionPoint[CPTCoordinateX], newFirstLengthX); @@ -1405,7 +1463,7 @@ -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)plotAreaPoint } NSDecimal newLocationY; - if ( CPTDecimalGreaterThanOrEqualTo( oldRangeY.lengthDecimal, CPTDecimalFromInteger(0) ) ) { + if ( CPTDecimalGreaterThanOrEqualTo(oldRangeY.lengthDecimal, CPTDecimalFromInteger(0))) { NSDecimal oldFirstLengthY = CPTDecimalSubtract(plotInteractionPoint[CPTCoordinateY], oldRangeY.minLimitDecimal); // y - minY NSDecimal newFirstLengthY = CPTDecimalDivide(oldFirstLengthY, decimalScale); // (y - minY) / scale newLocationY = CPTDecimalSubtract(plotInteractionPoint[CPTCoordinateY], newFirstLengthY); @@ -1458,7 +1516,7 @@ -(void)scaleBy:(CGFloat)interactionScale aboutPoint:(CGPoint)plotAreaPoint * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDownEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { self.isDragging = NO; @@ -1482,7 +1540,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact self.lastDeltaTime = 0.0; // Clear any previous animations - CPTMutableAnimationArray animationArray = self.animations; + CPTMutableAnimationArray *animationArray = self.animations; for ( CPTAnimationOperation *op in animationArray ) { [[CPTAnimation sharedInstance] removeAnimationOperation:op]; } @@ -1512,7 +1570,7 @@ -(BOOL)pointingDeviceDownEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interact * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceUpEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { BOOL handledByDelegate = [super pointingDeviceUpEvent:event atPoint:interactionPoint]; @@ -1543,7 +1601,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio NSTimeInterval deltaT = event.timestamp - self.lastDragTime; NSTimeInterval lastDeltaT = self.lastDeltaTime; - if ( (deltaT > 0.0) && (deltaT < 0.05) && (lastDeltaT > 0.0) ) { + if ((deltaT > 0.0) && (deltaT < 0.05) && (lastDeltaT > 0.0)) { CGPoint pointInPlotArea = [theGraph convertPoint:interactionPoint toLayer:plotArea]; CGPoint displacement = self.lastDisplacement; @@ -1551,7 +1609,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio speed = sqrt(displacement.x * displacement.x + displacement.y * displacement.y) / CPTFloat(lastDeltaT); momentumTime = speed / (CPTFloat(2.0) * acceleration); CGFloat distanceTraveled = speed * momentumTime - CPTFloat(0.5) * acceleration * momentumTime * momentumTime; - distanceTraveled = MAX( distanceTraveled, CPTFloat(0.0) ); + distanceTraveled = MAX(distanceTraveled, CPTFloat(0.0)); CGFloat theta = atan2(displacement.y, displacement.x); scaleX = cos(theta); @@ -1610,7 +1668,7 @@ -(BOOL)pointingDeviceUpEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactio * @param interactionPoint The coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint +-(BOOL)pointingDeviceDraggedEvent:(nonnull CPTNativeEvent *)event atPoint:(CGPoint)interactionPoint { BOOL handledByDelegate = [super pointingDeviceDraggedEvent:event atPoint:interactionPoint]; @@ -1652,18 +1710,18 @@ -(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)inter // X range NSDecimal shiftX = CPTDecimalSubtract(lastPoint[CPTCoordinateX], newPoint[CPTCoordinateX]); CPTPlotRange *newRangeX = [self shiftRange:self.xRange - by:shiftX - usingMomentum:self.allowsMomentumX - inGlobalRange:self.globalXRange - withDisplacement:&displacement.x]; + by:shiftX + usingMomentum:self.allowsMomentumX + inGlobalRange:self.globalXRange + withDisplacement:&displacement.x]; // Y range NSDecimal shiftY = CPTDecimalSubtract(lastPoint[CPTCoordinateY], newPoint[CPTCoordinateY]); CPTPlotRange *newRangeY = [self shiftRange:self.yRange - by:shiftY - usingMomentum:self.allowsMomentumY - inGlobalRange:self.globalYRange - withDisplacement:&displacement.y]; + by:shiftY + usingMomentum:self.allowsMomentumY + inGlobalRange:self.globalYRange + withDisplacement:&displacement.y]; self.lastDragPoint = pointInPlotArea; self.lastDisplacement = displacement; @@ -1681,7 +1739,9 @@ -(BOOL)pointingDeviceDraggedEvent:(CPTNativeEvent *)event atPoint:(CGPoint)inter return NO; } --(CPTPlotRange *)shiftRange:(CPTPlotRange *)oldRange by:(NSDecimal)shift usingMomentum:(BOOL)momentum inGlobalRange:(CPTPlotRange *)globalRange withDisplacement:(CGFloat *)displacement +/// @cond + +-(nullable CPTPlotRange *)shiftRange:(nonnull CPTPlotRange *)oldRange by:(NSDecimal)shift usingMomentum:(BOOL)momentum inGlobalRange:(nullable CPTPlotRange *)globalRange withDisplacement:(CGFloat *)displacement { CPTMutablePlotRange *newRange = [oldRange mutableCopy]; @@ -1695,13 +1755,13 @@ -(CPTPlotRange *)shiftRange:(CPTPlotRange *)oldRange by:(NSDecimal)shift usingMo // reduce the shift as we get farther outside the global range NSDecimal rangeLength = newRange.lengthDecimal; - if ( !CPTDecimalEquals( rangeLength, CPTDecimalFromInteger(0) ) ) { + if ( !CPTDecimalEquals(rangeLength, CPTDecimalFromInteger(0))) { NSDecimal diff = CPTDecimalDivide(CPTDecimalSubtract(constrainedRange.locationDecimal, newRange.locationDecimal), rangeLength); - diff = CPTDecimalMax( CPTDecimalMin( CPTDecimalMultiply( diff, CPTDecimalFromDouble(2.5) ), CPTDecimalFromInteger(1) ), CPTDecimalFromInteger(-1) ); + diff = CPTDecimalMax(CPTDecimalMin(CPTDecimalMultiply(diff, CPTDecimalFromDouble(2.5)), CPTDecimalFromInteger(1)), CPTDecimalFromInteger(-1)); - newRange.locationDecimal = CPTDecimalSubtract( newRange.locationDecimal, CPTDecimalMultiply( shift, CPTDecimalAbs(diff) ) ); + newRange.locationDecimal = CPTDecimalSubtract(newRange.locationDecimal, CPTDecimalMultiply(shift, CPTDecimalAbs(diff))); - *displacement = *displacement * ( CPTFloat(1.0) - ABS( CPTDecimalCGFloatValue(diff) ) ); + *displacement = *displacement * (CPTFloat(1.0) - ABS(CPTDecimalCGFloatValue(diff))); } } } @@ -1713,7 +1773,9 @@ -(CPTPlotRange *)shiftRange:(CPTPlotRange *)oldRange by:(NSDecimal)shift usingMo return newRange; } -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +/// @endcond + +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE #else /** @@ -1731,7 +1793,7 @@ -(CPTPlotRange *)shiftRange:(CPTPlotRange *)oldRange by:(NSDecimal)shift usingMo * @param toPoint The ending coordinates of the interaction. * @return Whether the event was handled or not. **/ --(BOOL)scrollWheelEvent:(CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint +-(BOOL)scrollWheelEvent:(nonnull CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toPoint:(CGPoint)toPoint { BOOL handledByDelegate = [super scrollWheelEvent:event fromPoint:fromPoint toPoint:toPoint]; @@ -1765,24 +1827,25 @@ -(BOOL)scrollWheelEvent:(CPTNativeEvent *)event fromPoint:(CGPoint)fromPoint toP // X range NSDecimal shiftX = CPTDecimalSubtract(lastPoint[CPTCoordinateX], newPoint[CPTCoordinateX]); CPTPlotRange *newRangeX = [self shiftRange:self.xRange - by:shiftX - usingMomentum:NO - inGlobalRange:self.globalXRange - withDisplacement:&displacement.x]; + by:shiftX + usingMomentum:NO + inGlobalRange:self.globalXRange + withDisplacement:&displacement.x]; // Y range NSDecimal shiftY = CPTDecimalSubtract(lastPoint[CPTCoordinateY], newPoint[CPTCoordinateY]); CPTPlotRange *newRangeY = [self shiftRange:self.yRange - by:shiftY - usingMomentum:NO - inGlobalRange:self.globalYRange - withDisplacement:&displacement.y]; + by:shiftY + usingMomentum:NO + inGlobalRange:self.globalYRange + withDisplacement:&displacement.y]; self.xRange = newRangeX; self.yRange = newRangeY; return YES; } + #endif /** @@ -1821,7 +1884,7 @@ -(BOOL)allowsMomentum /// @cond --(void)animationDidFinish:(CPTAnimationOperation *)operation +-(void)animationDidFinish:(nonnull CPTAnimationOperation *)operation { [self.animations removeObjectIdenticalTo:operation]; } @@ -1833,7 +1896,7 @@ -(void)animationDidFinish:(CPTAnimationOperation *)operation /// @cond --(id)debugQuickLookObject +-(nullable id)debugQuickLookObject { // Plot space NSString *plotAreaDesc = [super debugQuickLookObject]; diff --git a/framework/Source/CPTXYPlotSpaceTests.h b/framework/Source/CPTXYPlotSpaceTests.h index 7bef754be..56c6e53aa 100644 --- a/framework/Source/CPTXYPlotSpaceTests.h +++ b/framework/Source/CPTXYPlotSpaceTests.h @@ -4,6 +4,6 @@ @interface CPTXYPlotSpaceTests : CPTTestCase -@property (nonatomic, readwrite, strong) CPTXYGraph *graph; +@property (nonatomic, readwrite, strong, nullable) CPTXYGraph *graph; @end diff --git a/framework/Source/CPTXYPlotSpaceTests.m b/framework/Source/CPTXYPlotSpaceTests.m index 2d8656831..888b6045d 100644 --- a/framework/Source/CPTXYPlotSpaceTests.m +++ b/framework/Source/CPTXYPlotSpaceTests.m @@ -7,7 +7,7 @@ @interface CPTXYPlotSpace(testingAdditions) --(CPTPlotRange *)constrainRange:(CPTPlotRange *)existingRange toGlobalRange:(CPTPlotRange *)globalRange; +-(nonnull CPTPlotRange *)constrainRange:(nonnull CPTPlotRange *)existingRange toGlobalRange:(nullable CPTPlotRange *)globalRange; @end @@ -49,7 +49,7 @@ -(void)testViewPointForPlotPointArrayLinear plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@10.0]; - CPTNumberArray plotPoint = @[@5.0, @5.0]; + CPTNumberArray *plotPoint = @[@5.0, @5.0]; CGPoint viewPoint = [plotSpace plotAreaViewPointForPlotPoint:plotPoint]; @@ -146,7 +146,7 @@ -(void)testViewPointForPlotPointArrayLog plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@9.0]; - CPTNumberArray plotPoint = @[@( sqrt(10.0) ), @( sqrt(10.0) )]; + CPTNumberArray *plotPoint = @[@(sqrt(10.0)), @(sqrt(10.0))]; CGPoint viewPoint = [plotSpace plotAreaViewPointForPlotPoint:plotPoint]; @@ -177,8 +177,8 @@ -(void)testViewPointForPlotPointLog length:@9.0]; NSDecimal plotPoint[2]; - plotPoint[CPTCoordinateX] = CPTDecimalFromDouble( sqrt(10.0) ); - plotPoint[CPTCoordinateY] = CPTDecimalFromDouble( sqrt(10.0) ); + plotPoint[CPTCoordinateX] = CPTDecimalFromDouble(sqrt(10.0)); + plotPoint[CPTCoordinateY] = CPTDecimalFromDouble(sqrt(10.0)); CGPoint viewPoint = [plotSpace plotAreaViewPointForPlotPoint:plotPoint numberOfCoordinates:2]; @@ -310,14 +310,14 @@ -(void)testPlotPointArrayForViewPointLinear plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@0.0 length:@10.0]; - CGPoint viewPoint = CPTPointMake(50.0, 25.0); - CPTNumberArray plotPoint = [plotSpace plotPointForPlotAreaViewPoint:viewPoint]; + CGPoint viewPoint = CPTPointMake(50.0, 25.0); + CPTNumberArray *plotPoint = [plotSpace plotPointForPlotAreaViewPoint:viewPoint]; NSString *errMessage; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", plotPoint[CPTCoordinateX]]; - XCTAssertTrue(CPTDecimalEquals( [plotPoint[CPTCoordinateX] decimalValue], CPTDecimalFromDouble(5.0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals([plotPoint[CPTCoordinateX] decimalValue], CPTDecimalFromDouble(5.0)), @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", plotPoint[CPTCoordinateY]]; - XCTAssertTrue(CPTDecimalEquals( [plotPoint[CPTCoordinateY] decimalValue], CPTDecimalFromDouble(5.0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals([plotPoint[CPTCoordinateY] decimalValue], CPTDecimalFromDouble(5.0)), @"%@", errMessage); } -(void)testPlotPointForViewPointLinear @@ -339,9 +339,9 @@ -(void)testPlotPointForViewPointLinear [plotSpace plotPoint:plotPoint numberOfCoordinates:2 forPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", NSDecimalString(&plotPoint[CPTCoordinateX], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateX], CPTDecimalFromDouble(5.0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateX], CPTDecimalFromDouble(5.0)), @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", NSDecimalString(&plotPoint[CPTCoordinateY], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateY], CPTDecimalFromDouble(5.0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateY], CPTDecimalFromDouble(5.0)), @"%@", errMessage); } -(void)testDoublePrecisionPlotPointForViewPointLinear @@ -383,8 +383,8 @@ -(void)testPlotPointArrayForViewPointLog plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:@1.0 length:@9.0]; - CGPoint viewPoint = CPTPointMake(50.0, 25.0); - CPTNumberArray plotPoint = [plotSpace plotPointForPlotAreaViewPoint:viewPoint]; + CGPoint viewPoint = CPTPointMake(50.0, 25.0); + CPTNumberArray *plotPoint = [plotSpace plotPointForPlotAreaViewPoint:viewPoint]; NSString *errMessage; [plotSpace plotPointForPlotAreaViewPoint:viewPoint]; @@ -414,9 +414,9 @@ -(void)testPlotPointForViewPointLog [plotSpace plotPoint:plotPoint numberOfCoordinates:2 forPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", NSDecimalString(&plotPoint[CPTCoordinateX], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateX], CPTDecimalFromDouble( sqrt(10.0) ) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateX], CPTDecimalFromDouble(sqrt(10.0))), @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", NSDecimalString(&plotPoint[CPTCoordinateY], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateY], CPTDecimalFromDouble( sqrt(10.0) ) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateY], CPTDecimalFromDouble(sqrt(10.0))), @"%@", errMessage); } -(void)testDoublePrecisionPlotPointForViewPointLog @@ -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); } @@ -489,9 +489,9 @@ -(void)testPlotPointForViewPointLogModulus [plotSpace plotPoint:plotPoint numberOfCoordinates:2 forPlotAreaViewPoint:viewPoint]; errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateX] was %@", NSDecimalString(&plotPoint[CPTCoordinateX], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateX], CPTDecimalFromInteger(0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateX], CPTDecimalFromInteger(0)), @"%@", errMessage); errMessage = [NSString stringWithFormat:@"plotPoint[CPTCoordinateY] was %@", NSDecimalString(&plotPoint[CPTCoordinateY], nil)]; - XCTAssertTrue(CPTDecimalEquals( plotPoint[CPTCoordinateY], CPTDecimalFromInteger(0) ), @"%@", errMessage); + XCTAssertTrue(CPTDecimalEquals(plotPoint[CPTCoordinateY], CPTDecimalFromInteger(0)), @"%@", errMessage); } -(void)testDoublePrecisionPlotPointForViewPointLogModulus @@ -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); } @@ -526,7 +526,6 @@ -(void)testConstrainNilRanges CPTXYPlotSpace *plotSpace = (CPTXYPlotSpace *)self.graph.defaultPlotSpace; XCTAssertEqualObjects([plotSpace constrainRange:plotSpace.xRange toGlobalRange:nil], plotSpace.xRange, @"Constrain to nil global range should return original range."); - XCTAssertNil([plotSpace constrainRange:nil toGlobalRange:plotSpace.xRange], @"Constrain nil range should return nil."); } -(void)testConstrainRanges1 @@ -611,7 +610,7 @@ -(void)testScaleByAboutPoint1 CGRect myBounds = self.graph.bounds; - [plotSpace scaleBy:0.5 aboutPoint:CGPointMake( CGRectGetMidX(myBounds), CGRectGetMidY(myBounds) )]; + [plotSpace scaleBy:0.5 aboutPoint:CGPointMake(CGRectGetMidX(myBounds), CGRectGetMidY(myBounds))]; CPTPlotRange *expectedRangeX = [CPTPlotRange plotRangeWithLocation:@(-5.0) length:@20.0]; @@ -638,7 +637,7 @@ -(void)testScaleByAboutPoint2 CGRect myBounds = self.graph.bounds; - [plotSpace scaleBy:2.0 aboutPoint:CGPointMake( CGRectGetMidX(myBounds), CGRectGetMidY(myBounds) )]; + [plotSpace scaleBy:2.0 aboutPoint:CGPointMake(CGRectGetMidX(myBounds), CGRectGetMidY(myBounds))]; CPTPlotRange *expectedRangeX = [CPTPlotRange plotRangeWithLocation:@2.5 length:@5.0]; @@ -664,7 +663,7 @@ -(void)testKeyedArchivingRoundTrip plotSpace.globalYRange = [CPTPlotRange plotRangeWithLocation:@10.0 length:@(-10.0)]; - CPTXYPlotSpace *newPlotSpace = [NSKeyedUnarchiver unarchiveObjectWithData:[NSKeyedArchiver archivedDataWithRootObject:plotSpace]]; + CPTXYPlotSpace *newPlotSpace = [self archiveRoundTrip:plotSpace]; NSString *errMessage = [NSString stringWithFormat:@"xRange was %@, expected %@", plotSpace.xRange, newPlotSpace.xRange]; XCTAssertTrue([plotSpace.xRange isEqualToRange:newPlotSpace.xRange], @"%@", errMessage); diff --git a/framework/Source/NSCoderExtensions.m b/framework/Source/NSCoderExtensions.m index 1bd64693c..cfa40b7f7 100644 --- a/framework/Source/NSCoderExtensions.m +++ b/framework/Source/NSCoderExtensions.m @@ -16,7 +16,7 @@ @implementation NSCoder(CPTExtensions) * @param number The number to encode. * @param key The key to associate with the number. **/ --(void)encodeCGFloat:(CGFloat)number forKey:(NSString *)key +-(void)encodeCGFloat:(CGFloat)number forKey:(nonnull NSString *)key { #if CGFLOAT_IS_DOUBLE [self encodeDouble:number forKey:key]; @@ -29,7 +29,7 @@ -(void)encodeCGFloat:(CGFloat)number forKey:(NSString *)key * @param point The point to encode. * @param key The key to associate with the point. **/ --(void)encodeCPTPoint:(CGPoint)point forKey:(NSString *)key +-(void)encodeCPTPoint:(CGPoint)point forKey:(nonnull NSString *)key { NSString *newKey = [[NSString alloc] initWithFormat:@"%@.x", key]; @@ -43,7 +43,7 @@ -(void)encodeCPTPoint:(CGPoint)point forKey:(NSString *)key * @param size The size to encode. * @param key The key to associate with the size. **/ --(void)encodeCPTSize:(CGSize)size forKey:(NSString *)key +-(void)encodeCPTSize:(CGSize)size forKey:(nonnull NSString *)key { NSString *newKey = [[NSString alloc] initWithFormat:@"%@.width", key]; @@ -57,7 +57,7 @@ -(void)encodeCPTSize:(CGSize)size forKey:(NSString *)key * @param rect The rectangle to encode. * @param key The key to associate with the rectangle. **/ --(void)encodeCPTRect:(CGRect)rect forKey:(NSString *)key +-(void)encodeCPTRect:(CGRect)rect forKey:(nonnull NSString *)key { NSString *newKey = [[NSString alloc] initWithFormat:@"%@.origin", key]; @@ -72,13 +72,27 @@ -(void)encodeCPTRect:(CGRect)rect forKey:(NSString *)key * @param key The key to associate with the color space. * @note The current implementation only works with named color spaces. **/ --(void)encodeCGColorSpace:(CGColorSpaceRef)colorSpace forKey:(NSString *)key +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" +#endif +-(void)encodeCGColorSpace:(nullable CGColorSpaceRef)colorSpace forKey:(nonnull NSString *)key { -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE NSLog(@"Color space encoding is not supported on iOS. Decoding will return a generic RGB color space."); +#pragma clang diagnostic pop #else if ( colorSpace ) { - CFDataRef iccProfile = CGColorSpaceCopyICCProfile(colorSpace); + CFDataRef iccProfile = NULL; + + // CGColorSpaceCopyICCProfile() is deprecated as of macOS 10.13 + if ( CGColorSpaceCopyICCData ) { + iccProfile = CGColorSpaceCopyICCData(colorSpace); + } + else { + iccProfile = CGColorSpaceCopyICCProfile(colorSpace); + } + [self encodeObject:(__bridge NSData *)iccProfile forKey:key]; CFRelease(iccProfile); } @@ -87,7 +101,7 @@ -(void)encodeCGColorSpace:(CGColorSpaceRef)colorSpace forKey:(NSString *)key /// @cond -void CPTPathApplierFunc(void *info, const CGPathElement *element) +void CPTPathApplierFunc(void *__nullable info, const CGPathElement *__nonnull element) { NSMutableDictionary *elementData = [[NSMutableDictionary alloc] init]; @@ -122,7 +136,7 @@ void CPTPathApplierFunc(void *info, const CGPathElement *element) * @param path The @ref CGPathRef to encode. * @param key The key to associate with the path. **/ --(void)encodeCGPath:(CGPathRef)path forKey:(NSString *)key +-(void)encodeCGPath:(nullable CGPathRef)path forKey:(nonnull NSString *)key { NSMutableArray *> *pathData = [[NSMutableArray alloc] init]; @@ -138,7 +152,7 @@ -(void)encodeCGPath:(CGPathRef)path forKey:(NSString *)key for ( NSUInteger i = 0; i < dataCount; i++ ) { NSDictionary *elementData = pathData[i]; - CGPathElementType type = (CGPathElementType)[elementData[@"type"] intValue]; + CGPathElementType type = (CGPathElementType)elementData[@"type"].intValue; newKey = [[NSString alloc] initWithFormat:@"%@[%lu].type", key, (unsigned long)i]; [self encodeInt:type forKey:newKey]; @@ -175,7 +189,7 @@ -(void)encodeCGPath:(CGPathRef)path forKey:(NSString *)key * @param image The @ref CGImageRef to encode. * @param key The key to associate with the image. **/ --(void)encodeCGImage:(CGImageRef)image forKey:(NSString *)key +-(void)encodeCGImage:(nullable CGImageRef)image forKey:(nonnull NSString *)key { NSString *newKey = [[NSString alloc] initWithFormat:@"%@.width", key]; @@ -228,14 +242,14 @@ -(void)encodeCGImage:(CGImageRef)image forKey:(NSString *)key [self encodeBool:CGImageGetShouldInterpolate(image) forKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.renderingIntent", key]; - [self encodeInt:CGImageGetRenderingIntent(image) forKey:newKey]; + [self encodeInt32:CGImageGetRenderingIntent(image) forKey:newKey]; } /** @brief Encodes an @ref NSDecimal and associates it with the string @par{key}. * @param number The number to encode. * @param key The key to associate with the number. **/ --(void)encodeDecimal:(NSDecimal)number forKey:(NSString *)key +-(void)encodeDecimal:(NSDecimal)number forKey:(nonnull NSString *)key { [self encodeObject:[NSDecimalNumber decimalNumberWithDecimal:number] forKey:key]; } @@ -249,11 +263,10 @@ -(void)encodeDecimal:(NSDecimal)number forKey:(NSString *)key * @param key The key associated with the number. * @return The number as a @ref CGFloat. **/ --(CGFloat)decodeCGFloatForKey:(NSString *)key +-(CGFloat)decodeCGFloatForKey:(nonnull NSString *)key { #if CGFLOAT_IS_DOUBLE return [self decodeDoubleForKey:key]; - #else return [self decodeFloatForKey:key]; #endif @@ -265,7 +278,7 @@ -(CGFloat)decodeCGFloatForKey:(NSString *)key * @param key The key associated with the point. * @return The point. **/ --(CGPoint)decodeCPTPointForKey:(NSString *)key +-(CGPoint)decodeCPTPointForKey:(nonnull NSString *)key { CGPoint point; @@ -285,7 +298,7 @@ -(CGPoint)decodeCPTPointForKey:(NSString *)key * @param key The key associated with the size. * @return The size. **/ --(CGSize)decodeCPTSizeForKey:(NSString *)key +-(CGSize)decodeCPTSizeForKey:(nonnull NSString *)key { CGSize size; @@ -305,7 +318,7 @@ -(CGSize)decodeCPTSizeForKey:(NSString *)key * @param key The key associated with the rectangle. * @return The rectangle. **/ --(CGRect)decodeCPTRectForKey:(NSString *)key +-(CGRect)decodeCPTRectForKey:(nonnull NSString *)key { CGRect rect; @@ -326,17 +339,29 @@ -(CGRect)decodeCPTRectForKey:(NSString *)key * @return The new path. * @note The current implementation only works with named color spaces. **/ --(CGColorSpaceRef)newCGColorSpaceDecodeForKey:(NSString *)key +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-parameter" +#endif +-(nullable CGColorSpaceRef)newCGColorSpaceDecodeForKey:(nonnull NSString *)key { CGColorSpaceRef colorSpace = NULL; -#if TARGET_IPHONE_SIMULATOR || TARGET_OS_IPHONE +#if TARGET_OS_SIMULATOR || TARGET_OS_IPHONE NSLog(@"Color space decoding is not supported on iOS. Using generic RGB color space."); colorSpace = CGColorSpaceCreateDeviceRGB(); +#pragma clang diagnostic pop #else - NSData *iccProfile = [self decodeObjectForKey:key]; + NSData *iccProfile = [self decodeObjectOfClass:[NSData class] + forKey:key]; if ( iccProfile ) { - colorSpace = CGColorSpaceCreateWithICCProfile( (__bridge CFDataRef)iccProfile ); + // CGColorSpaceCreateWithICCProfile() is deprecated as of macOS 10.13 + if ( CGColorSpaceCreateWithICCData ) { + colorSpace = CGColorSpaceCreateWithICCData((__bridge CFDataRef)iccProfile); + } + else { + colorSpace = CGColorSpaceCreateWithICCProfile((__bridge CFDataRef)iccProfile); + } } else { NSLog(@"Color space not available for key '%@'. Using generic RGB color space.", key); @@ -353,18 +378,18 @@ -(CGColorSpaceRef)newCGColorSpaceDecodeForKey:(NSString *)key * @param key The key associated with the path. * @return The new path. **/ --(CGPathRef)newCGPathDecodeForKey:(NSString *)key +-(nullable CGPathRef)newCGPathDecodeForKey:(nonnull NSString *)key { CGMutablePathRef newPath = CGPathCreateMutable(); // decode count NSString *newKey = [[NSString alloc] initWithFormat:@"%@.count", key]; - NSUInteger count = (NSUInteger)[self decodeIntegerForKey : newKey]; + NSUInteger count = (NSUInteger)[self decodeIntegerForKey:newKey]; // decode elements for ( NSUInteger i = 0; i < count; i++ ) { newKey = [[NSString alloc] initWithFormat:@"%@[%lu].type", key, (unsigned long)i]; - CGPathElementType type = (CGPathElementType)[self decodeIntForKey : newKey]; + CGPathElementType type = (CGPathElementType)[self decodeIntForKey:newKey]; CGPoint point1 = CGPointZero; CGPoint point2 = CGPointZero; @@ -421,22 +446,22 @@ -(CGPathRef)newCGPathDecodeForKey:(NSString *)key * @param key The key associated with the image. * @return The new image. **/ --(CGImageRef)newCGImageDecodeForKey:(NSString *)key +-(nullable CGImageRef)newCGImageDecodeForKey:(nonnull NSString *)key { NSString *newKey = [[NSString alloc] initWithFormat:@"%@.width", key]; - size_t width = (size_t)[self decodeInt64ForKey : newKey]; + size_t width = (size_t)[self decodeInt64ForKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.height", key]; - size_t height = (size_t)[self decodeInt64ForKey : newKey]; + size_t height = (size_t)[self decodeInt64ForKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.bitsPerComponent", key]; - size_t bitsPerComponent = (size_t)[self decodeInt64ForKey : newKey]; + size_t bitsPerComponent = (size_t)[self decodeInt64ForKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.bitsPerPixel", key]; - size_t bitsPerPixel = (size_t)[self decodeInt64ForKey : newKey]; + size_t bitsPerPixel = (size_t)[self decodeInt64ForKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.bytesPerRow", key]; - size_t bytesPerRow = (size_t)[self decodeInt64ForKey : newKey]; + size_t bytesPerRow = (size_t)[self decodeInt64ForKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.colorSpace", key]; CGColorSpaceRef colorSpace = [self newCGColorSpaceDecodeForKey:newKey]; @@ -446,14 +471,15 @@ -(CGImageRef)newCGImageDecodeForKey:(NSString *)key const CGBitmapInfo *bitmapInfo = (const void *)[self decodeBytesForKey:newKey returnedLength:&length]; newKey = [[NSString alloc] initWithFormat:@"%@.provider", key]; - CGDataProviderRef provider = CGDataProviderCreateWithCFData( (__bridge CFDataRef)[self decodeObjectForKey:newKey] ); + CGDataProviderRef provider = CGDataProviderCreateWithCFData((__bridge CFDataRef)[self decodeObjectOfClass:[NSData class] + forKey:newKey]); newKey = [[NSString alloc] initWithFormat:@"%@.numberOfComponents", key]; - size_t numberOfComponents = (size_t)[self decodeInt64ForKey : newKey]; + size_t numberOfComponents = (size_t)[self decodeInt64ForKey:newKey]; CGFloat *decodeArray = NULL; if ( numberOfComponents ) { - decodeArray = malloc( numberOfComponents * 2 * sizeof(CGFloat) ); + decodeArray = calloc((numberOfComponents * 2), sizeof(CGFloat)); for ( size_t i = 0; i < numberOfComponents; i++ ) { newKey = [[NSString alloc] initWithFormat:@"%@.decode[%zu].lower", key, i]; @@ -468,7 +494,7 @@ -(CGImageRef)newCGImageDecodeForKey:(NSString *)key bool shouldInterpolate = [self decodeBoolForKey:newKey]; newKey = [[NSString alloc] initWithFormat:@"%@.renderingIntent", key]; - CGColorRenderingIntent intent = (CGColorRenderingIntent)[self decodeIntForKey : newKey]; + CGColorRenderingIntent intent = (CGColorRenderingIntent)[self decodeInt32ForKey:newKey]; CGImageRef newImage = CGImageCreate(width, height, @@ -497,14 +523,15 @@ -(CGImageRef)newCGImageDecodeForKey:(NSString *)key * @param key The key associated with the number. * @return The number as an @ref NSDecimal. **/ --(NSDecimal)decodeDecimalForKey:(NSString *)key +-(NSDecimal)decodeDecimalForKey:(nonnull NSString *)key { NSDecimal result; - NSNumber *number = [self decodeObjectForKey:key]; + NSNumber *number = [self decodeObjectOfClass:[NSDecimalNumber class] + forKey:key]; if ( [number respondsToSelector:@selector(decimalValue)] ) { - result = [number decimalValue]; + result = number.decimalValue; } else { result = CPTDecimalNaN(); diff --git a/framework/Source/NSDecimalNumberExtensions.h b/framework/Source/NSDecimalNumberExtensions.h index d0e48e815..1d41a0eb5 100644 --- a/framework/Source/NSDecimalNumberExtensions.h +++ b/framework/Source/NSDecimalNumberExtensions.h @@ -3,4 +3,6 @@ **/ @interface NSDecimalNumber(CPTExtensions) +-(nonnull NSDecimalNumber *)decimalNumber; + @end diff --git a/framework/Source/NSDecimalNumberExtensions.m b/framework/Source/NSDecimalNumberExtensions.m index e096ef023..b27563037 100644 --- a/framework/Source/NSDecimalNumberExtensions.m +++ b/framework/Source/NSDecimalNumberExtensions.m @@ -5,7 +5,7 @@ @implementation NSDecimalNumber(CPTExtensions) /** @brief Returns the value of the receiver as an NSDecimalNumber. * @return The value of the receiver as an NSDecimalNumber. **/ --(NSDecimalNumber *)decimalNumber +-(nonnull NSDecimalNumber *)decimalNumber { return [self copy]; } diff --git a/framework/Source/NSNumberExtensions.m b/framework/Source/NSNumberExtensions.m index 3f795af9a..a9ee47ab0 100644 --- a/framework/Source/NSNumberExtensions.m +++ b/framework/Source/NSNumberExtensions.m @@ -6,7 +6,7 @@ @implementation NSNumber(CPTExtensions) * @param number The value for the new number. * @return An NSNumber object containing value, treating it as a @ref CGFloat. **/ -+(instancetype)numberWithCGFloat:(CGFloat)number ++(nonnull instancetype)numberWithCGFloat:(CGFloat)number { return @(number); } @@ -17,8 +17,7 @@ +(instancetype)numberWithCGFloat:(CGFloat)number -(CGFloat)cgFloatValue { #if CGFLOAT_IS_DOUBLE - return [self doubleValue]; - + return self.doubleValue; #else return [self floatValue]; #endif @@ -28,11 +27,10 @@ -(CGFloat)cgFloatValue * @param number The value for the new number. * @return An NSNumber object containing value, treating it as a @ref CGFloat. **/ --(instancetype)initWithCGFloat:(CGFloat)number +-(nonnull instancetype)initWithCGFloat:(CGFloat)number { #if CGFLOAT_IS_DOUBLE return [self initWithDouble:number]; - #else return [self initWithFloat:number]; #endif @@ -41,12 +39,12 @@ -(instancetype)initWithCGFloat:(CGFloat)number /** @brief Returns the value of the receiver as an NSDecimalNumber. * @return The value of the receiver as an NSDecimalNumber. **/ --(NSDecimalNumber *)decimalNumber +-(nonnull NSDecimalNumber *)decimalNumber { if ( [self isMemberOfClass:[NSDecimalNumber class]] ) { return (NSDecimalNumber *)self; } - return [NSDecimalNumber decimalNumberWithDecimal:[self decimalValue]]; + return [NSDecimalNumber decimalNumberWithDecimal:self.decimalValue]; } @end diff --git a/framework/Source/_CPTAnimationCGFloatPeriod.m b/framework/Source/_CPTAnimationCGFloatPeriod.m index 9f31b267e..1bcf82cea 100644 --- a/framework/Source/_CPTAnimationCGFloatPeriod.m +++ b/framework/Source/_CPTAnimationCGFloatPeriod.m @@ -5,7 +5,7 @@ /// @cond @interface _CPTAnimationCGFloatPeriod() -CGFloat CPTCurrentFloatValue(id boundObject, SEL boundGetter); +CGFloat CPTCurrentFloatValue(id __nonnull boundObject, SEL __nonnull boundGetter); @end /// @endcond @@ -14,12 +14,12 @@ @interface _CPTAnimationCGFloatPeriod() @implementation _CPTAnimationCGFloatPeriod -CGFloat CPTCurrentFloatValue(id boundObject, SEL boundGetter) +CGFloat CPTCurrentFloatValue(id __nonnull boundObject, SEL __nonnull boundGetter) { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[boundObject methodSignatureForSelector:boundGetter]]; - [invocation setTarget:boundObject]; - [invocation setSelector:boundGetter]; + invocation.target = boundObject; + invocation.selector = boundGetter; [invocation invoke]; @@ -29,12 +29,12 @@ CGFloat CPTCurrentFloatValue(id boundObject, SEL boundGetter) return value; } --(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { - self.startValue = @( CPTCurrentFloatValue(boundObject, boundGetter) ); + self.startValue = @(CPTCurrentFloatValue(boundObject, boundGetter)); } --(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { CGFloat current = CPTCurrentFloatValue(boundObject, boundGetter); CGFloat start; @@ -47,10 +47,10 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett [self.startValue getValue:&start]; [self.endValue getValue:&end]; - return ( (current >= start) && (current <= end) ) || ( (current >= end) && (current <= start) ); + return ((current >= start) && (current <= end)) || ((current >= end) && (current <= start)); } --(NSValue *)tweenedValueForProgress:(CGFloat)progress +-(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress { CGFloat start; CGFloat end; diff --git a/framework/Source/_CPTAnimationCGPointPeriod.m b/framework/Source/_CPTAnimationCGPointPeriod.m index b6acc22d1..bb6246379 100644 --- a/framework/Source/_CPTAnimationCGPointPeriod.m +++ b/framework/Source/_CPTAnimationCGPointPeriod.m @@ -3,7 +3,7 @@ /// @cond @interface _CPTAnimationCGPointPeriod() -CGPoint CPTCurrentPointValue(id boundObject, SEL boundGetter); +CGPoint CPTCurrentPointValue(id __nonnull boundObject, SEL __nonnull boundGetter); @end /// @endcond @@ -12,12 +12,12 @@ @interface _CPTAnimationCGPointPeriod() @implementation _CPTAnimationCGPointPeriod -CGPoint CPTCurrentPointValue(id boundObject, SEL boundGetter) +CGPoint CPTCurrentPointValue(id __nonnull boundObject, SEL __nonnull boundGetter) { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[boundObject methodSignatureForSelector:boundGetter]]; - [invocation setTarget:boundObject]; - [invocation setSelector:boundGetter]; + invocation.target = boundObject; + invocation.selector = boundGetter; [invocation invoke]; @@ -27,14 +27,14 @@ CGPoint CPTCurrentPointValue(id boundObject, SEL boundGetter) return value; } --(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { CGPoint start = CPTCurrentPointValue(boundObject, boundGetter); self.startValue = [NSValue valueWithBytes:&start objCType:@encode(CGPoint)]; } --(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { CGPoint current = CPTCurrentPointValue(boundObject, boundGetter); CGPoint start; @@ -47,11 +47,11 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett [self.startValue getValue:&start]; [self.endValue getValue:&end]; - return ( ( (current.x >= start.x) && (current.x <= end.x) ) || ( (current.x >= end.x) && (current.x <= start.x) ) ) && - ( ( (current.y >= start.y) && (current.y <= end.y) ) || ( (current.y >= end.y) && (current.y <= start.y) ) ); + return (((current.x >= start.x) && (current.x <= end.x)) || ((current.x >= end.x) && (current.x <= start.x))) && + (((current.y >= start.y) && (current.y <= end.y)) || ((current.y >= end.y) && (current.y <= start.y))); } --(NSValue *)tweenedValueForProgress:(CGFloat)progress +-(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress { CGPoint start; CGPoint end; diff --git a/framework/Source/_CPTAnimationCGRectPeriod.m b/framework/Source/_CPTAnimationCGRectPeriod.m index 06a861db2..1e05bf9b8 100644 --- a/framework/Source/_CPTAnimationCGRectPeriod.m +++ b/framework/Source/_CPTAnimationCGRectPeriod.m @@ -3,7 +3,7 @@ /// @cond @interface _CPTAnimationCGRectPeriod() -CGRect CPTCurrentRectValue(id boundObject, SEL boundGetter); +CGRect CPTCurrentRectValue(id __nonnull boundObject, SEL __nonnull boundGetter); @end /// @endcond @@ -12,12 +12,12 @@ @interface _CPTAnimationCGRectPeriod() @implementation _CPTAnimationCGRectPeriod -CGRect CPTCurrentRectValue(id boundObject, SEL boundGetter) +CGRect CPTCurrentRectValue(id __nonnull boundObject, SEL __nonnull boundGetter) { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[boundObject methodSignatureForSelector:boundGetter]]; - [invocation setTarget:boundObject]; - [invocation setSelector:boundGetter]; + invocation.target = boundObject; + invocation.selector = boundGetter; [invocation invoke]; @@ -27,14 +27,14 @@ CGRect CPTCurrentRectValue(id boundObject, SEL boundGetter) return value; } --(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { CGRect start = CPTCurrentRectValue(boundObject, boundGetter); self.startValue = [NSValue valueWithBytes:&start objCType:@encode(CGRect)]; } --(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { CGRect current = CPTCurrentRectValue(boundObject, boundGetter); CGRect start; @@ -47,13 +47,13 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett [self.startValue getValue:&start]; [self.endValue getValue:&end]; - return ( ( (current.origin.x >= start.origin.x) && (current.origin.x <= end.origin.x) ) || ( (current.origin.x >= end.origin.x) && (current.origin.x <= start.origin.x) ) ) && - ( ( (current.origin.y >= start.origin.y) && (current.origin.y <= end.origin.y) ) || ( (current.origin.y >= end.origin.y) && (current.origin.y <= start.origin.y) ) ) && - ( ( (current.size.width >= start.size.width) && (current.size.width <= end.size.width) ) || ( (current.size.width >= end.size.width) && (current.size.width <= start.size.width) ) ) && - ( ( (current.size.height >= start.size.height) && (current.size.height <= end.size.height) ) || ( (current.size.height >= end.size.height) && (current.size.height <= start.size.height) ) ); + return (((current.origin.x >= start.origin.x) && (current.origin.x <= end.origin.x)) || ((current.origin.x >= end.origin.x) && (current.origin.x <= start.origin.x))) && + (((current.origin.y >= start.origin.y) && (current.origin.y <= end.origin.y)) || ((current.origin.y >= end.origin.y) && (current.origin.y <= start.origin.y))) && + (((current.size.width >= start.size.width) && (current.size.width <= end.size.width)) || ((current.size.width >= end.size.width) && (current.size.width <= start.size.width))) && + (((current.size.height >= start.size.height) && (current.size.height <= end.size.height)) || ((current.size.height >= end.size.height) && (current.size.height <= start.size.height))); } --(NSValue *)tweenedValueForProgress:(CGFloat)progress +-(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress { CGRect start; CGRect end; diff --git a/framework/Source/_CPTAnimationCGSizePeriod.m b/framework/Source/_CPTAnimationCGSizePeriod.m index 02784bbca..e0b54f48e 100644 --- a/framework/Source/_CPTAnimationCGSizePeriod.m +++ b/framework/Source/_CPTAnimationCGSizePeriod.m @@ -3,7 +3,7 @@ /// @cond @interface _CPTAnimationCGSizePeriod() -CGSize CPTCurrentSizeValue(id boundObject, SEL boundGetter); +CGSize CPTCurrentSizeValue(id __nonnull boundObject, SEL __nonnull boundGetter); @end /// @endcond @@ -12,12 +12,12 @@ @interface _CPTAnimationCGSizePeriod() @implementation _CPTAnimationCGSizePeriod -CGSize CPTCurrentSizeValue(id boundObject, SEL boundGetter) +CGSize CPTCurrentSizeValue(id __nonnull boundObject, SEL __nonnull boundGetter) { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[boundObject methodSignatureForSelector:boundGetter]]; - [invocation setTarget:boundObject]; - [invocation setSelector:boundGetter]; + invocation.target = boundObject; + invocation.selector = boundGetter; [invocation invoke]; @@ -27,14 +27,14 @@ CGSize CPTCurrentSizeValue(id boundObject, SEL boundGetter) return value; } --(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { CGSize start = CPTCurrentSizeValue(boundObject, boundGetter); self.startValue = [NSValue valueWithBytes:&start objCType:@encode(CGSize)]; } --(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { CGSize current = CPTCurrentSizeValue(boundObject, boundGetter); CGSize start; @@ -47,11 +47,11 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett [self.startValue getValue:&start]; [self.endValue getValue:&end]; - return ( ( (current.width >= start.width) && (current.width <= end.width) ) || ( (current.width >= end.width) && (current.width <= start.width) ) ) && - ( ( (current.height >= start.height) && (current.height <= end.height) ) || ( (current.height >= end.height) && (current.height <= start.height) ) ); + return (((current.width >= start.width) && (current.width <= end.width)) || ((current.width >= end.width) && (current.width <= start.width))) && + (((current.height >= start.height) && (current.height <= end.height)) || ((current.height >= end.height) && (current.height <= start.height))); } --(NSValue *)tweenedValueForProgress:(CGFloat)progress +-(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress { CGSize start; CGSize end; diff --git a/framework/Source/_CPTAnimationNSDecimalPeriod.m b/framework/Source/_CPTAnimationNSDecimalPeriod.m index b6ec08820..bcf36e651 100644 --- a/framework/Source/_CPTAnimationNSDecimalPeriod.m +++ b/framework/Source/_CPTAnimationNSDecimalPeriod.m @@ -5,7 +5,7 @@ /// @cond @interface _CPTAnimationNSDecimalPeriod() -NSDecimal CPTCurrentDecimalValue(id boundObject, SEL boundGetter); +NSDecimal CPTCurrentDecimalValue(id __nonnull boundObject, SEL __nonnull boundGetter); @end /// @endcond @@ -14,12 +14,12 @@ @interface _CPTAnimationNSDecimalPeriod() @implementation _CPTAnimationNSDecimalPeriod -NSDecimal CPTCurrentDecimalValue(id boundObject, SEL boundGetter) +NSDecimal CPTCurrentDecimalValue(id __nonnull boundObject, SEL __nonnull boundGetter) { NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[boundObject methodSignatureForSelector:boundGetter]]; - [invocation setTarget:boundObject]; - [invocation setSelector:boundGetter]; + invocation.target = boundObject; + invocation.selector = boundGetter; [invocation invoke]; @@ -29,34 +29,34 @@ NSDecimal CPTCurrentDecimalValue(id boundObject, SEL boundGetter) return value; } --(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { NSDecimal start = CPTCurrentDecimalValue(boundObject, boundGetter); self.startValue = [NSDecimalNumber decimalNumberWithDecimal:start]; } --(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { if ( !self.startValue ) { [self setStartValueFromObject:boundObject propertyGetter:boundGetter]; } NSDecimal current = CPTCurrentDecimalValue(boundObject, boundGetter); - NSDecimal start = [(NSDecimalNumber *)self.startValue decimalValue]; - NSDecimal end = [(NSDecimalNumber *)self.endValue decimalValue]; + NSDecimal start = ((NSDecimalNumber *)self.startValue).decimalValue; + NSDecimal end = ((NSDecimalNumber *)self.endValue).decimalValue; - return ( CPTDecimalGreaterThanOrEqualTo(current, start) && CPTDecimalLessThanOrEqualTo(current, end) ) || - ( CPTDecimalGreaterThanOrEqualTo(current, end) && CPTDecimalLessThanOrEqualTo(current, start) ); + return (CPTDecimalGreaterThanOrEqualTo(current, start) && CPTDecimalLessThanOrEqualTo(current, end)) || + (CPTDecimalGreaterThanOrEqualTo(current, end) && CPTDecimalLessThanOrEqualTo(current, start)); } --(NSValue *)tweenedValueForProgress:(CGFloat)progress +-(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress { - NSDecimal start = [(NSDecimalNumber *)self.startValue decimalValue]; - NSDecimal end = [(NSDecimalNumber *)self.endValue decimalValue]; + NSDecimal start = ((NSDecimalNumber *)self.startValue).decimalValue; + NSDecimal end = ((NSDecimalNumber *)self.endValue).decimalValue; NSDecimal length = CPTDecimalSubtract(end, start); - NSDecimal tweenedValue = CPTDecimalAdd( start, CPTDecimalMultiply(CPTDecimalFromCGFloat(progress), length) ); + NSDecimal tweenedValue = CPTDecimalAdd(start, CPTDecimalMultiply(CPTDecimalFromCGFloat(progress), length)); return [NSDecimalNumber decimalNumberWithDecimal:tweenedValue]; } diff --git a/framework/Source/_CPTAnimationNSNumberPeriod.h b/framework/Source/_CPTAnimationNSNumberPeriod.h new file mode 100644 index 000000000..dfe744ba3 --- /dev/null +++ b/framework/Source/_CPTAnimationNSNumberPeriod.h @@ -0,0 +1,5 @@ +#import "CPTAnimationPeriod.h" + +@interface _CPTAnimationNSNumberPeriod : CPTAnimationPeriod + +@end diff --git a/framework/Source/_CPTAnimationNSNumberPeriod.m b/framework/Source/_CPTAnimationNSNumberPeriod.m new file mode 100644 index 000000000..e4692f041 --- /dev/null +++ b/framework/Source/_CPTAnimationNSNumberPeriod.m @@ -0,0 +1,74 @@ +#import "_CPTAnimationNSNumberPeriod.h" + +#import "CPTUtilities.h" + +@implementation _CPTAnimationNSNumberPeriod + +-(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +{ + typedef NSNumber *(*GetterType)(id, SEL); + GetterType getterMethod = (GetterType)[boundObject methodForSelector:boundGetter]; + + self.startValue = getterMethod(boundObject, boundGetter); +} + +-(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +{ + if ( !self.startValue ) { + [self setStartValueFromObject:boundObject propertyGetter:boundGetter]; + } + + typedef NSNumber *(*GetterType)(id, SEL); + GetterType getterMethod = (GetterType)[boundObject methodForSelector:boundGetter]; + + NSNumber *current = getterMethod(boundObject, boundGetter); + NSNumber *start = (NSNumber *)self.startValue; + NSNumber *end = (NSNumber *)self.endValue; + + Class decimalClass = [NSDecimalNumber class]; + + if ( [start isKindOfClass:decimalClass] || [end isKindOfClass:decimalClass] ) { + NSDecimal currentDecimal = current.decimalValue; + NSDecimal startDecimal = start.decimalValue; + NSDecimal endDecimal = end.decimalValue; + + return (CPTDecimalGreaterThanOrEqualTo(currentDecimal, startDecimal) && CPTDecimalLessThanOrEqualTo(currentDecimal, endDecimal)) || + (CPTDecimalGreaterThanOrEqualTo(currentDecimal, endDecimal) && CPTDecimalLessThanOrEqualTo(currentDecimal, startDecimal)); + } + else { + double currentDouble = current.doubleValue; + double startDouble = start.doubleValue; + double endDouble = end.doubleValue; + + return ((currentDouble >= startDouble) && (currentDouble <= endDouble)) || + ((currentDouble >= endDouble) && (currentDouble <= startDouble)); + } +} + +-(NSValue *)tweenedValueForProgress:(CGFloat)progress +{ + NSNumber *start = (NSNumber *)self.startValue; + NSNumber *end = (NSNumber *)self.endValue; + + Class decimalClass = [NSDecimalNumber class]; + + if ( [start isKindOfClass:decimalClass] || [end isKindOfClass:decimalClass] ) { + NSDecimal startDecimal = start.decimalValue; + NSDecimal endDecimal = end.decimalValue; + + NSDecimal length = CPTDecimalSubtract(endDecimal, startDecimal); + NSDecimal tweenedValue = CPTDecimalAdd(startDecimal, CPTDecimalMultiply(CPTDecimalFromCGFloat(progress), length)); + + return [NSDecimalNumber decimalNumberWithDecimal:tweenedValue]; + } + else { + double startDouble = start.doubleValue; + double endDouble = end.doubleValue; + + double tweenedValue = startDouble + (double)progress * (endDouble - startDouble); + + return @(tweenedValue); + } +} + +@end diff --git a/framework/Source/_CPTAnimationPlotRangePeriod.m b/framework/Source/_CPTAnimationPlotRangePeriod.m index 51ddf7955..857d65506 100644 --- a/framework/Source/_CPTAnimationPlotRangePeriod.m +++ b/framework/Source/_CPTAnimationPlotRangePeriod.m @@ -5,22 +5,22 @@ @implementation _CPTAnimationPlotRangePeriod --(void)setStartValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(void)setStartValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { typedef NSValue *(*GetterType)(id, SEL); - GetterType getterMethod = (GetterType)[boundObject methodForSelector : boundGetter]; + GetterType getterMethod = (GetterType)[boundObject methodForSelector:boundGetter]; self.startValue = getterMethod(boundObject, boundGetter); } --(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGetter +-(BOOL)canStartWithValueFromObject:(nonnull id)boundObject propertyGetter:(nonnull SEL)boundGetter { if ( !self.startValue ) { [self setStartValueFromObject:boundObject propertyGetter:boundGetter]; } typedef CPTPlotRange *(*GetterType)(id, SEL); - GetterType getterMethod = (GetterType)[boundObject methodForSelector : boundGetter]; + GetterType getterMethod = (GetterType)[boundObject methodForSelector:boundGetter]; CPTPlotRange *current = getterMethod(boundObject, boundGetter); CPTPlotRange *start = (CPTPlotRange *)self.startValue; @@ -30,11 +30,11 @@ -(BOOL)canStartWithValueFromObject:(id)boundObject propertyGetter:(SEL)boundGett NSDecimal startLoc = start.locationDecimal; NSDecimal endLoc = end.locationDecimal; - return ( CPTDecimalGreaterThanOrEqualTo(currentLoc, startLoc) && CPTDecimalLessThanOrEqualTo(currentLoc, endLoc) ) || - ( CPTDecimalGreaterThanOrEqualTo(currentLoc, endLoc) && CPTDecimalLessThanOrEqualTo(currentLoc, startLoc) ); + return (CPTDecimalGreaterThanOrEqualTo(currentLoc, startLoc) && CPTDecimalLessThanOrEqualTo(currentLoc, endLoc)) || + (CPTDecimalGreaterThanOrEqualTo(currentLoc, endLoc) && CPTDecimalLessThanOrEqualTo(currentLoc, startLoc)); } --(NSValue *)tweenedValueForProgress:(CGFloat)progress +-(nonnull NSValue *)tweenedValueForProgress:(CGFloat)progress { CPTPlotRange *start = (CPTPlotRange *)self.startValue; CPTPlotRange *end = (CPTPlotRange *)self.endValue; @@ -42,10 +42,10 @@ -(NSValue *)tweenedValueForProgress:(CGFloat)progress NSDecimal progressDecimal = CPTDecimalFromCGFloat(progress); NSDecimal locationDiff = CPTDecimalSubtract(end.locationDecimal, start.locationDecimal); - NSDecimal tweenedLocation = CPTDecimalAdd( start.locationDecimal, CPTDecimalMultiply(progressDecimal, locationDiff) ); + NSDecimal tweenedLocation = CPTDecimalAdd(start.locationDecimal, CPTDecimalMultiply(progressDecimal, locationDiff)); NSDecimal lengthDiff = CPTDecimalSubtract(end.lengthDecimal, start.lengthDecimal); - NSDecimal tweenedLength = CPTDecimalAdd( start.lengthDecimal, CPTDecimalMultiply(progressDecimal, lengthDiff) ); + NSDecimal tweenedLength = CPTDecimalAdd(start.lengthDecimal, CPTDecimalMultiply(progressDecimal, lengthDiff)); return (NSValue *)[CPTPlotRange plotRangeWithLocationDecimal:tweenedLocation lengthDecimal:tweenedLength]; } diff --git a/framework/Source/_CPTAnimationTimingFunctions.m b/framework/Source/_CPTAnimationTimingFunctions.m index f43c7f84b..36b20aa6e 100644 --- a/framework/Source/_CPTAnimationTimingFunctions.m +++ b/framework/Source/_CPTAnimationTimingFunctions.m @@ -15,13 +15,13 @@ **/ CGFloat CPTAnimationTimingFunctionLinear(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -41,17 +41,17 @@ CGFloat CPTAnimationTimingFunctionBackIn(CGFloat elapsedTime, CGFloat duration) { const CGFloat s = CPTFloat(1.70158); - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return elapsedTime * elapsedTime * ( ( s + CPTFloat(1.0) ) * elapsedTime - s ); + return elapsedTime * elapsedTime * ((s + CPTFloat(1.0)) * elapsedTime - s); } /** @@ -64,17 +64,17 @@ CGFloat CPTAnimationTimingFunctionBackOut(CGFloat elapsedTime, CGFloat duration) { const CGFloat s = CPTFloat(1.70158); - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } - return elapsedTime * elapsedTime * ( ( s + CPTFloat(1.0) ) * elapsedTime + s ) + CPTFloat(1.0); + return elapsedTime * elapsedTime * ((s + CPTFloat(1.0)) * elapsedTime + s) + CPTFloat(1.0); } /** @@ -87,23 +87,23 @@ CGFloat CPTAnimationTimingFunctionBackInOut(CGFloat elapsedTime, CGFloat duratio { const CGFloat s = CPTFloat(1.70158 * 1.525); - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { - return CPTFloat(0.5) * ( elapsedTime * elapsedTime * ( ( s + CPTFloat(1.0) ) * elapsedTime - s ) ); + if ( elapsedTime < CPTFloat(1.0)) { + return CPTFloat(0.5) * (elapsedTime * elapsedTime * ((s + CPTFloat(1.0)) * elapsedTime - s)); } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(0.5) * ( elapsedTime * elapsedTime * ( ( s + CPTFloat(1.0) ) * elapsedTime + s ) + CPTFloat(2.0) ); + return CPTFloat(0.5) * (elapsedTime * elapsedTime * ((s + CPTFloat(1.0)) * elapsedTime + s) + CPTFloat(2.0)); } } @@ -129,25 +129,25 @@ CGFloat CPTAnimationTimingFunctionBounceIn(CGFloat elapsedTime, CGFloat duration **/ CGFloat CPTAnimationTimingFunctionBounceOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0 / 2.75) ) { + if ( elapsedTime < CPTFloat(1.0 / 2.75)) { return CPTFloat(7.5625) * elapsedTime * elapsedTime; } - else if ( elapsedTime < CPTFloat(2.0 / 2.75) ) { + else if ( elapsedTime < CPTFloat(2.0 / 2.75)) { elapsedTime -= CPTFloat(1.5 / 2.75); return CPTFloat(7.5625) * elapsedTime * elapsedTime + CPTFloat(0.75); } - else if ( elapsedTime < CPTFloat(2.5 / 2.75) ) { + else if ( elapsedTime < CPTFloat(2.5 / 2.75)) { elapsedTime -= CPTFloat(2.25 / 2.75); return CPTFloat(7.5625) * elapsedTime * elapsedTime + CPTFloat(0.9375); @@ -167,7 +167,7 @@ CGFloat CPTAnimationTimingFunctionBounceOut(CGFloat elapsedTime, CGFloat duratio **/ CGFloat CPTAnimationTimingFunctionBounceInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime < duration * CPTFloat(0.5) ) { + if ( elapsedTime < duration * CPTFloat(0.5)) { return CPTAnimationTimingFunctionBounceIn(elapsedTime * CPTFloat(2.0), duration) * CPTFloat(0.5); } else { @@ -187,17 +187,17 @@ CGFloat CPTAnimationTimingFunctionBounceInOut(CGFloat elapsedTime, CGFloat durat **/ CGFloat CPTAnimationTimingFunctionCircularIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return -( sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) - CPTFloat(1.0) ); + return -(sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) - CPTFloat(1.0)); } /** @@ -208,13 +208,13 @@ CGFloat CPTAnimationTimingFunctionCircularIn(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionCircularOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } @@ -229,23 +229,23 @@ CGFloat CPTAnimationTimingFunctionCircularOut(CGFloat elapsedTime, CGFloat durat **/ CGFloat CPTAnimationTimingFunctionCircularInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { - return CPTFloat(-0.5) * ( sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) - CPTFloat(1.0) ); + if ( elapsedTime < CPTFloat(1.0)) { + return CPTFloat(-0.5) * (sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) - CPTFloat(1.0)); } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(0.5) * ( sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) + CPTFloat(1.0) ); + return CPTFloat(0.5) * (sqrt(CPTFloat(1.0) - elapsedTime * elapsedTime) + CPTFloat(1.0)); } } @@ -260,13 +260,13 @@ CGFloat CPTAnimationTimingFunctionCircularInOut(CGFloat elapsedTime, CGFloat dur **/ CGFloat CPTAnimationTimingFunctionElasticIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -275,7 +275,7 @@ CGFloat CPTAnimationTimingFunctionElasticIn(CGFloat elapsedTime, CGFloat duratio elapsedTime -= CPTFloat(1.0); - return -( pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime) * sin( (elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period ) ); + return -(pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime) * sin((elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period)); } /** @@ -286,20 +286,20 @@ CGFloat CPTAnimationTimingFunctionElasticIn(CGFloat elapsedTime, CGFloat duratio **/ CGFloat CPTAnimationTimingFunctionElasticOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } CGFloat period = duration * CPTFloat(0.3); CGFloat s = period * CPTFloat(0.25); - return pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) * sin( (elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period ) + CPTFloat(1.0); + return pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) * sin((elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period) + CPTFloat(1.0); } /** @@ -310,13 +310,13 @@ CGFloat CPTAnimationTimingFunctionElasticOut(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionElasticInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } @@ -325,11 +325,11 @@ CGFloat CPTAnimationTimingFunctionElasticInOut(CGFloat elapsedTime, CGFloat dura elapsedTime -= CPTFloat(1.0); - if ( elapsedTime < CPTFloat(0.0) ) { - return CPTFloat(-0.5) * ( pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime) * sin( (elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period ) ); + if ( elapsedTime < CPTFloat(0.0)) { + return CPTFloat(-0.5) * (pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime) * sin((elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period)); } else { - return pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) * sin( (elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period ) * CPTFloat(0.5) + CPTFloat(1.0); + return pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) * sin((elapsedTime * duration - s) * CPTFloat(2.0 * M_PI) / period) * CPTFloat(0.5) + CPTFloat(1.0); } } @@ -344,17 +344,17 @@ CGFloat CPTAnimationTimingFunctionElasticInOut(CGFloat elapsedTime, CGFloat dura **/ CGFloat CPTAnimationTimingFunctionExponentialIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return pow( CPTFloat(2.0), CPTFloat(10.0) * ( elapsedTime - CPTFloat(1.0) ) ); + return pow(CPTFloat(2.0), CPTFloat(10.0) * (elapsedTime - CPTFloat(1.0))); } /** @@ -365,13 +365,13 @@ CGFloat CPTAnimationTimingFunctionExponentialIn(CGFloat elapsedTime, CGFloat dur **/ CGFloat CPTAnimationTimingFunctionExponentialOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -386,22 +386,22 @@ CGFloat CPTAnimationTimingFunctionExponentialOut(CGFloat elapsedTime, CGFloat du **/ CGFloat CPTAnimationTimingFunctionExponentialInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); elapsedTime -= CPTFloat(1.0); - if ( elapsedTime >= 1.0 ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(0.0) ) { + if ( elapsedTime < CPTFloat(0.0)) { return CPTFloat(0.5) * pow(CPTFloat(2.0), CPTFloat(10.0) * elapsedTime); } else { - return CPTFloat(0.5) * ( -pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) + CPTFloat(2.0) ); + return CPTFloat(0.5) * (-pow(CPTFloat(2.0), CPTFloat(-10.0) * elapsedTime) + CPTFloat(2.0)); } } @@ -416,17 +416,17 @@ CGFloat CPTAnimationTimingFunctionExponentialInOut(CGFloat elapsedTime, CGFloat **/ CGFloat CPTAnimationTimingFunctionSinusoidalIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return -cos( elapsedTime * CPTFloat(M_PI_2) ) + CPTFloat(1.0); + return -cos(elapsedTime * CPTFloat(M_PI_2)) + CPTFloat(1.0); } /** @@ -437,17 +437,17 @@ CGFloat CPTAnimationTimingFunctionSinusoidalIn(CGFloat elapsedTime, CGFloat dura **/ CGFloat CPTAnimationTimingFunctionSinusoidalOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return sin( elapsedTime * CPTFloat(M_PI_2) ); + return sin(elapsedTime * CPTFloat(M_PI_2)); } /** @@ -458,17 +458,17 @@ CGFloat CPTAnimationTimingFunctionSinusoidalOut(CGFloat elapsedTime, CGFloat dur **/ CGFloat CPTAnimationTimingFunctionSinusoidalInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return CPTFloat(-0.5) * ( cos(CPTFloat(M_PI) * elapsedTime) - CPTFloat(1.0) ); + return CPTFloat(-0.5) * (cos(CPTFloat(M_PI) * elapsedTime) - CPTFloat(1.0)); } #pragma mark - @@ -482,13 +482,13 @@ CGFloat CPTAnimationTimingFunctionSinusoidalInOut(CGFloat elapsedTime, CGFloat d **/ CGFloat CPTAnimationTimingFunctionCubicIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -503,13 +503,13 @@ CGFloat CPTAnimationTimingFunctionCubicIn(CGFloat elapsedTime, CGFloat duration) **/ CGFloat CPTAnimationTimingFunctionCubicOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } @@ -524,23 +524,23 @@ CGFloat CPTAnimationTimingFunctionCubicOut(CGFloat elapsedTime, CGFloat duration **/ CGFloat CPTAnimationTimingFunctionCubicInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { + if ( elapsedTime < CPTFloat(1.0)) { return CPTFloat(0.5) * elapsedTime * elapsedTime * elapsedTime; } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(0.5) * ( elapsedTime * elapsedTime * elapsedTime + CPTFloat(2.0) ); + return CPTFloat(0.5) * (elapsedTime * elapsedTime * elapsedTime + CPTFloat(2.0)); } } @@ -555,13 +555,13 @@ CGFloat CPTAnimationTimingFunctionCubicInOut(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionQuadraticIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -576,17 +576,17 @@ CGFloat CPTAnimationTimingFunctionQuadraticIn(CGFloat elapsedTime, CGFloat durat **/ CGFloat CPTAnimationTimingFunctionQuadraticOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } - return -elapsedTime * ( elapsedTime - CPTFloat(2.0) ); + return -elapsedTime * (elapsedTime - CPTFloat(2.0)); } /** @@ -597,23 +597,23 @@ CGFloat CPTAnimationTimingFunctionQuadraticOut(CGFloat elapsedTime, CGFloat dura **/ CGFloat CPTAnimationTimingFunctionQuadraticInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { + if ( elapsedTime < CPTFloat(1.0)) { return CPTFloat(0.5) * elapsedTime * elapsedTime; } else { elapsedTime -= CPTFloat(1.0); - return CPTFloat(-0.5) * ( elapsedTime * ( elapsedTime - CPTFloat(2.0) ) - CPTFloat(1.0) ); + return CPTFloat(-0.5) * (elapsedTime * (elapsedTime - CPTFloat(2.0)) - CPTFloat(1.0)); } } @@ -628,13 +628,13 @@ CGFloat CPTAnimationTimingFunctionQuadraticInOut(CGFloat elapsedTime, CGFloat du **/ CGFloat CPTAnimationTimingFunctionQuarticIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -649,17 +649,17 @@ CGFloat CPTAnimationTimingFunctionQuarticIn(CGFloat elapsedTime, CGFloat duratio **/ CGFloat CPTAnimationTimingFunctionQuarticOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } - return -( elapsedTime * elapsedTime * elapsedTime * elapsedTime - CPTFloat(1.0) ); + return -(elapsedTime * elapsedTime * elapsedTime * elapsedTime - CPTFloat(1.0)); } /** @@ -670,23 +670,23 @@ CGFloat CPTAnimationTimingFunctionQuarticOut(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionQuarticInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { + if ( elapsedTime < CPTFloat(1.0)) { return CPTFloat(0.5) * elapsedTime * elapsedTime * elapsedTime * elapsedTime; } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(-0.5) * ( elapsedTime * elapsedTime * elapsedTime * elapsedTime - CPTFloat(2.0) ); + return CPTFloat(-0.5) * (elapsedTime * elapsedTime * elapsedTime * elapsedTime - CPTFloat(2.0)); } } @@ -701,13 +701,13 @@ CGFloat CPTAnimationTimingFunctionQuarticInOut(CGFloat elapsedTime, CGFloat dura **/ CGFloat CPTAnimationTimingFunctionQuinticIn(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration; - if ( elapsedTime >= CPTFloat(1.0) ) { + if ( elapsedTime >= CPTFloat(1.0)) { return CPTFloat(1.0); } @@ -722,13 +722,13 @@ CGFloat CPTAnimationTimingFunctionQuinticIn(CGFloat elapsedTime, CGFloat duratio **/ CGFloat CPTAnimationTimingFunctionQuinticOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime = elapsedTime / duration - CPTFloat(1.0); - if ( elapsedTime >= CPTFloat(0.0) ) { + if ( elapsedTime >= CPTFloat(0.0)) { return CPTFloat(1.0); } @@ -743,22 +743,22 @@ CGFloat CPTAnimationTimingFunctionQuinticOut(CGFloat elapsedTime, CGFloat durati **/ CGFloat CPTAnimationTimingFunctionQuinticInOut(CGFloat elapsedTime, CGFloat duration) { - if ( elapsedTime <= CPTFloat(0.0) ) { + if ( elapsedTime <= CPTFloat(0.0)) { return CPTFloat(0.0); } elapsedTime /= duration * CPTFloat(0.5); - if ( elapsedTime >= CPTFloat(2.0) ) { + if ( elapsedTime >= CPTFloat(2.0)) { return CPTFloat(1.0); } - if ( elapsedTime < CPTFloat(1.0) ) { + if ( elapsedTime < CPTFloat(1.0)) { return CPTFloat(0.5) * elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime; } else { elapsedTime -= CPTFloat(2.0); - return CPTFloat(0.5) * ( elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime + CPTFloat(2.0) ); + return CPTFloat(0.5) * (elapsedTime * elapsedTime * elapsedTime * elapsedTime * elapsedTime + CPTFloat(2.0)); } } diff --git a/framework/Source/_CPTBorderLayer.m b/framework/Source/_CPTBorderLayer.m index 30f9c1966..009fa48eb 100644 --- a/framework/Source/_CPTBorderLayer.m +++ b/framework/Source/_CPTBorderLayer.m @@ -10,7 +10,7 @@ **/ @implementation CPTBorderLayer -/** @property CPTBorderedLayer *maskedLayer +/** @property nullable CPTBorderedLayer *maskedLayer * @brief The CPTBorderedLayer masked being masked. * Its fill and border are drawn into this layer so that they are outside the mask applied to the @par{maskedLayer}. **/ @@ -31,9 +31,9 @@ @implementation CPTBorderLayer * @param newFrame The frame rectangle. * @return The initialized CPTBorderLayer object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { maskedLayer = nil; self.needsDisplayOnBoundsChange = YES; @@ -45,9 +45,9 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(instancetype)initWithLayer:(id)layer +-(nonnull instancetype)initWithLayer:(nonnull id)layer { - if ( (self = [super initWithLayer:layer]) ) { + if ((self = [super initWithLayer:layer])) { CPTBorderLayer *theLayer = (CPTBorderLayer *)layer; maskedLayer = theLayer->maskedLayer; @@ -62,29 +62,42 @@ -(instancetype)initWithLayer:(id)layer /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeObject:self.maskedLayer forKey:@"CPTBorderLayer.maskedLayer"]; } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { - maskedLayer = [coder decodeObjectForKey:@"CPTBorderLayer.maskedLayer"]; + if ((self = [super initWithCoder:coder])) { + maskedLayer = [coder decodeObjectOfClass:[CPTBorderedLayer class] + forKey:@"CPTBorderLayer.maskedLayer"]; } return self; } /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Drawing /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { if ( self.hidden ) { return; @@ -130,12 +143,12 @@ -(void)layoutSublayers } } --(CPTSublayerSet)sublayersExcludedFromAutomaticLayout +-(nullable CPTSublayerSet *)sublayersExcludedFromAutomaticLayout { CPTBorderedLayer *excludedLayer = self.maskedLayer; if ( excludedLayer ) { - CPTMutableSublayerSet excludedSublayers = [[super sublayersExcludedFromAutomaticLayout] mutableCopy]; + CPTMutableSublayerSet *excludedSublayers = [super.sublayersExcludedFromAutomaticLayout mutableCopy]; if ( !excludedSublayers ) { excludedSublayers = [NSMutableSet set]; } @@ -143,7 +156,7 @@ -(CPTSublayerSet)sublayersExcludedFromAutomaticLayout return excludedSublayers; } else { - return [super sublayersExcludedFromAutomaticLayout]; + return super.sublayersExcludedFromAutomaticLayout; } } @@ -154,7 +167,7 @@ -(CPTSublayerSet)sublayersExcludedFromAutomaticLayout /// @cond --(void)setMaskedLayer:(CPTBorderedLayer *)newLayer +-(void)setMaskedLayer:(nullable CPTBorderedLayer *)newLayer { if ( newLayer != maskedLayer ) { maskedLayer = newLayer; @@ -164,8 +177,8 @@ -(void)setMaskedLayer:(CPTBorderedLayer *)newLayer -(void)setBounds:(CGRect)newBounds { - if ( !CGRectEqualToRect(newBounds, self.bounds) ) { - [super setBounds:newBounds]; + if ( !CGRectEqualToRect(newBounds, self.bounds)) { + super.bounds = newBounds; [self setNeedsLayout]; } } diff --git a/framework/Source/_CPTConstraintsFixed.h b/framework/Source/_CPTConstraintsFixed.h index a926cd2e5..6bf4b66c5 100644 --- a/framework/Source/_CPTConstraintsFixed.h +++ b/framework/Source/_CPTConstraintsFixed.h @@ -6,7 +6,7 @@ /// @{ -(nonnull instancetype)initWithLowerOffset:(CGFloat)newOffset NS_DESIGNATED_INITIALIZER; -(nonnull instancetype)initWithUpperOffset:(CGFloat)newOffset NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} /// @name Comparison diff --git a/framework/Source/_CPTConstraintsFixed.m b/framework/Source/_CPTConstraintsFixed.m index 5b30de626..7cef014bc 100644 --- a/framework/Source/_CPTConstraintsFixed.m +++ b/framework/Source/_CPTConstraintsFixed.m @@ -30,9 +30,9 @@ @implementation _CPTConstraintsFixed * @param newOffset The offset. * @return The initialized CPTConstraints object. **/ --(instancetype)initWithLowerOffset:(CGFloat)newOffset +-(nonnull instancetype)initWithLowerOffset:(CGFloat)newOffset { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = newOffset; isFixedToLower = YES; } @@ -44,9 +44,9 @@ -(instancetype)initWithLowerOffset:(CGFloat)newOffset * @param newOffset The offset. * @return The initialized CPTConstraints object. **/ --(instancetype)initWithUpperOffset:(CGFloat)newOffset +-(nonnull instancetype)initWithUpperOffset:(CGFloat)newOffset { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = newOffset; isFixedToLower = NO; } @@ -57,13 +57,13 @@ -(instancetype)initWithUpperOffset:(CGFloat)newOffset #pragma mark - #pragma mark Comparison --(BOOL)isEqualToConstraint:(CPTConstraints *)otherConstraint +-(BOOL)isEqualToConstraint:(nullable CPTConstraints *)otherConstraint { if ( [self class] != [otherConstraint class] ) { return NO; } - return (self.offset == ( (_CPTConstraintsFixed *)otherConstraint ).offset) && - (self.isFixedToLower == ( (_CPTConstraintsFixed *)otherConstraint ).isFixedToLower); + return (self.offset == ((_CPTConstraintsFixed *)otherConstraint).offset) && + (self.isFixedToLower == ((_CPTConstraintsFixed *)otherConstraint).isFixedToLower); } #pragma mark - @@ -95,7 +95,7 @@ -(CGFloat)positionForLowerBound:(CGFloat)lowerBound upperBound:(CGFloat)upperBou /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { _CPTConstraintsFixed *copy = [[[self class] allocWithZone:zone] init]; @@ -112,12 +112,12 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTConstraints class]; } --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeCGFloat:self.offset forKey:@"_CPTConstraintsFixed.offset"]; [coder encodeBool:self.isFixedToLower forKey:@"_CPTConstraintsFixed.isFixedToLower"]; @@ -129,13 +129,25 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = [coder decodeCGFloatForKey:@"_CPTConstraintsFixed.offset"]; isFixedToLower = [coder decodeBoolForKey:@"_CPTConstraintsFixed.isFixedToLower"]; } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end diff --git a/framework/Source/_CPTConstraintsRelative.h b/framework/Source/_CPTConstraintsRelative.h index 9980999ca..bad6150cb 100644 --- a/framework/Source/_CPTConstraintsRelative.h +++ b/framework/Source/_CPTConstraintsRelative.h @@ -5,7 +5,7 @@ /// @name Initialization /// @{ -(nonnull instancetype)initWithRelativeOffset:(CGFloat)newOffset NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)decoder NS_DESIGNATED_INITIALIZER; /// @} /// @name Comparison diff --git a/framework/Source/_CPTConstraintsRelative.m b/framework/Source/_CPTConstraintsRelative.m index 93019c3bc..533e204ed 100644 --- a/framework/Source/_CPTConstraintsRelative.m +++ b/framework/Source/_CPTConstraintsRelative.m @@ -33,9 +33,9 @@ @implementation _CPTConstraintsRelative * @param newOffset The offset. * @return The initialized CPTConstraints object. **/ --(instancetype)initWithRelativeOffset:(CGFloat)newOffset +-(nonnull instancetype)initWithRelativeOffset:(CGFloat)newOffset { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = newOffset; } @@ -45,12 +45,12 @@ -(instancetype)initWithRelativeOffset:(CGFloat)newOffset #pragma mark - #pragma mark Comparison --(BOOL)isEqualToConstraint:(CPTConstraints *)otherConstraint +-(BOOL)isEqualToConstraint:(nullable CPTConstraints *)otherConstraint { if ( [self class] != [otherConstraint class] ) { return NO; } - return self.offset == ( (_CPTConstraintsRelative *)otherConstraint ).offset; + return self.offset == ((_CPTConstraintsRelative *)otherConstraint).offset; } #pragma mark - @@ -75,7 +75,7 @@ -(CGFloat)positionForLowerBound:(CGFloat)lowerBound upperBound:(CGFloat)upperBou /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { _CPTConstraintsRelative *copy = [[[self class] allocWithZone:zone] init]; @@ -91,12 +91,12 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTConstraints class]; } --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeCGFloat:self.offset forKey:@"_CPTConstraintsRelative.offset"]; } @@ -107,12 +107,24 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { + if ((self = [super init])) { offset = [coder decodeCGFloatForKey:@"_CPTConstraintsRelative.offset"]; } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end diff --git a/framework/Source/_CPTDarkGradientTheme.m b/framework/Source/_CPTDarkGradientTheme.m index 112185fcd..e15eaf091 100644 --- a/framework/Source/_CPTDarkGradientTheme.m +++ b/framework/Source/_CPTDarkGradientTheme.m @@ -12,16 +12,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTDarkGradientTheme = @"Dark Gradients"; - -/// @cond -@interface _CPTDarkGradientTheme() - --(void)applyThemeToAxis:(CPTXYAxis *)axis usingMajorLineStyle:(CPTLineStyle *)majorLineStyle minorLineStyle:(CPTLineStyle *)minorLineStyle textStyle:(CPTMutableTextStyle *)textStyle minorTickTextStyle:(CPTMutableTextStyle *)minorTickTextStyle; - -@end - -/// @endcond +CPTThemeName const kCPTDarkGradientTheme = @"Dark Gradients"; #pragma mark - @@ -35,31 +26,14 @@ +(void)load [self registerTheme:self]; } -+(NSString *)name ++(nonnull NSString *)name { return kCPTDarkGradientTheme; } #pragma mark - --(void)applyThemeToAxis:(CPTXYAxis *)axis usingMajorLineStyle:(CPTLineStyle *)majorLineStyle minorLineStyle:(CPTLineStyle *)minorLineStyle textStyle:(CPTMutableTextStyle *)textStyle minorTickTextStyle:(CPTMutableTextStyle *)minorTickTextStyle -{ - axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - axis.majorIntervalLength = @0.5; - axis.orthogonalPosition = @0.0; - axis.tickDirection = CPTSignNone; - axis.minorTicksPerInterval = 4; - axis.majorTickLineStyle = majorLineStyle; - axis.minorTickLineStyle = minorLineStyle; - axis.axisLineStyle = majorLineStyle; - axis.majorTickLength = CPTFloat(7.0); - axis.minorTickLength = CPTFloat(5.0); - axis.labelTextStyle = textStyle; - axis.minorTickLabelTextStyle = minorTickTextStyle; - axis.titleTextStyle = textStyle; -} - --(void)applyThemeToBackground:(CPTGraph *)graph +-(void)applyThemeToBackground:(nonnull CPTGraph *)graph { CPTColor *endColor = [CPTColor colorWithGenericGray:CPTFloat(0.1)]; CPTGradient *graphGradient = [CPTGradient gradientWithBeginningColor:endColor endingColor:endColor]; @@ -71,7 +45,7 @@ -(void)applyThemeToBackground:(CPTGraph *)graph graph.fill = [CPTFill fillWithGradient:graphGradient]; } --(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame +-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame { CPTGradient *gradient = [CPTGradient gradientWithBeginningColor:[CPTColor colorWithGenericGray:CPTFloat(0.1)] endingColor:[CPTColor colorWithGenericGray:CPTFloat(0.3)]]; @@ -86,7 +60,7 @@ -(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame plotAreaFrame.cornerRadius = CPTFloat(10.0); } --(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet +-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet { CPTMutableLineStyle *majorLineStyle = [CPTMutableLineStyle lineStyle]; @@ -108,14 +82,26 @@ -(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet whiteMinorTickTextStyle.fontSize = CPTFloat(12.0); for ( CPTXYAxis *axis in axisSet.axes ) { - [self applyThemeToAxis:axis usingMajorLineStyle:majorLineStyle minorLineStyle:minorLineStyle textStyle:whiteTextStyle minorTickTextStyle:whiteMinorTickTextStyle]; + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = whiteTextStyle; + axis.minorTickLabelTextStyle = whiteMinorTickTextStyle; + axis.titleTextStyle = whiteTextStyle; } } #pragma mark - #pragma mark NSCoding Methods --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTTheme class]; } diff --git a/framework/Source/_CPTFillColor.h b/framework/Source/_CPTFillColor.h index 00f7a66f5..b04943ae2 100644 --- a/framework/Source/_CPTFillColor.h +++ b/framework/Source/_CPTFillColor.h @@ -1,11 +1,11 @@ #import "CPTFill.h" -@interface _CPTFillColor : CPTFill +@interface _CPTFillColor : CPTFill /// @name Initialization /// @{ --(nonnull instancetype)initWithColor:(nullable CPTColor *)aColor NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithColor:(nonnull CPTColor *)aColor NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; /// @} /// @name Drawing diff --git a/framework/Source/_CPTFillColor.m b/framework/Source/_CPTFillColor.m index aa63358e5..628f5b6d1 100644 --- a/framework/Source/_CPTFillColor.m +++ b/framework/Source/_CPTFillColor.m @@ -5,7 +5,7 @@ /// @cond @interface _CPTFillColor() -@property (nonatomic, readwrite, copy, nullable) CPTColor *fillColor; +@property (nonatomic, readwrite, copy, nonnull) CPTColor *fillColor; @end @@ -18,7 +18,7 @@ @interface _CPTFillColor() @implementation _CPTFillColor -/** @property fillColor +/** @property nonnull CPTColor *fillColor * @brief The fill color. **/ @synthesize fillColor; @@ -30,9 +30,9 @@ @implementation _CPTFillColor * @param aColor The color. * @return The initialized _CPTFillColor object. **/ --(instancetype)initWithColor:(CPTColor *)aColor +-(nonnull instancetype)initWithColor:(nonnull CPTColor *)aColor { - if ( (self = [super init]) ) { + if ((self = [super init])) { fillColor = aColor; } return self; @@ -45,7 +45,7 @@ -(instancetype)initWithColor:(CPTColor *)aColor * @param rect The rectangle to draw into. * @param context The graphics context to draw into. **/ --(void)fillRect:(CGRect)rect inContext:(CGContextRef)context +-(void)fillRect:(CGRect)rect inContext:(nonnull CGContextRef)context { CGContextSaveGState(context); CGContextSetFillColorWithColor(context, self.fillColor.cgColor); @@ -56,7 +56,7 @@ -(void)fillRect:(CGRect)rect inContext:(CGContextRef)context /** @brief Draws the color into the given graphics context clipped to the current drawing path. * @param context The graphics context to draw into. **/ --(void)fillPathInContext:(CGContextRef)context +-(void)fillPathInContext:(nonnull CGContextRef)context { CGContextSaveGState(context); CGContextSetFillColorWithColor(context, self.fillColor.cgColor); @@ -85,7 +85,7 @@ -(CGColorRef)cgColor /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { _CPTFillColor *copy = [[[self class] allocWithZone:zone] init]; @@ -101,12 +101,12 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTFill class]; } --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeObject:self.fillColor forKey:@"_CPTFillColor.fillColor"]; } @@ -117,12 +117,32 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - fillColor = [coder decodeObjectForKey:@"_CPTFillColor.fillColor"]; + if ((self = [super init])) { + CPTColor *color = [coder decodeObjectOfClass:[CPTColor class] + forKey:@"_CPTFillColor.fillColor"]; + + if ( color ) { + fillColor = color; + } + else { + self = nil; + } } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end diff --git a/framework/Source/_CPTFillGradient.h b/framework/Source/_CPTFillGradient.h index a7bb7e610..5344bf7fb 100644 --- a/framework/Source/_CPTFillGradient.h +++ b/framework/Source/_CPTFillGradient.h @@ -2,12 +2,12 @@ @class CPTGradient; -@interface _CPTFillGradient : CPTFill +@interface _CPTFillGradient : CPTFill /// @name Initialization /// @{ --(nonnull instancetype)initWithGradient:(nullable CPTGradient *)aGradient NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithGradient:(nonnull CPTGradient *)aGradient NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; /// @} /// @name Drawing diff --git a/framework/Source/_CPTFillGradient.m b/framework/Source/_CPTFillGradient.m index 98b44040b..c7d0aa70c 100644 --- a/framework/Source/_CPTFillGradient.m +++ b/framework/Source/_CPTFillGradient.m @@ -5,7 +5,7 @@ /// @cond @interface _CPTFillGradient() -@property (nonatomic, readwrite, copy, nullable) CPTGradient *fillGradient; +@property (nonatomic, readwrite, copy, nonnull) CPTGradient *fillGradient; @end @@ -18,7 +18,7 @@ @interface _CPTFillGradient() @implementation _CPTFillGradient -/** @property fillGradient +/** @property nonnull CPTGradient *fillGradient * @brief The fill gradient. **/ @synthesize fillGradient; @@ -30,9 +30,9 @@ @implementation _CPTFillGradient * @param aGradient The gradient. * @return The initialized _CPTFillGradient object. **/ --(instancetype)initWithGradient:(CPTGradient *)aGradient +-(nonnull instancetype)initWithGradient:(nonnull CPTGradient *)aGradient { - if ( (self = [super init]) ) { + if ((self = [super init])) { fillGradient = aGradient; } return self; @@ -45,7 +45,7 @@ -(instancetype)initWithGradient:(CPTGradient *)aGradient * @param rect The rectangle to draw into. * @param context The graphics context to draw into. **/ --(void)fillRect:(CGRect)rect inContext:(CGContextRef)context +-(void)fillRect:(CGRect)rect inContext:(nonnull CGContextRef)context { [self.fillGradient fillRect:rect inContext:context]; } @@ -53,7 +53,7 @@ -(void)fillRect:(CGRect)rect inContext:(CGContextRef)context /** @brief Draws the gradient into the given graphics context clipped to the current drawing path. * @param context The graphics context to draw into. **/ --(void)fillPathInContext:(CGContextRef)context +-(void)fillPathInContext:(nonnull CGContextRef)context { [self.fillGradient fillPathInContext:context]; } @@ -71,7 +71,7 @@ -(BOOL)isOpaque /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { _CPTFillGradient *copy = [[[self class] allocWithZone:zone] init]; @@ -87,12 +87,12 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTFill class]; } --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeObject:self.fillGradient forKey:@"_CPTFillGradient.fillGradient"]; } @@ -103,12 +103,32 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - fillGradient = [coder decodeObjectForKey:@"_CPTFillGradient.fillGradient"]; + if ((self = [super init])) { + CPTGradient *gradient = [coder decodeObjectOfClass:[CPTGradient class] + forKey:@"_CPTFillGradient.fillGradient"]; + + if ( gradient ) { + fillGradient = gradient; + } + else { + self = nil; + } } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end diff --git a/framework/Source/_CPTFillImage.h b/framework/Source/_CPTFillImage.h index 9efe99470..49bbb205f 100644 --- a/framework/Source/_CPTFillImage.h +++ b/framework/Source/_CPTFillImage.h @@ -2,12 +2,12 @@ @class CPTImage; -@interface _CPTFillImage : CPTFill +@interface _CPTFillImage : CPTFill /// @name Initialization /// @{ --(nonnull instancetype)initWithImage:(nullable CPTImage *)anImage NS_DESIGNATED_INITIALIZER; --(nonnull instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; +-(nonnull instancetype)initWithImage:(nonnull CPTImage *)anImage NS_DESIGNATED_INITIALIZER; +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder NS_DESIGNATED_INITIALIZER; /// @} /// @name Drawing diff --git a/framework/Source/_CPTFillImage.m b/framework/Source/_CPTFillImage.m index 16a6ade4e..48614de11 100644 --- a/framework/Source/_CPTFillImage.m +++ b/framework/Source/_CPTFillImage.m @@ -5,7 +5,7 @@ /// @cond @interface _CPTFillImage() -@property (nonatomic, readwrite, copy, nullable) CPTImage *fillImage; +@property (nonatomic, readwrite, copy, nonnull) CPTImage *fillImage; @end @@ -18,7 +18,7 @@ @interface _CPTFillImage() @implementation _CPTFillImage -/** @property fillImage +/** @property nonnull CPTImage *fillImage * @brief The fill image. **/ @synthesize fillImage; @@ -30,9 +30,9 @@ @implementation _CPTFillImage * @param anImage The image. * @return The initialized _CPTFillImage object. **/ --(instancetype)initWithImage:(CPTImage *)anImage +-(nonnull instancetype)initWithImage:(nonnull CPTImage *)anImage { - if ( (self = [super init]) ) { + if ((self = [super init])) { fillImage = anImage; } return self; @@ -45,7 +45,7 @@ -(instancetype)initWithImage:(CPTImage *)anImage * @param rect The rectangle to draw into. * @param context The graphics context to draw into. **/ --(void)fillRect:(CGRect)rect inContext:(CGContextRef)context +-(void)fillRect:(CGRect)rect inContext:(nonnull CGContextRef)context { [self.fillImage drawInRect:rect inContext:context]; } @@ -53,7 +53,7 @@ -(void)fillRect:(CGRect)rect inContext:(CGContextRef)context /** @brief Draws the image into the given graphics context clipped to the current drawing path. * @param context The graphics context to draw into. **/ --(void)fillPathInContext:(CGContextRef)context +-(void)fillPathInContext:(nonnull CGContextRef)context { CGContextSaveGState(context); @@ -77,7 +77,7 @@ -(BOOL)isOpaque /// @cond --(id)copyWithZone:(NSZone *)zone +-(nonnull id)copyWithZone:(nullable NSZone *)zone { _CPTFillImage *copy = [[[self class] allocWithZone:zone] init]; @@ -93,12 +93,12 @@ -(id)copyWithZone:(NSZone *)zone /// @cond --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTFill class]; } --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [coder encodeObject:self.fillImage forKey:@"_CPTFillImage.fillImage"]; } @@ -109,12 +109,32 @@ -(void)encodeWithCoder:(NSCoder *)coder * @param coder An unarchiver object. * @return An object initialized from data in a given unarchiver. */ --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super init]) ) { - fillImage = [coder decodeObjectForKey:@"_CPTFillImage.fillImage"]; + if ((self = [super init])) { + CPTImage *image = [coder decodeObjectOfClass:[CPTImage class] + forKey:@"_CPTFillImage.fillImage"]; + + if ( image ) { + fillImage = image; + } + else { + self = nil; + } } return self; } +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + @end diff --git a/framework/Source/_CPTMaskLayer.m b/framework/Source/_CPTMaskLayer.m index ffdf9bf8e..14e3dc603 100644 --- a/framework/Source/_CPTMaskLayer.m +++ b/framework/Source/_CPTMaskLayer.m @@ -10,15 +10,15 @@ @implementation CPTMaskLayer /** @brief Initializes a newly allocated CPTMaskLayer object with the provided frame rectangle. * - * This is the designated initializer. The initialized layer will have the following properties: - * - @ref needsDisplayOnBoundsChange = @YES + * This is the designated initializer. The initialized layer will have the following properties: + * - @ref needsDisplayOnBoundsChange = @YES * - * @param newFrame The frame rectangle. + * @param newFrame The frame rectangle. * @return The initialized CPTMaskLayer object. **/ --(instancetype)initWithFrame:(CGRect)newFrame +-(nonnull instancetype)initWithFrame:(CGRect)newFrame { - if ( (self = [super initWithFrame:newFrame]) ) { + if ((self = [super initWithFrame:newFrame])) { self.needsDisplayOnBoundsChange = YES; } return self; @@ -29,14 +29,14 @@ -(instancetype)initWithFrame:(CGRect)newFrame /// @cond --(void)renderAsVectorInContext:(CGContextRef)context +-(void)renderAsVectorInContext:(nonnull CGContextRef)context { [super renderAsVectorInContext:context]; CPTLayer *theMaskedLayer = (CPTLayer *)self.superlayer; if ( theMaskedLayer ) { - CGContextSetRGBFillColor( context, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0) ); + CGContextSetRGBFillColor(context, CPTFloat(0.0), CPTFloat(0.0), CPTFloat(0.0), CPTFloat(1.0)); if ( [theMaskedLayer isKindOfClass:[CPTLayer class]] ) { CGPathRef maskingPath = theMaskedLayer.sublayerMaskingPath; diff --git a/framework/Source/_CPTPlainBlackTheme.m b/framework/Source/_CPTPlainBlackTheme.m index 6bc25f94a..05783b4f1 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. @@ -23,19 +23,19 @@ +(void)load [self registerTheme:self]; } -+(NSString *)name ++(nonnull NSString *)name { return kCPTPlainBlackTheme; } #pragma mark - --(void)applyThemeToBackground:(CPTGraph *)graph +-(void)applyThemeToBackground:(nonnull CPTGraph *)graph { graph.fill = [CPTFill fillWithColor:[CPTColor blackColor]]; } --(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame +-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame { plotAreaFrame.fill = [CPTFill fillWithColor:[CPTColor blackColor]]; @@ -47,9 +47,8 @@ -(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame plotAreaFrame.cornerRadius = CPTFloat(0.0); } --(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet +-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet { - CPTXYAxisSet *xyAxisSet = (CPTXYAxisSet *)axisSet; CPTMutableLineStyle *majorLineStyle = [CPTMutableLineStyle lineStyle]; majorLineStyle.lineCap = kCGLineCapRound; @@ -60,48 +59,35 @@ -(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet minorLineStyle.lineColor = [CPTColor whiteColor]; minorLineStyle.lineWidth = CPTFloat(3.0); - CPTXYAxis *x = xyAxisSet.xAxis; CPTMutableTextStyle *whiteTextStyle = [[CPTMutableTextStyle alloc] init]; whiteTextStyle.color = [CPTColor whiteColor]; whiteTextStyle.fontSize = CPTFloat(14.0); + CPTMutableTextStyle *minorTickWhiteTextStyle = [[CPTMutableTextStyle alloc] init]; minorTickWhiteTextStyle.color = [CPTColor whiteColor]; minorTickWhiteTextStyle.fontSize = CPTFloat(12.0); - x.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - x.majorIntervalLength = @0.5; - x.orthogonalPosition = @0.0; - x.tickDirection = CPTSignNone; - x.minorTicksPerInterval = 4; - x.majorTickLineStyle = majorLineStyle; - x.minorTickLineStyle = minorLineStyle; - x.axisLineStyle = majorLineStyle; - x.majorTickLength = CPTFloat(7.0); - x.minorTickLength = CPTFloat(5.0); - x.labelTextStyle = whiteTextStyle; - x.minorTickLabelTextStyle = whiteTextStyle; - x.titleTextStyle = whiteTextStyle; - - CPTXYAxis *y = xyAxisSet.yAxis; - y.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - y.majorIntervalLength = @0.5; - y.minorTicksPerInterval = 4; - y.orthogonalPosition = @0.0; - y.tickDirection = CPTSignNone; - y.majorTickLineStyle = majorLineStyle; - y.minorTickLineStyle = minorLineStyle; - y.axisLineStyle = majorLineStyle; - y.majorTickLength = CPTFloat(7.0); - y.minorTickLength = CPTFloat(5.0); - y.labelTextStyle = whiteTextStyle; - y.minorTickLabelTextStyle = minorTickWhiteTextStyle; - y.titleTextStyle = whiteTextStyle; + for ( CPTXYAxis *axis in axisSet.axes ) { + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = whiteTextStyle; + axis.minorTickLabelTextStyle = whiteTextStyle; + axis.titleTextStyle = whiteTextStyle; + } } #pragma mark - #pragma mark NSCoding Methods --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTTheme class]; } diff --git a/framework/Source/_CPTPlainWhiteTheme.m b/framework/Source/_CPTPlainWhiteTheme.m index fbdbf673b..5a8ed24f2 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. @@ -23,19 +23,19 @@ +(void)load [self registerTheme:self]; } -+(NSString *)name ++(nonnull NSString *)name { return kCPTPlainWhiteTheme; } #pragma mark - --(void)applyThemeToBackground:(CPTGraph *)graph +-(void)applyThemeToBackground:(nonnull CPTGraph *)graph { graph.fill = [CPTFill fillWithColor:[CPTColor whiteColor]]; } --(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame +-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame { plotAreaFrame.fill = [CPTFill fillWithColor:[CPTColor whiteColor]]; @@ -47,9 +47,8 @@ -(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame plotAreaFrame.cornerRadius = CPTFloat(0.0); } --(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet +-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet { - CPTXYAxisSet *xyAxisSet = (CPTXYAxisSet *)axisSet; CPTMutableLineStyle *majorLineStyle = [CPTMutableLineStyle lineStyle]; majorLineStyle.lineCap = kCGLineCapButt; @@ -69,41 +68,27 @@ -(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet minorTickBlackTextStyle.color = [CPTColor blackColor]; minorTickBlackTextStyle.fontSize = CPTFloat(12.0); - CPTXYAxis *x = xyAxisSet.xAxis; - x.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - x.majorIntervalLength = @0.5; - x.orthogonalPosition = @0.0; - x.tickDirection = CPTSignNone; - x.minorTicksPerInterval = 4; - x.majorTickLineStyle = majorLineStyle; - x.minorTickLineStyle = minorLineStyle; - x.axisLineStyle = majorLineStyle; - x.majorTickLength = CPTFloat(7.0); - x.minorTickLength = CPTFloat(5.0); - x.labelTextStyle = blackTextStyle; - x.minorTickLabelTextStyle = blackTextStyle; - x.titleTextStyle = blackTextStyle; - - CPTXYAxis *y = xyAxisSet.yAxis; - y.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - y.majorIntervalLength = @0.5; - y.minorTicksPerInterval = 4; - y.orthogonalPosition = @0.0; - y.tickDirection = CPTSignNone; - y.majorTickLineStyle = majorLineStyle; - y.minorTickLineStyle = minorLineStyle; - y.axisLineStyle = majorLineStyle; - y.majorTickLength = CPTFloat(7.0); - y.minorTickLength = CPTFloat(5.0); - y.labelTextStyle = blackTextStyle; - y.minorTickLabelTextStyle = minorTickBlackTextStyle; - y.titleTextStyle = blackTextStyle; + for ( CPTXYAxis *axis in axisSet.axes ) { + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = blackTextStyle; + axis.minorTickLabelTextStyle = blackTextStyle; + axis.titleTextStyle = blackTextStyle; + } } #pragma mark - #pragma mark NSCoding Methods --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTTheme class]; } diff --git a/framework/Source/_CPTSlateTheme.m b/framework/Source/_CPTSlateTheme.m index 67e7afc6d..c357e48a9 100644 --- a/framework/Source/_CPTSlateTheme.m +++ b/framework/Source/_CPTSlateTheme.m @@ -12,16 +12,7 @@ #import "CPTXYAxisSet.h" #import "CPTXYGraph.h" -NSString *const kCPTSlateTheme = @"Slate"; - -/// @cond -@interface _CPTSlateTheme() - --(void)applyThemeToAxis:(CPTXYAxis *)axis usingMajorLineStyle:(CPTLineStyle *)majorLineStyle minorLineStyle:(CPTLineStyle *)minorLineStyle textStyle:(CPTMutableTextStyle *)textStyle minorTickTextStyle:(CPTMutableTextStyle *)minorTickTextStyle; - -@end - -/// @endcond +CPTThemeName const kCPTSlateTheme = @"Slate"; #pragma mark - @@ -35,31 +26,14 @@ +(void)load [self registerTheme:self]; } -+(NSString *)name ++(nonnull NSString *)name { return kCPTSlateTheme; } #pragma mark - --(void)applyThemeToAxis:(CPTXYAxis *)axis usingMajorLineStyle:(CPTLineStyle *)majorLineStyle minorLineStyle:(CPTLineStyle *)minorLineStyle textStyle:(CPTMutableTextStyle *)textStyle minorTickTextStyle:(CPTMutableTextStyle *)minorTickTextStyle -{ - axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - axis.majorIntervalLength = @0.5; - axis.orthogonalPosition = @0.0; - axis.tickDirection = CPTSignNone; - axis.minorTicksPerInterval = 4; - axis.majorTickLineStyle = majorLineStyle; - axis.minorTickLineStyle = minorLineStyle; - axis.axisLineStyle = majorLineStyle; - axis.majorTickLength = CPTFloat(7.0); - axis.minorTickLength = CPTFloat(5.0); - axis.labelTextStyle = textStyle; - axis.minorTickLabelTextStyle = minorTickTextStyle; - axis.titleTextStyle = textStyle; -} - --(void)applyThemeToBackground:(CPTGraph *)graph +-(void)applyThemeToBackground:(nonnull CPTGraph *)graph { CPTGradient *gradient = [CPTGradient gradientWithBeginningColor:[CPTColor colorWithComponentRed:CPTFloat(0.43) green:CPTFloat(0.51) blue:CPTFloat(0.63) alpha:CPTFloat(1.0)] endingColor:[CPTColor colorWithComponentRed:CPTFloat(0.70) green:CPTFloat(0.73) blue:CPTFloat(0.80) alpha:CPTFloat(1.0)]]; @@ -69,7 +43,7 @@ -(void)applyThemeToBackground:(CPTGraph *)graph graph.fill = [CPTFill fillWithGradient:gradient]; } --(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame +-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame { CPTGradient *gradient = [CPTGradient gradientWithBeginningColor:[CPTColor colorWithComponentRed:CPTFloat(0.43) green:CPTFloat(0.51) blue:CPTFloat(0.63) alpha:CPTFloat(1.0)] endingColor:[CPTColor colorWithComponentRed:CPTFloat(0.70) green:CPTFloat(0.73) blue:CPTFloat(0.80) alpha:CPTFloat(1.0)]]; @@ -85,7 +59,7 @@ -(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame plotAreaFrame.cornerRadius = CPTFloat(5.0); } --(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet +-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet { CPTMutableLineStyle *majorLineStyle = [CPTMutableLineStyle lineStyle]; @@ -107,14 +81,26 @@ -(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet minorTickBlackTextStyle.fontSize = CPTFloat(12.0); for ( CPTXYAxis *axis in axisSet.axes ) { - [self applyThemeToAxis:axis usingMajorLineStyle:majorLineStyle minorLineStyle:minorLineStyle textStyle:blackTextStyle minorTickTextStyle:minorTickBlackTextStyle]; + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = blackTextStyle; + axis.minorTickLabelTextStyle = minorTickBlackTextStyle; + axis.titleTextStyle = blackTextStyle; } } #pragma mark - #pragma mark NSCoding Methods --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTTheme class]; } diff --git a/framework/Source/_CPTStocksTheme.m b/framework/Source/_CPTStocksTheme.m index d24ced3a3..4e3dcf0bc 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. @@ -24,19 +24,19 @@ +(void)load [self registerTheme:self]; } -+(NSString *)name ++(nonnull NSString *)name { return kCPTStocksTheme; } #pragma mark - --(void)applyThemeToBackground:(CPTGraph *)graph +-(void)applyThemeToBackground:(nonnull CPTGraph *)graph { graph.fill = [CPTFill fillWithColor:[CPTColor blackColor]]; } --(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame +-(void)applyThemeToPlotArea:(nonnull CPTPlotAreaFrame *)plotAreaFrame { CPTGradient *stocksBackgroundGradient = [[CPTGradient alloc] init]; @@ -60,9 +60,8 @@ -(void)applyThemeToPlotArea:(CPTPlotAreaFrame *)plotAreaFrame plotAreaFrame.cornerRadius = CPTFloat(14.0); } --(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet +-(void)applyThemeToAxisSet:(nonnull CPTAxisSet *)axisSet { - CPTXYAxisSet *xyAxisSet = (CPTXYAxisSet *)axisSet; CPTMutableLineStyle *majorLineStyle = [CPTMutableLineStyle lineStyle]; majorLineStyle.lineCap = kCGLineCapRound; @@ -81,41 +80,27 @@ -(void)applyThemeToAxisSet:(CPTAxisSet *)axisSet minorTickWhiteTextStyle.color = [CPTColor whiteColor]; minorTickWhiteTextStyle.fontSize = CPTFloat(12.0); - CPTXYAxis *x = xyAxisSet.xAxis; - x.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - x.majorIntervalLength = @0.5; - x.orthogonalPosition = @0.0; - x.tickDirection = CPTSignNone; - x.minorTicksPerInterval = 4; - x.majorTickLineStyle = majorLineStyle; - x.minorTickLineStyle = minorLineStyle; - x.axisLineStyle = majorLineStyle; - x.majorTickLength = CPTFloat(7.0); - x.minorTickLength = CPTFloat(5.0); - x.labelTextStyle = whiteTextStyle; - x.minorTickLabelTextStyle = minorTickWhiteTextStyle; - x.titleTextStyle = whiteTextStyle; - - CPTXYAxis *y = xyAxisSet.yAxis; - y.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; - y.majorIntervalLength = @0.5; - y.minorTicksPerInterval = 4; - y.orthogonalPosition = @0.0; - y.tickDirection = CPTSignNone; - y.majorTickLineStyle = majorLineStyle; - y.minorTickLineStyle = minorLineStyle; - y.axisLineStyle = majorLineStyle; - y.majorTickLength = CPTFloat(7.0); - y.minorTickLength = CPTFloat(5.0); - y.labelTextStyle = whiteTextStyle; - y.minorTickLabelTextStyle = minorTickWhiteTextStyle; - y.titleTextStyle = whiteTextStyle; + for ( CPTXYAxis *axis in axisSet.axes ) { + axis.labelingPolicy = CPTAxisLabelingPolicyFixedInterval; + axis.majorIntervalLength = @0.5; + axis.orthogonalPosition = @0.0; + axis.tickDirection = CPTSignNone; + axis.minorTicksPerInterval = 4; + axis.majorTickLineStyle = majorLineStyle; + axis.minorTickLineStyle = minorLineStyle; + axis.axisLineStyle = majorLineStyle; + axis.majorTickLength = CPTFloat(7.0); + axis.minorTickLength = CPTFloat(5.0); + axis.labelTextStyle = whiteTextStyle; + axis.minorTickLabelTextStyle = minorTickWhiteTextStyle; + axis.titleTextStyle = whiteTextStyle; + } } #pragma mark - #pragma mark NSCoding Methods --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTTheme class]; } diff --git a/framework/Source/_CPTXYTheme.m b/framework/Source/_CPTXYTheme.m index eef244cdb..129d137aa 100644 --- a/framework/Source/_CPTXYTheme.m +++ b/framework/Source/_CPTXYTheme.m @@ -13,9 +13,9 @@ @implementation _CPTXYTheme /// @name Initialization /// @{ --(instancetype)init +-(nonnull instancetype)init { - if ( (self = [super init]) ) { + if ((self = [super init])) { self.graphClass = [CPTXYGraph class]; } return self; @@ -23,7 +23,7 @@ -(instancetype)init /// @} --(id)newGraph +-(nullable id)newGraph { CPTXYGraph *graph; @@ -50,7 +50,7 @@ -(id)newGraph #pragma mark - #pragma mark NSCoding Methods --(Class)classForCoder +-(nonnull Class)classForCoder { return [CPTTheme class]; } diff --git a/framework/Source/mainpage.h b/framework/Source/mainpage.h index b4e1287ad..06ec0e648 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 macOS, 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 @@ -38,7 +38,6 @@ * @subsection socialnetworks Social Networks * * - Twitter - * - App.net; Subscribe to the Announcements broadcast. * * @section contributingtocoreplot Contributing to Core Plot * @@ -56,8 +55,8 @@ * Nonetheless, in a project like Core Plot, with many developers contributing, it is worthwhile * defining a set of basic coding standards to prevent a mishmash of different styles which can * become frustrating when navigating the code base. See the file - * Coding Style.markdown - * found in the documentation + * CONTRIBUTING.md + * found in the .github * directory of the project source for specific guidelines. * * Core Plot includes a script diff --git a/framework/TestResources/CorePlotProbes.d b/framework/TestResources/CorePlotProbes.d deleted file mode 100644 index 05e68c33e..000000000 --- a/framework/TestResources/CorePlotProbes.d +++ /dev/null @@ -1,3 +0,0 @@ -provider CorePlot { - probe layer_position_change(char *, int, int, int, int); -}; \ No newline at end of file diff --git a/framework/English.lproj/InfoPlist.strings b/framework/en.lproj/InfoPlist.strings similarity index 100% rename from framework/English.lproj/InfoPlist.strings rename to framework/en.lproj/InfoPlist.strings diff --git a/framework/iPhoneOnly/CPTGraphHostingView.h b/framework/iPhoneOnly/CPTGraphHostingView.h index b98c5784e..17f7ec128 100644 --- a/framework/iPhoneOnly/CPTGraphHostingView.h +++ b/framework/iPhoneOnly/CPTGraphHostingView.h @@ -2,7 +2,7 @@ @class CPTGraph; -@interface CPTGraphHostingView : UIView +@interface CPTGraphHostingView : UIView @property (nonatomic, readwrite, strong, nullable) CPTGraph *hostedGraph; @property (nonatomic, readwrite, assign) BOOL collapsesLayers; diff --git a/framework/iPhoneOnly/CPTGraphHostingView.m b/framework/iPhoneOnly/CPTGraphHostingView.m index 42d18d311..0c9866702 100644 --- a/framework/iPhoneOnly/CPTGraphHostingView.m +++ b/framework/iPhoneOnly/CPTGraphHostingView.m @@ -9,10 +9,13 @@ /// @cond @interface CPTGraphHostingView() -@property (nonatomic, readwrite, cpt_weak_property) cpt_weak UIPinchGestureRecognizer *pinchGestureRecognizer; +#if (TARGET_OS_SIMULATOR || TARGET_OS_IPHONE) && !TARGET_OS_TV +@property (nonatomic, readwrite, nullable, cpt_weak_property) UIPinchGestureRecognizer *pinchGestureRecognizer; --(void)graphNeedsRedraw:(NSNotification *)notification; --(void)handlePinchGesture:(UIPinchGestureRecognizer *)aPinchGestureRecognizer; +-(void)handlePinchGesture:(nonnull UIPinchGestureRecognizer *)aPinchGestureRecognizer; +#endif + +-(void)graphNeedsRedraw:(nonnull NSNotification *)notification; @end @@ -25,7 +28,7 @@ -(void)handlePinchGesture:(UIPinchGestureRecognizer *)aPinchGestureRecognizer; **/ @implementation CPTGraphHostingView -/** @property CPTGraph *hostedGraph +/** @property nullable CPTGraph *hostedGraph * @brief The CPTLayer hosted inside this view. **/ @synthesize hostedGraph; @@ -44,11 +47,15 @@ @implementation CPTGraphHostingView /// @cond +#if (TARGET_OS_SIMULATOR || TARGET_OS_IPHONE) && !TARGET_OS_TV + /** @internal - * @property cpt_weak id pinchGestureRecognizer + * @property nullable UIPinchGestureRecognizer *pinchGestureRecognizer * @brief The pinch gesture recognizer for this view. + * @since Not available on tvOS. **/ @synthesize pinchGestureRecognizer; +#endif /// @endcond @@ -57,7 +64,7 @@ @implementation CPTGraphHostingView /// @cond -+(Class)layerClass ++(nonnull Class)layerClass { return [CALayer class]; } @@ -72,17 +79,24 @@ -(void)commonInit self.allowPinchScaling = YES; // This undoes the normal coordinate space inversion that UIViews apply to their layers - self.layer.sublayerTransform = CATransform3DMakeScale( CPTFloat(1.0), CPTFloat(-1.0), CPTFloat(1.0) ); + self.layer.sublayerTransform = CATransform3DMakeScale(CPTFloat(1.0), CPTFloat(-1.0), CPTFloat(1.0)); } --(instancetype)initWithFrame:(CGRect)frame +-(nonnull instancetype)initWithFrame:(CGRect)frame { - if ( (self = [super initWithFrame:frame]) ) { + if ((self = [super initWithFrame:frame])) { [self commonInit]; } return self; } +-(void)awakeFromNib +{ + [super awakeFromNib]; + + [self commonInit]; +} + -(void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; @@ -95,7 +109,7 @@ -(void)dealloc /// @cond --(void)encodeWithCoder:(NSCoder *)coder +-(void)encodeWithCoder:(nonnull NSCoder *)coder { [super encodeWithCoder:coder]; @@ -107,13 +121,14 @@ -(void)encodeWithCoder:(NSCoder *)coder // pinchGestureRecognizer } --(instancetype)initWithCoder:(NSCoder *)coder +-(nullable instancetype)initWithCoder:(nonnull NSCoder *)coder { - if ( (self = [super initWithCoder:coder]) ) { + if ((self = [super initWithCoder:coder])) { [self commonInit]; collapsesLayers = [coder decodeBoolForKey:@"CPTGraphHostingView.collapsesLayers"]; - self.hostedGraph = [coder decodeObjectForKey:@"CPTGraphHostingView.hostedGraph"]; // setup layers + self.hostedGraph = [coder decodeObjectOfClass:[CPTGraph class] + forKey:@"CPTGraphHostingView.hostedGraph"]; // setup layers if ( [coder containsValueForKey:@"CPTGraphHostingView.allowPinchScaling"] ) { self.allowPinchScaling = [coder decodeBoolForKey:@"CPTGraphHostingView.allowPinchScaling"]; // set gesture recognizer if needed @@ -124,23 +139,36 @@ -(instancetype)initWithCoder:(NSCoder *)coder /// @endcond +#pragma mark - +#pragma mark NSSecureCoding Methods + +/// @cond + ++(BOOL)supportsSecureCoding +{ + return YES; +} + +/// @endcond + #pragma mark - #pragma mark Touch handling /// @cond --(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +-(void)touchesBegan:(nonnull NSSet *)touches withEvent:(nullable UIEvent *)event { BOOL handled = NO; // Ignore pinch or other multitouch gestures - if ( [[event allTouches] count] == 1 ) { + if ( [event allTouches].count == 1 ) { CPTGraph *theHostedGraph = self.hostedGraph; + UIEvent *theEvent = event; theHostedGraph.frame = self.bounds; [theHostedGraph layoutIfNeeded]; - CGPoint pointOfTouch = [[[event touchesForView:self] anyObject] locationInView:self]; + CGPoint pointOfTouch = [[[theEvent touchesForView:self] anyObject] locationInView:self]; if ( self.collapsesLayers ) { pointOfTouch.y = self.frame.size.height - pointOfTouch.y; @@ -148,7 +176,7 @@ -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event else { pointOfTouch = [self.layer convertPoint:pointOfTouch toLayer:theHostedGraph]; } - handled = [theHostedGraph pointingDeviceDownEvent:event atPoint:pointOfTouch]; + handled = [theHostedGraph pointingDeviceDownEvent:theEvent atPoint:pointOfTouch]; } if ( !handled ) { @@ -156,53 +184,67 @@ -(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event } } --(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event +-(void)touchesMoved:(nonnull NSSet *)touches withEvent:(nullable UIEvent *)event { - CPTGraph *theHostedGraph = self.hostedGraph; + BOOL handled = NO; - theHostedGraph.frame = self.bounds; - [theHostedGraph layoutIfNeeded]; + if ( event ) { + CPTGraph *theHostedGraph = self.hostedGraph; + UIEvent *theEvent = event; - CGPoint pointOfTouch = [[[event touchesForView:self] anyObject] locationInView:self]; + theHostedGraph.frame = self.bounds; + [theHostedGraph layoutIfNeeded]; - if ( self.collapsesLayers ) { - pointOfTouch.y = self.frame.size.height - pointOfTouch.y; - } - else { - pointOfTouch = [self.layer convertPoint:pointOfTouch toLayer:theHostedGraph]; - } - BOOL handled = [theHostedGraph pointingDeviceDraggedEvent:event atPoint:pointOfTouch]; + CGPoint pointOfTouch = [[[theEvent touchesForView:self] anyObject] locationInView:self]; + if ( self.collapsesLayers ) { + pointOfTouch.y = self.frame.size.height - pointOfTouch.y; + } + else { + pointOfTouch = [self.layer convertPoint:pointOfTouch toLayer:theHostedGraph]; + } + handled = [theHostedGraph pointingDeviceDraggedEvent:theEvent atPoint:pointOfTouch]; + } if ( !handled ) { [super touchesMoved:touches withEvent:event]; } } --(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +-(void)touchesEnded:(nonnull NSSet *)touches withEvent:(nullable UIEvent *)event { - CPTGraph *theHostedGraph = self.hostedGraph; + BOOL handled = NO; - theHostedGraph.frame = self.bounds; - [theHostedGraph layoutIfNeeded]; + if ( event ) { + CPTGraph *theHostedGraph = self.hostedGraph; + UIEvent *theEvent = event; - CGPoint pointOfTouch = [[[event touchesForView:self] anyObject] locationInView:self]; + theHostedGraph.frame = self.bounds; + [theHostedGraph layoutIfNeeded]; - if ( self.collapsesLayers ) { - pointOfTouch.y = self.frame.size.height - pointOfTouch.y; - } - else { - pointOfTouch = [self.layer convertPoint:pointOfTouch toLayer:theHostedGraph]; + CGPoint pointOfTouch = [[[theEvent touchesForView:self] anyObject] locationInView:self]; + + if ( self.collapsesLayers ) { + pointOfTouch.y = self.frame.size.height - pointOfTouch.y; + } + else { + pointOfTouch = [self.layer convertPoint:pointOfTouch toLayer:theHostedGraph]; + } + handled = [theHostedGraph pointingDeviceUpEvent:theEvent atPoint:pointOfTouch]; } - BOOL handled = [theHostedGraph pointingDeviceUpEvent:event atPoint:pointOfTouch]; if ( !handled ) { [super touchesEnded:touches withEvent:event]; } } --(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +-(void)touchesCancelled:(nonnull NSSet *)touches withEvent:(nullable UIEvent *)event { - BOOL handled = [self.hostedGraph pointingDeviceCancelledEvent:event]; + BOOL handled = NO; + + if ( event ) { + UIEvent *theEvent = event; + handled = [self.hostedGraph pointingDeviceCancelledEvent:theEvent]; + } if ( !handled ) { [super touchesCancelled:touches withEvent:event]; @@ -216,6 +258,7 @@ -(void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event /// @cond +#if (TARGET_OS_SIMULATOR || TARGET_OS_IPHONE) && !TARGET_OS_TV -(void)setAllowPinchScaling:(BOOL)allowScaling { if ( allowPinchScaling != allowScaling ) { @@ -236,7 +279,7 @@ -(void)setAllowPinchScaling:(BOOL)allowScaling } } --(void)handlePinchGesture:(UIPinchGestureRecognizer *)aPinchGestureRecognizer +-(void)handlePinchGesture:(nonnull UIPinchGestureRecognizer *)aPinchGestureRecognizer { CGPoint interactionPoint = [aPinchGestureRecognizer locationInView:self]; CPTGraph *theHostedGraph = self.hostedGraph; @@ -266,6 +309,24 @@ -(void)handlePinchGesture:(UIPinchGestureRecognizer *)aPinchGestureRecognizer pinchRecognizer.scale = 1.0; } +#endif + +/// @endcond + +#pragma mark - +#pragma mark TV Focus + +/// @cond + +#if TARGET_OS_TV + +-(BOOL)canBecomeFocused +{ + return YES; +} + +#endif + /// @endcond #pragma mark - @@ -273,7 +334,7 @@ -(void)handlePinchGesture:(UIPinchGestureRecognizer *)aPinchGestureRecognizer /// @cond --(void)drawRect:(CGRect)rect +-(void)drawRect:(CGRect __unused)rect { if ( self.collapsesLayers ) { CGContextRef context = UIGraphicsGetCurrentContext(); @@ -286,11 +347,18 @@ -(void)drawRect:(CGRect)rect } } --(void)graphNeedsRedraw:(NSNotification *)notification +-(void)graphNeedsRedraw:(nonnull NSNotification *__unused)notification { [self setNeedsDisplay]; } +-(void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection +{ + [super traitCollectionDidChange:previousTraitCollection]; + + [self.hostedGraph setNeedsDisplayAllLayers]; +} + /// @endcond #pragma mark - @@ -298,9 +366,9 @@ -(void)graphNeedsRedraw:(NSNotification *)notification /// @cond --(void)setHostedGraph:(CPTGraph *)newLayer +-(void)setHostedGraph:(nullable CPTGraph *)newLayer { - NSParameterAssert( (newLayer == nil) || [newLayer isKindOfClass:[CPTGraph class]] ); + NSParameterAssert((newLayer == nil) || [newLayer isKindOfClass:[CPTGraph class]]); if ( newLayer == hostedGraph ) { return; @@ -335,8 +403,10 @@ -(void)setHostedGraph:(CPTGraph *)newLayer } else { if ( newLayer ) { - newLayer.frame = self.layer.bounds; - [self.layer addSublayer:newLayer]; + CPTGraph *newGraph = newLayer; + + newGraph.frame = self.layer.bounds; + [self.layer addSublayer:newGraph]; } } } @@ -374,7 +444,7 @@ -(void)setCollapsesLayers:(BOOL)collapse -(void)setFrame:(CGRect)newFrame { - [super setFrame:newFrame]; + super.frame = newFrame; CPTGraph *theHostedGraph = self.hostedGraph; [theHostedGraph setNeedsLayout]; @@ -389,7 +459,7 @@ -(void)setFrame:(CGRect)newFrame -(void)setBounds:(CGRect)newBounds { - [super setBounds:newBounds]; + super.bounds = newBounds; CPTGraph *theHostedGraph = self.hostedGraph; [theHostedGraph setNeedsLayout]; diff --git a/framework/iPhoneOnly/CPTImagePlatformSpecific.m b/framework/iPhoneOnly/CPTImagePlatformSpecific.m index aaa7fbad1..20c73f03d 100644 --- a/framework/iPhoneOnly/CPTImagePlatformSpecific.m +++ b/framework/iPhoneOnly/CPTImagePlatformSpecific.m @@ -12,9 +12,9 @@ @implementation CPTImage(CPTPlatformSpecificImageExtensions) * @param anImage The platform-native image. * @return A CPTImage instance initialized with the provided image. **/ --(instancetype)initWithNativeImage:(CPTNativeImage *)anImage +-(nonnull instancetype)initWithNativeImage:(nullable CPTNativeImage *)anImage { - if ( (self = [self initWithCGImage:NULL scale:anImage.scale]) ) { + if ((self = [self initWithCGImage:NULL scale:anImage.scale])) { self.nativeImage = anImage; UIEdgeInsets insets = anImage.capInsets; @@ -33,7 +33,7 @@ -(instancetype)initWithNativeImage:(CPTNativeImage *)anImage * @param path The file system path of the file. * @return A CPTImage instance initialized with the contents of the PNG file. **/ --(instancetype)initForPNGFile:(NSString *)path +-(nonnull instancetype)initForPNGFile:(nonnull NSString *)path { CGFloat imageScale = CPTFloat(1.0); @@ -45,7 +45,7 @@ -(instancetype)initForPNGFile:(NSString *)path imageScale = MAX(imageScale, screen.scale); } - if ( imageScale > 1.0 ) { + if ( imageScale > CPTFloat(1.0)) { NSMutableString *hiDpiPath = [path mutableCopy]; NSUInteger replaceCount = [hiDpiPath replaceOccurrencesOfString:@".png" withString:[NSString stringWithFormat:@"@%dx.png", (int)imageScale] diff --git a/framework/iPhoneOnly/CPTPlatformSpecificCategories.h b/framework/iPhoneOnly/CPTPlatformSpecificCategories.h index 06cd3ec67..efa9ffffc 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificCategories.h +++ b/framework/iPhoneOnly/CPTPlatformSpecificCategories.h @@ -2,17 +2,6 @@ #import "CPTLayer.h" #import "CPTPlatformSpecificDefines.h" -#pragma mark CPTColor - -/** @category CPTColor(CPTPlatformSpecificColorExtensions) - * @brief Platform-specific extensions to CPTColor. - **/ -@interface CPTColor(CPTPlatformSpecificColorExtensions) - -@property (nonatomic, readonly, nonnull) UIColor *uiColor; - -@end - #pragma mark - CPTLayer /** @category CPTLayer(CPTPlatformSpecificLayerExtensions) @@ -53,4 +42,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 9a4e542b3..cad04a6f3 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificCategories.m +++ b/framework/iPhoneOnly/CPTPlatformSpecificCategories.m @@ -1,22 +1,7 @@ #import "CPTPlatformSpecificCategories.h" #import "CPTPlatformSpecificFunctions.h" - -#pragma mark CPTColor - -@implementation CPTColor(CPTPlatformSpecificColorExtensions) - -/** @property uiColor - * @brief Gets the color value as a UIColor. - **/ -@dynamic uiColor; - --(UIColor *)uiColor -{ - return [UIColor colorWithCGColor:self.cgColor]; -} - -@end +#import "tgmath.h" #pragma mark - CPTLayer @@ -25,18 +10,18 @@ @implementation CPTLayer(CPTPlatformSpecificLayerExtensions) /** @brief Gets an image of the layer contents. * @return A native image representation of the layer content. **/ --(CPTNativeImage *)imageOfLayer +-(nullable CPTNativeImage *)imageOfLayer { CGSize boundsSize = self.bounds.size; - UIGraphicsBeginImageContextWithOptions( boundsSize, self.opaque, CPTFloat(0.0) ); + UIGraphicsBeginImageContextWithOptions(boundsSize, self.opaque, CPTFloat(0.0)); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGContextSetAllowsAntialiasing(context, true); CGContextTranslateCTM(context, CPTFloat(0.0), boundsSize.height); - CGContextScaleCTM( context, CPTFloat(1.0), CPTFloat(-1.0) ); + CGContextScaleCTM(context, CPTFloat(1.0), CPTFloat(-1.0)); [self layoutAndRenderInContext:context]; CPTNativeImage *layerImage = UIGraphicsGetImageFromCurrentImageContext(); @@ -58,7 +43,7 @@ @implementation NSNumber(CPTPlatformSpecificNumberExtensions) * @param other The other number to compare to the receiver. * @return @YES if the receiver is less than other, otherwise @NO. **/ --(BOOL)isLessThan:(NSNumber *)other +-(BOOL)isLessThan:(nonnull NSNumber *)other { return [self compare:other] == NSOrderedAscending; } @@ -67,7 +52,7 @@ -(BOOL)isLessThan:(NSNumber *)other * @param other The other number to compare to the receiver. * @return @YES if the receiver is less than or equal to other, otherwise @NO. **/ --(BOOL)isLessThanOrEqualTo:(NSNumber *)other +-(BOOL)isLessThanOrEqualTo:(nonnull NSNumber *)other { return [self compare:other] == NSOrderedSame || [self compare:other] == NSOrderedAscending; } @@ -76,7 +61,7 @@ -(BOOL)isLessThanOrEqualTo:(NSNumber *)other * @param other The other number to compare to the receiver. * @return @YES if the receiver is greater than other, otherwise @NO. **/ --(BOOL)isGreaterThan:(NSNumber *)other +-(BOOL)isGreaterThan:(nonnull NSNumber *)other { return [self compare:other] == NSOrderedDescending; } @@ -85,7 +70,7 @@ -(BOOL)isGreaterThan:(NSNumber *)other * @param other The other number to compare to the receiver. * @return @YES if the receiver is greater than or equal to other, otherwise @NO. **/ --(BOOL)isGreaterThanOrEqualTo:(NSNumber *)other +-(BOOL)isGreaterThanOrEqualTo:(nonnull NSNumber *)other { return [self compare:other] == NSOrderedSame || [self compare:other] == NSOrderedDescending; } @@ -101,17 +86,34 @@ @implementation NSAttributedString(CPTPlatformSpecificAttributedStringExtensions * @param context The graphics context to draw into. * @since Available on iOS 6.0 and later. Does nothing on earlier versions. **/ --(void)drawInRect:(CGRect)rect inContext:(CGContextRef)context +-(void)drawInRect:(CGRect)rect inContext:(nonnull CGContextRef)context { if ( [self respondsToSelector:@selector(drawInRect:)] ) { CPTPushCGContext(context); [self drawWithRect:rect - options:NSStringDrawingUsesLineFragmentOrigin | NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine + options:CPTStringDrawingOptions context:nil]; 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 = [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/CPTPlatformSpecificDefines.h b/framework/iPhoneOnly/CPTPlatformSpecificDefines.h index 9b84d0d86..471ca99d5 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificDefines.h +++ b/framework/iPhoneOnly/CPTPlatformSpecificDefines.h @@ -1,4 +1,6 @@ /// @file +typedef UIColor CPTNativeColor; ///< Platform-native color. typedef UIImage CPTNativeImage; ///< Platform-native image format. typedef UIEvent CPTNativeEvent; ///< Platform-native OS event. +typedef UIFont CPTNativeFont; ///< Platform-native font. diff --git a/framework/iPhoneOnly/CPTPlatformSpecificFunctions.m b/framework/iPhoneOnly/CPTPlatformSpecificFunctions.m index 3e7cd3677..737d400f5 100644 --- a/framework/iPhoneOnly/CPTPlatformSpecificFunctions.m +++ b/framework/iPhoneOnly/CPTPlatformSpecificFunctions.m @@ -5,7 +5,7 @@ #pragma mark - #pragma mark Context management -void CPTPushCGContext(CGContextRef newContext) +void CPTPushCGContext(__nonnull CGContextRef newContext) { UIGraphicsPushContext(newContext); } @@ -18,7 +18,7 @@ void CPTPopCGContext(void) #pragma mark - #pragma mark Debugging -CPTNativeImage * __nonnull CPTQuickLookImage(CGRect rect, __nonnull CPTQuickLookImageBlock renderBlock) +CPTNativeImage *__nonnull CPTQuickLookImage(CGRect rect, __nonnull CPTQuickLookImageBlock renderBlock) { UIGraphicsBeginImageContextWithOptions(rect.size, YES, 1.0); CGContextRef context = UIGraphicsGetCurrentContext(); diff --git a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.h index 2da829d3f..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_IPHONE_SIMULATOR || TARGET_OS_IPHONE -#if __IPHONE_OS_VERSION_MAX_ALLOWED < 70000 -@interface NSString(CPTTextStylePlatformSpecificExtensions) - --(CGSize)sizeWithAttributes:(CPTDictionary)attrs; - -@end -#else -#endif -#endif - -/// @endcond diff --git a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m index 1152dae82..c2602bbc6 100644 --- a/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m +++ b/framework/iPhoneOnly/CPTTextStylePlatformSpecific.m @@ -8,7 +8,7 @@ @implementation CPTTextStyle(CPTPlatformSpecificTextStyleExtensions) -/** @property CPTDictionary attributes +/** @property nonnull CPTDictionary *attributes * @brief A dictionary of standard text attributes suitable for formatting an NSAttributedString. * * The dictionary will contain values for the following keys that represent the receiver's text style: @@ -34,7 +34,7 @@ @implementation CPTTextStyle(CPTPlatformSpecificTextStyleExtensions) * @param attributes A dictionary of standard text attributes. * @return A new CPTTextStyle instance. **/ -+(instancetype)textStyleWithAttributes:(CPTDictionary)attributes ++(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attributes { CPTMutableTextStyle *newStyle = [CPTMutableTextStyle textStyle]; @@ -42,6 +42,7 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes UIFont *styleFont = attributes[NSFontAttributeName]; if ( styleFont ) { + newStyle.font = styleFont; newStyle.fontName = styleFont.fontName; newStyle.fontSize = styleFont.pointSize; } @@ -67,15 +68,15 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes /// @cond --(CPTDictionary)attributes +-(nonnull CPTDictionary *)attributes { - CPTMutableDictionary myAttributes = [NSMutableDictionary dictionary]; + CPTMutableDictionary *myAttributes = [NSMutableDictionary dictionary]; // Font - UIFont *styleFont = nil; + UIFont *styleFont = self.font; NSString *fontName = self.fontName; - if ( fontName ) { + if ((styleFont == nil) && fontName ) { styleFont = [UIFont fontWithName:fontName size:self.fontSize]; } @@ -111,9 +112,20 @@ -(CPTDictionary)attributes @implementation CPTMutableTextStyle(CPTPlatformSpecificMutableTextStyleExtensions) -/// @cond - -+(instancetype)textStyleWithAttributes:(CPTDictionary)attributes +/** @brief Creates and returns a new CPTMutableTextStyle instance initialized from a dictionary of text attributes. + * + * The text style will be initalized with values associated with the following keys: + * - #NSFontAttributeName: Sets the @link CPTMutableTextStyle::fontName fontName @endlink + * and @link CPTMutableTextStyle::fontSize fontSize @endlink. + * - #NSForegroundColorAttributeName: Sets the @link CPTMutableTextStyle::color color @endlink. + * - #NSParagraphStyleAttributeName: Sets the @link CPTMutableTextStyle::textAlignment textAlignment @endlink and @link CPTMutableTextStyle::lineBreakMode lineBreakMode @endlink. + * + * Properties associated with missing keys will be inialized to their default values. + * + * @param attributes A dictionary of standard text attributes. + * @return A new CPTMutableTextStyle instance. + **/ ++(nonnull instancetype)textStyleWithAttributes:(nullable CPTDictionary *)attributes { CPTMutableTextStyle *newStyle = [CPTMutableTextStyle textStyle]; @@ -121,6 +133,7 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes UIFont *styleFont = attributes[NSFontAttributeName]; if ( styleFont ) { + newStyle.font = styleFont; newStyle.fontName = styleFont.fontName; newStyle.fontSize = styleFont.pointSize; } @@ -143,8 +156,6 @@ +(instancetype)textStyleWithAttributes:(CPTDictionary)attributes return newStyle; } -/// @endcond - @end #pragma mark - @@ -158,33 +169,17 @@ @implementation NSString(CPTTextStyleExtensions) * @param style The text style. * @return The size of the text when drawn with the given style. **/ --(CGSize)sizeWithTextStyle:(CPTTextStyle *)style +-(CGSize)sizeWithTextStyle:(nullable CPTTextStyle *)style { - CGSize textSize; - - // -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; + CGRect rect = [self boundingRectWithSize:CPTSizeMake(10000.0, 10000.0) + options:CPTStringDrawingOptions + attributes:style.attributes + context:nil]; - 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 - } + textSize.width = ceil(textSize.width); + textSize.height = ceil(textSize.height); return textSize; } @@ -197,7 +192,7 @@ -(CGSize)sizeWithTextStyle:(CPTTextStyle *)style * @param style The text style. * @param context The graphics context to draw into. **/ --(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CGContextRef)context +-(void)drawInRect:(CGRect)rect withTextStyle:(nullable CPTTextStyle *)style inContext:(nonnull CGContextRef)context { if ( style.color == nil ) { return; @@ -211,11 +206,17 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CG CPTPushCGContext(context); +#if TARGET_OS_SIMULATOR || TARGET_OS_TV + [self drawWithRect:rect + options:CPTStringDrawingOptions + attributes:style.attributes + context:nil]; +#else #if __IPHONE_OS_VERSION_MAX_ALLOWED >= 70000 // -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]; } @@ -223,10 +224,10 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CG UIColor *styleColor = style.attributes[NSForegroundColorAttributeName]; [styleColor set]; - UIFont *theFont = nil; + UIFont *theFont = style.font; NSString *fontName = style.fontName; - if ( fontName ) { + if ((theFont == nil) && fontName ) { theFont = [UIFont fontWithName:fontName size:style.fontSize]; } @@ -242,12 +243,16 @@ -(void)drawInRect:(CGRect)rect withTextStyle:(CPTTextStyle *)style inContext:(CG UIColor *styleColor = style.attributes[NSForegroundColorAttributeName]; [styleColor set]; - UIFont *theFont = [UIFont fontWithName:style.fontName size:style.fontSize]; + UIFont *theFont = self.font; + if ( theFont == nil ) { + theFont = [UIFont fontWithName:style.fontName size:style.fontSize]; + } [self drawInRect:rect withFont:theFont lineBreakMode:style.lineBreakMode alignment:(NSTextAlignment)style.textAlignment]; +#endif #endif CGContextRestoreGState(context); diff --git a/framework/xcconfig/CorePlot.xcconfig b/framework/xcconfig/CorePlot.xcconfig index 44cbeb3c3..e7f5cc5f7 100644 --- a/framework/xcconfig/CorePlot.xcconfig +++ b/framework/xcconfig/CorePlot.xcconfig @@ -1,25 +1,36 @@ #include "CorePlotWarnings.xcconfig" ARCHS = $(ARCHS_STANDARD) -VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s +VALID_ARCHS[sdk=iphoneos*] = arm64 arm64e armv7 armv7s VALID_ARCHS[sdk=iphonesimulator*] = i386 x86_64 -VALID_ARCHS[sdk=macosx*] = i386 x86_64 +VALID_ARCHS[sdk=macosx*] = i386 x86_64 arm64 +VALID_ARCHS[sdk=appletvos*] = arm64 +VALID_ARCHS[sdk=appletvsimulator*] = i386 x86_64 + +IPHONEOS_DEPLOYMENT_TARGET = 8.0 +MACOSX_DEPLOYMENT_TARGET = 10.8 +TVOS_DEPLOYMENT_TARGET = 9.0 SYMROOT = $(PROJECT_DIR)/../build -DEBUG_INFORMATION_FORMAT = dwarf-with-dsym + +ALWAYS_SEARCH_USER_PATHS = NO +CLANG_ENABLE_OBJC_ARC = YES +CLANG_STATIC_ANALYZER_MODE = shallow +CLANG_STATIC_ANALYZER_MODE_ON_ANALYZE_ACTION = deep COMBINE_HIDPI_IMAGES = YES COPY_PHASE_STRIP = YES -STRIP_STYLE = debugging -SEPARATE_STRIP = YES -SKIP_INSTALL = YES +DEAD_CODE_STRIPPING = YES +DEBUG_INFORMATION_FORMAT = dwarf-with-dsym GCC_C_LANGUAGE_STANDARD = c99 GCC_DYNAMIC_NO_PIC = NO GCC_PRECOMPILE_PREFIX_HEADER = YES GCC_PREFIX_HEADER = CorePlot_Prefix.pch -DEAD_CODE_STRIPPING = YES -CLANG_ENABLE_OBJC_ARC = YES LINKER_DISPLAYS_MANGLED_NAMES = NO -RUN_CLANG_STATIC_ANALYZER = YES -CLANG_STATIC_ANALYZER_MODE_ON_ANALYZE_ACTION = deep -CLANG_STATIC_ANALYZER_MODE = shallow OTHER_LDFLAGS = -ObjC +RUN_CLANG_STATIC_ANALYZER = YES +SEPARATE_STRIP = YES +SKIP_INSTALL = YES +STRIP_STYLE = debugging +STRIP_SWIFT_SYMBOLS = YES +SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule" +USE_HEADERMAP = NO diff --git a/framework/xcconfig/CorePlotDebug.xcconfig b/framework/xcconfig/CorePlotDebug.xcconfig index 3f9fd3ea8..b4bcbc7e7 100644 --- a/framework/xcconfig/CorePlotDebug.xcconfig +++ b/framework/xcconfig/CorePlotDebug.xcconfig @@ -5,3 +5,6 @@ VALIDATE_PRODUCT = NO DEPLOYMENT_POSTPROCESSING = NO STRIP_INSTALLED_PRODUCT = NO GCC_OPTIMIZATION_LEVEL = 0 +GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1 $(inherited) +ENABLE_NS_ASSERTIONS = YES +COPY_PHASE_STRIP = NO diff --git a/framework/xcconfig/CorePlotRelease.xcconfig b/framework/xcconfig/CorePlotRelease.xcconfig index 37ae757b0..8d9600513 100644 --- a/framework/xcconfig/CorePlotRelease.xcconfig +++ b/framework/xcconfig/CorePlotRelease.xcconfig @@ -5,3 +5,5 @@ VALIDATE_PRODUCT = YES DEPLOYMENT_POSTPROCESSING = YES STRIP_INSTALLED_PRODUCT = YES GCC_OPTIMIZATION_LEVEL = s +ENABLE_NS_ASSERTIONS = NO +COPY_PHASE_STRIP = YES diff --git a/framework/xcconfig/CorePlotWarnings.xcconfig b/framework/xcconfig/CorePlotWarnings.xcconfig index 6b596ba98..8c11ec296 100644 --- a/framework/xcconfig/CorePlotWarnings.xcconfig +++ b/framework/xcconfig/CorePlotWarnings.xcconfig @@ -1,74 +1,103 @@ -GCC_TREAT_WARNINGS_AS_ERRORS = YES -GCC_WARN_CHECK_SWITCH_STATEMENTS = YES -CLANG_WARN_DOCUMENTATION_COMMENTS = YES -GCC_WARN_SHADOW = YES -GCC_WARN_64_TO_32_BIT_CONVERSION = YES -CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES -GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES -GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES -GCC_WARN_ABOUT_RETURN_TYPE = YES -GCC_WARN_MISSING_PARENTHESES = YES -GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES -GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES -GCC_WARN_ABOUT_MISSING_NEWLINE = YES -GCC_WARN_SIGN_COMPARE = YES -CLANG_WARN_EMPTY_BODY = YES -CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES -GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE -GCC_WARN_UNUSED_FUNCTION = YES -GCC_WARN_UNUSED_LABEL = YES -GCC_WARN_UNUSED_VALUE = YES -GCC_WARN_UNUSED_VARIABLE = YES -CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE -GCC_WARN_UNUSED_PARAMETER = YES -GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES -CLANG_WARN_ASSIGN_ENUM = YES -CLANG_WARN__DUPLICATE_METHOD_MATCH = YES -CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES -GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO -CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES -GCC_WARN_UNDECLARED_SELECTOR = YES -CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES -CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES -CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES -CLANG_WARN_OBJC_RECEIVER_WEAK = YES -GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES -GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES -CLANG_WARN_BOOL_CONVERSION = YES -CLANG_WARN_CONSTANT_CONVERSION = YES -CLANG_WARN_ENUM_CONVERSION = YES -CLANG_WARN_INT_CONVERSION = YES -CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = YES -GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES -GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES -GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES -GCC_WARN_UNKNOWN_PRAGMAS = YES -CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES -CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = NO -GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES -GCC_WARN_STRICT_SELECTOR_MATCH = NO -CLANG_WARN_OBJC_ROOT_CLASS = YES -CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES - -ENABLE_STRICT_OBJC_MSGSEND = YES +ASSETCATALOG_WARNINGS = 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_MEMORY_MANAGEMENT = YES +CLANG_ANALYZER_NONNULL = YES CLANG_ANALYZER_OBJC_ATSYNC = YES -CLANG_ANALYZER_OBJC_NSCFERROR = YES -CLANG_ANALYZER_OBJC_INCOMP_METHOD_TYPES = YES CLANG_ANALYZER_OBJC_COLLECTIONS = YES -CLANG_ANALYZER_OBJC_UNUSED_IVARS = YES -CLANG_ANALYZER_OBJC_SELF_INIT = YES +CLANG_ANALYZER_OBJC_DEALLOC = YES +CLANG_ANALYZER_OBJC_GENERICS = YES +CLANG_ANALYZER_OBJC_INCOMP_METHOD_TYPES = YES +CLANG_ANALYZER_OBJC_NSCFERROR = YES CLANG_ANALYZER_OBJC_RETAIN_COUNT = YES +CLANG_ANALYZER_OBJC_SELF_INIT = YES +CLANG_ANALYZER_OBJC_UNUSED_IVARS = YES CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES -CLANG_ANALYZER_SECURITY_KEYCHAIN_API = YES -CLANG_ANALYZER_SECURITY_INSECUREAPI_UNCHECKEDRETURN = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_GETPW_GETS = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_MKSTEMP = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY = YES +CLANG_ANALYZER_SECURITY_INSECUREAPI_UNCHECKEDRETURN = YES CLANG_ANALYZER_SECURITY_INSECUREAPI_VFORK = YES +CLANG_ANALYZER_SECURITY_KEYCHAIN_API = YES + +CLANG_WARN__ARC_BRIDGE_CAST_NONARC = YES +CLANG_WARN__DUPLICATE_METHOD_MATCH = YES +CLANG_WARN_ASSIGN_ENUM = YES +CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES +CLANG_WARN_BOOL_CONVERSION = YES +CLANG_WARN_COMMA = YES +CLANG_WARN_CONSTANT_CONVERSION = YES +CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES +CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES +CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES +CLANG_WARN_DOCUMENTATION_COMMENTS = YES +CLANG_WARN_EMPTY_BODY = YES +CLANG_WARN_ENUM_CONVERSION = YES +CLANG_WARN_FLOAT_CONVERSION = YES +CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES +CLANG_WARN_INFINITE_RECURSION = YES +CLANG_WARN_INT_CONVERSION = YES +CLANG_WARN_MISSING_NOESCAPE = YES +CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES +CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION = YES +CLANG_WARN_OBJC_EXPLICIT_OWNERSHIP_TYPE = YES +CLANG_WARN_OBJC_IMPLICIT_ATOMIC_PROPERTIES = NO +CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES +CLANG_WARN_OBJC_INTERFACE_IVARS = YES +CLANG_WARN_OBJC_LITERAL_CONVERSION = YES +CLANG_WARN_OBJC_MISSING_PROPERTY_SYNTHESIS = YES +CLANG_WARN_OBJC_RECEIVER_WEAK = YES +CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES +CLANG_WARN_OBJC_ROOT_CLASS = YES +CLANG_WARN_PRAGMA_PACK = YES +CLANG_WARN_PRIVATE_MODULE = YES +CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO +CLANG_WARN_RANGE_LOOP_ANALYSIS = YES +CLANG_WARN_SEMICOLON_BEFORE_METHOD_BODY =YES +CLANG_WARN_STRICT_PROTOTYPES = YES +CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES +CLANG_WARN_SUSPICIOUS_MOVE = YES +CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE +CLANG_WARN_UNREACHABLE_CODE = YES_AGGRESSIVE + +ENABLE_STRICT_OBJC_MSGSEND = YES + +GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES +GCC_TREAT_INCOMPATIBLE_POINTER_TYPE_WARNINGS_AS_ERRORS = YES +GCC_TREAT_WARNINGS_AS_ERRORS = YES + +GCC_WARN_64_TO_32_BIT_CONVERSION = YES +GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = YES +GCC_WARN_ABOUT_INVALID_OFFSETOF_MACRO = YES +GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS = YES +GCC_WARN_ABOUT_MISSING_NEWLINE = YES +GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES +GCC_WARN_ABOUT_POINTER_SIGNEDNESS = YES +GCC_WARN_ABOUT_RETURN_TYPE = YES +GCC_WARN_ALLOW_INCOMPLETE_PROTOCOL = YES +GCC_WARN_CHECK_SWITCH_STATEMENTS = YES +GCC_WARN_FOUR_CHARACTER_CONSTANTS = YES +GCC_WARN_HIDDEN_VIRTUAL_FUNCTIONS = YES +GCC_WARN_INITIALIZER_NOT_FULLY_BRACKETED = YES +GCC_WARN_MISSING_PARENTHESES = YES +GCC_WARN_MULTIPLE_DEFINITION_TYPES_FOR_SELECTOR = NO +GCC_WARN_SHADOW = YES +GCC_WARN_SIGN_COMPARE = YES +GCC_WARN_STRICT_SELECTOR_MATCH = NO +GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = YES +GCC_WARN_UNDECLARED_SELECTOR = YES +GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE +GCC_WARN_UNKNOWN_PRAGMAS = YES +GCC_WARN_UNUSED_FUNCTION = YES +GCC_WARN_UNUSED_LABEL = YES +GCC_WARN_UNUSED_PARAMETER = YES +GCC_WARN_UNUSED_VALUE = YES +GCC_WARN_UNUSED_VARIABLE = YES + +IBC_WARNINGS = YES -OTHER_CFLAGS = -Weverything -Wno-unused-parameter -Wno-undef -Wno-switch-enum -Wno-float-equal -Wno-padded -Wno-dollar-in-identifier-extension -Wno-custom-atomic-properties -Wno-gnu -Wno-assign-enum -Wno-pedantic -Wno-documentation -Wno-unknown-warning-option -Wno-cstring-format-directive -Wno-documentation-unknown-command -Wno-reserved-id-macro -Wno-incompatible-pointer-types-discards-qualifiers +WARNING_CFLAGS = -Weverything -Wno-undef -Wno-switch-enum -Wno-float-equal -Wno-custom-atomic-properties -Wno-pedantic -Wno-documentation -Wno-documentation-unknown-command -Wno-partial-availability -Wno-objc-messaging-id diff --git a/scripts/README Creating a release package.md b/scripts/README Creating a release package.md index 66c0c8999..bcfb6724c 100644 --- a/scripts/README Creating a release package.md +++ b/scripts/README Creating a release package.md @@ -5,51 +5,54 @@ 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
  • -
  • [Doxygen](http://www.stack.nl/~dimitri/doxygen/download.html#latestsrc), version 1.8.10 or later, installed in /Applications
  • +
  • Xcode 11
  • +
  • [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
2. Ensure the [change log](https://github.com/core-plot/core-plot/blob/master/documentation/changelog.markdown) and [podspec](https://github.com/core-plot/core-plot/blob/master/CorePlot.podspec) are up-to-date and committed to the Git repository. -3. Using Git, ensure your local Core Plot source directory is in sync with the public repository on GitHub. +3. In the "Core Plot" project build settings, set the "Current Project Version" to the release version. Commit the change in Git. -4. Open the Terminal application and `cd` to the root directory of your local Core Plot source directory. +4. Using Git, ensure your local Core Plot source directory is in sync with the public repository on GitHub. -5. Tag the current revision with the release version: +5. Open the Terminal application and `cd` to the root directory of your local Core Plot source directory. + +6. Tag the current revision with the release version: `$ git tag release_` where **<version>** is the version number for this release. -6. Change to the **scripts** folder: +7. Change to the **scripts** folder: `$ cd scripts` -7. Run the createrelease script: +8. Run the createrelease script: `$ python createrelease.py ` -8. Review the messages printed in the Terminal window and verify that all build steps succeeded. +9. Review the messages printed in the Terminal window and verify that all build steps succeeded. -9. The release products were placed in a folder called **CorePlot_<version>** and placed on your desktop. Open this folder and verify that the following subfolders and files are present: +10. The release products were placed in a folder called **CorePlot_<version>** and placed on your desktop. Open this folder and verify that the following subfolders and files are present:
  • Binaries/iOS/
  • Binaries/MacOS/
  • +
  • Binaries/tvOS/
  • Documentation/
  • READMEs/
  • Source/
  • License.txt
-10. Right-click the release folder on your desktop and select **Compress "<filename>"** from the menu. +11. Right-click the release folder on your desktop and select **Compress "<filename>"** from the menu. -11. Log into GitHub and navigate to the [Releases](https://github.com/core-plot/core-plot/releases) page. +12. Log into GitHub and navigate to the [Releases](https://github.com/core-plot/core-plot/releases) page. -12. Click **Draft a new release**. +13. Click **Draft a new release**. -13. Select the tag for the new release (`release_`). +14. Select the tag for the new release (`release_`). Enter the following: @@ -58,7 +61,7 @@ Follow these steps to create a Core Plot release and post it to GitHub:
  • Binaries: drag the Core Plot zip file on your desktop to the box
  • -14. Click **Publish release**. +15. Click **Publish release**. # Update Documentation @@ -96,5 +99,4 @@ Follow these steps to create a Core Plot release and post it to GitHub:
    • The Core Plot [discussion board](https://groups.google.com/forum/#!forum/coreplot-discuss)
    • [Twitter](https://twitter.com/CorePlot)
    • -
    • [App.net](https://alpha.app.net/coreplot)
    diff --git a/scripts/createrelease.py b/scripts/createrelease.py index 5e76c5ee2..9375881c2 100644 --- a/scripts/createrelease.py +++ b/scripts/createrelease.py @@ -58,8 +58,10 @@ def RunXcode(project, target): binariesDir = join(releaseRootDir, 'Binaries') macosDir = join(binariesDir, 'MacOS') iosDir = join(binariesDir, 'iOS') +tvosDir = join(binariesDir, 'tvOS') makedirs(macosDir) mkdir(iosDir) +mkdir(tvosDir) # Build Mac Framework chdir('framework') @@ -81,6 +83,12 @@ def RunXcode(project, target): iOSHeaderFile = join(join(projectRoot, 'build/Release-universal'), 'CorePlotHeaders') copytree(iOSHeaderFile, join(iosDir, 'CorePlotHeaders')) +# Build tvOS Framework +RunXcode('CorePlot.xcodeproj', 'Universal tvOS Framework') +tvOSProductsDir = join(projectRoot, 'build/Release-appletvuniversal') +tvOSFramework = join(tvOSProductsDir, 'CorePlot.framework') +copytree(tvOSFramework, join(tvosDir, 'CorePlot.framework'), symlinks=True) + # Build Docs RunXcode('CorePlot.xcodeproj', 'Documentation-Mac') RunXcode('CorePlot.xcodeproj', 'Documentation-iOS') @@ -88,7 +96,3 @@ def RunXcode(project, target): # Copy Docs docDir = join(releaseRootDir, 'Documentation') copytree(join(projectRoot, 'documentation'), docDir, ignore=ignore_patterns('*.orig','*.git')) -homeDir = environ['HOME'] -docsetsDir = join(homeDir, 'Library/Developer/Shared/Documentation/DocSets') -copytree(join(docsetsDir, 'com.CorePlot.Framework.docset'), join(docDir, 'com.CorePlot.Framework.docset')) -copytree(join(docsetsDir, 'com.CorePlotTouch.Framework.docset'), join(docDir, 'com.CorePlotTouch.Framework.docset')) diff --git a/scripts/uncrustify.cfg b/scripts/uncrustify.cfg index 20202e81f..adf13c0dd 100644 --- a/scripts/uncrustify.cfg +++ b/scripts/uncrustify.cfg @@ -1,461 +1,713 @@ -# Uncrustify 0.60 -newlines = auto -input_tab_size = 4 -output_tab_size = 4 -string_escape_char = 92 -string_escape_char2 = 0 -tok_split_gte = false -utf8_bom = remove -utf8_byte = false -utf8_force = false -indent_columns = 4 -indent_continue = 0 -indent_with_tabs = 0 -indent_cmt_with_tabs = false -indent_align_string = true -indent_xml_string = 4 -indent_brace = 0 -indent_braces = false -indent_braces_no_func = false -indent_braces_no_class = false -indent_braces_no_struct = false -indent_brace_parent = false -indent_namespace = false -indent_namespace_level = 0 -indent_namespace_limit = 0 -indent_extern = false -indent_class = true -indent_class_colon = false -indent_ctor_init_leading = 2 -indent_ctor_init = 0 -indent_else_if = false -indent_var_def_blk = 0 -indent_var_def_cont = false -indent_func_def_force_col1 = false -indent_func_call_param = false -indent_func_def_param = false -indent_func_proto_param = false -indent_func_class_param = false -indent_func_ctor_var_param = false -indent_template_param = false -indent_func_param_double = false -indent_func_const = 1 -indent_func_throw = 1 -indent_member = 1 -indent_sing_line_comments = 0 -indent_relative_single_line_comments = true -indent_switch_case = 4 -indent_case_shift = 0 -indent_case_brace = 0 -indent_col1_comment = false -indent_label = 1 -indent_access_spec = 1 -indent_access_spec_body = false -indent_paren_nl = false -indent_paren_close = 1 -indent_comma_paren = false -indent_bool_paren = false -indent_first_bool_expr = false -indent_square_nl = false -indent_preserve_sql = true -indent_align_assign = true -indent_oc_block = true -indent_oc_block_msg = 0 -indent_oc_msg_colon = 0 -sp_arith = force -sp_assign = force -sp_cpp_lambda_assign = ignore -sp_cpp_lambda_paren = ignore -sp_assign_default = force -sp_before_assign = ignore -sp_after_assign = ignore -sp_enum_assign = force -sp_enum_before_assign = ignore -sp_enum_after_assign = ignore -sp_pp_concat = force -sp_pp_stringify = remove -sp_before_pp_stringify = ignore -sp_bool = force -sp_compare = force -sp_inside_paren = remove -sp_paren_paren = remove -sp_cparen_oparen = remove -sp_balance_nested_parens = true -sp_paren_brace = force -sp_before_ptr_star = force -sp_before_unnamed_ptr_star = force -sp_between_ptr_star = remove -sp_after_ptr_star = remove -sp_after_ptr_star_func = remove -sp_ptr_star_paren = remove -sp_before_ptr_star_func = force -sp_before_byref = force -sp_before_unnamed_byref = force -sp_after_byref = remove -sp_after_byref_func = remove -sp_before_byref_func = force -sp_after_type = force -sp_before_template_paren = ignore -sp_template_angle = force -sp_before_angle = remove -sp_inside_angle = remove -sp_after_angle = remove -sp_angle_paren = remove -sp_angle_word = force -sp_angle_shift = add -sp_permit_cpp11_shift = false -sp_before_sparen = force -sp_inside_sparen = force -sp_inside_sparen_close = ignore -sp_inside_sparen_open = ignore -sp_after_sparen = force -sp_sparen_brace = force -sp_invariant_paren = ignore -sp_after_invariant_paren = ignore -sp_special_semi = force -sp_before_semi = remove -sp_before_semi_for = remove -sp_before_semi_for_empty = remove -sp_after_semi = force -sp_after_semi_for = force -sp_after_semi_for_empty = force -sp_before_square = remove -sp_before_squares = remove -sp_inside_square = remove -sp_after_comma = force -sp_before_comma = remove -sp_paren_comma = force -sp_before_ellipsis = remove -sp_after_class_colon = force -sp_before_class_colon = force -sp_before_case_colon = remove -sp_after_operator = remove -sp_after_operator_sym = force -sp_after_cast = remove -sp_inside_paren_cast = remove -sp_cpp_cast_paren = remove -sp_sizeof_paren = remove -sp_after_tag = ignore -sp_inside_braces_enum = remove -sp_inside_braces_struct = remove -sp_inside_braces = force -sp_inside_braces_empty = remove -sp_type_func = force -sp_func_proto_paren = remove -sp_func_def_paren = remove -sp_inside_fparens = remove -sp_inside_fparen = remove -sp_inside_tparen = remove -sp_after_tparen_close = remove -sp_square_fparen = remove -sp_fparen_brace = force -sp_func_call_paren = remove -sp_func_call_paren_empty = ignore -sp_func_call_user_paren = remove -sp_func_class_paren = remove -sp_return_paren = force -sp_attribute_paren = remove -sp_defined_paren = remove -sp_throw_paren = force -sp_after_throw = force -sp_catch_paren = force -sp_version_paren = ignore -sp_scope_paren = ignore -sp_macro = force -sp_macro_func = force -sp_else_brace = force -sp_brace_else = force -sp_brace_typedef = force -sp_catch_brace = force -sp_brace_catch = force -sp_finally_brace = force -sp_brace_finally = force -sp_try_brace = force -sp_getset_brace = force -sp_word_brace = add -sp_word_brace_ns = add -sp_before_dc = remove -sp_after_dc = remove -sp_d_array_colon = remove -sp_not = remove -sp_inv = remove -sp_addr = remove -sp_member = remove -sp_deref = remove -sp_sign = remove -sp_incdec = remove -sp_before_nl_cont = force -sp_after_oc_scope = remove -sp_after_oc_colon = remove -sp_before_oc_colon = remove -sp_after_oc_dict_colon = force -sp_before_oc_dict_colon = remove -sp_after_send_oc_colon = remove -sp_before_send_oc_colon = remove -sp_after_oc_type = remove -sp_after_oc_return_type = remove -sp_after_oc_at_sel = remove -sp_after_oc_at_sel_parens = force -sp_inside_oc_at_sel_parens = remove -sp_before_oc_block_caret = force -sp_after_oc_block_caret = remove -sp_after_oc_msg_receiver = force -sp_after_oc_property = force -sp_cond_colon = force -sp_cond_question = force -sp_case_label = force -sp_range = ignore -sp_after_for_colon = ignore -sp_before_for_colon = ignore -sp_extern_paren = remove -sp_cmt_cpp_start = ignore -sp_endif_cmt = force -sp_after_new = force -sp_before_tr_emb_cmt = force -sp_num_before_tr_emb_cmt = 1 -sp_annotation_paren = ignore -align_keep_tabs = false -align_with_tabs = false -align_on_tabstop = false -align_number_left = false -align_keep_extra_space = false -align_func_params = true -align_same_func_call_params = false -align_var_def_span = 0 -align_var_def_star_style = 1 -align_var_def_amp_style = 1 -align_var_def_thresh = 0 -align_var_def_gap = 0 -align_var_def_colon = true -align_var_def_attribute = true -align_var_def_inline = true -align_assign_span = 1 -align_assign_thresh = 0 -align_enum_equ_span = 1 -align_enum_equ_thresh = 0 -align_var_struct_span = 1 -align_var_struct_thresh = 0 -align_var_struct_gap = 1 -align_struct_init_span = 2 -align_typedef_gap = 1 -align_typedef_span = 2 -align_typedef_func = 0 -align_typedef_star_style = 1 -align_typedef_amp_style = 1 -align_right_cmt_span = 2 -align_right_cmt_mix = false -align_right_cmt_gap = 1 -align_right_cmt_at_col = 1 -align_func_proto_span = 2 -align_func_proto_gap = 1 -align_on_operator = true -align_mix_var_proto = true -align_single_line_func = true -align_single_line_brace = true -align_single_line_brace_gap = 1 -align_oc_msg_spec_span = 0 -align_nl_cont = false -align_pp_define_together = false -align_pp_define_gap = 1 -align_pp_define_span = 2 -align_left_shift = true -align_oc_msg_colon_span = 16 -align_oc_msg_colon_first = false -align_oc_decl_colon = true -nl_collapse_empty_body = false -nl_assign_leave_one_liners = true -nl_class_leave_one_liners = false -nl_enum_leave_one_liners = true -nl_getset_leave_one_liners = false -nl_func_leave_one_liners = true -nl_cpp_lambda_leave_one_liners = false -nl_if_leave_one_liners = false -nl_oc_msg_leave_one_liner = false -nl_start_of_file = remove -nl_start_of_file_min = 0 -nl_end_of_file = force -nl_end_of_file_min = 1 -nl_assign_brace = remove -nl_assign_square = ignore -nl_after_square_assign = ignore -nl_func_var_def_blk = 1 -nl_typedef_blk_start = 0 -nl_typedef_blk_end = 0 -nl_typedef_blk_in = 0 -nl_var_def_blk_start = 0 -nl_var_def_blk_end = 0 -nl_var_def_blk_in = 0 -nl_fcall_brace = force -nl_enum_brace = remove -nl_struct_brace = remove -nl_union_brace = remove -nl_if_brace = remove -nl_brace_else = force -nl_elseif_brace = remove -nl_else_brace = remove -nl_else_if = remove -nl_brace_finally = force -nl_finally_brace = remove -nl_try_brace = remove -nl_getset_brace = force -nl_for_brace = remove -nl_catch_brace = remove -nl_brace_catch = force -nl_while_brace = remove -nl_scope_brace = ignore -nl_unittest_brace = ignore -nl_version_brace = ignore -nl_using_brace = ignore -nl_brace_brace = force -nl_do_brace = remove -nl_brace_while = force -nl_switch_brace = remove -nl_multi_line_cond = false -nl_multi_line_define = false -nl_before_case = true -nl_before_throw = force -nl_after_case = true -nl_case_colon_brace = force -nl_namespace_brace = force -nl_template_class = force -nl_class_brace = force -nl_class_init_args = force -nl_func_type_name = remove -nl_func_type_name_class = ignore -nl_func_scope_name = remove -nl_func_proto_type_name = remove -nl_func_paren = remove -nl_func_def_paren = ignore -nl_func_decl_start = remove -nl_func_def_start = ignore -nl_func_decl_start_single = ignore -nl_func_def_start_single = ignore -nl_func_decl_args = ignore -nl_func_def_args = ignore -nl_func_decl_end = ignore -nl_func_def_end = ignore -nl_func_decl_end_single = ignore -nl_func_def_end_single = ignore -nl_func_decl_empty = ignore -nl_func_def_empty = ignore -nl_oc_msg_args = false -nl_fdef_brace = force -nl_cpp_ldef_brace = ignore -nl_return_expr = remove -nl_after_semicolon = true -nl_after_brace_open = true -nl_after_brace_open_cmt = false -nl_after_vbrace_open = true -nl_after_vbrace_open_empty = false -nl_after_brace_close = false -nl_after_vbrace_close = false -nl_brace_struct_var = force -nl_define_macro = false -nl_squeeze_ifdef = true -nl_before_if = ignore -nl_after_if = ignore -nl_before_for = ignore -nl_after_for = ignore -nl_before_while = ignore -nl_after_while = ignore -nl_before_switch = ignore -nl_after_switch = ignore -nl_before_do = ignore -nl_after_do = ignore -nl_ds_struct_enum_cmt = false -nl_ds_struct_enum_close_brace = false -nl_class_colon = remove -nl_create_if_one_liner = true -nl_create_for_one_liner = false -nl_create_while_one_liner = false -pos_arith = trail -pos_assign = trail -pos_bool = trail -pos_compare = trail -pos_conditional = trail -pos_comma = trail -pos_class_comma = trail -pos_class_colon = trail -code_width = 0 -ls_for_split_full = true -ls_func_split_full = true -ls_code_width = false -nl_max = 2 -nl_after_func_proto = 1 -nl_after_func_proto_group = 2 -nl_after_func_body = 2 -nl_after_func_body_class = 0 -nl_after_func_body_one_liner = 1 -nl_before_block_comment = 2 -nl_before_c_comment = 2 -nl_before_cpp_comment = 1 -nl_after_multiline_comment = false -nl_after_struct = 0 -nl_after_class = 0 -nl_before_access_spec = 2 -nl_after_access_spec = 1 -nl_comment_func_def = 1 -nl_after_try_catch_finally = 1 -nl_around_cs_property = 1 -nl_between_get_set = 1 -nl_property_brace = ignore -eat_blanks_after_open_brace = true -eat_blanks_before_close_brace = true -nl_remove_extra_newlines = 0 -nl_before_return = false -nl_after_return = true -nl_after_annotation = ignore -nl_between_annotation = ignore -mod_full_brace_do = force -mod_full_brace_for = force -mod_full_brace_function = force -mod_full_brace_if = force -mod_full_brace_if_chain = false -mod_full_brace_nl = 1 -mod_full_brace_while = force -mod_full_brace_using = ignore -mod_paren_on_return = remove -mod_pawn_semicolon = true -mod_full_paren_if_bool = true -mod_remove_extra_semicolon = true -mod_add_long_function_closebrace_comment = 0 +# Uncrustify_d-0.70.1 +newlines = auto +input_tab_size = 4 +output_tab_size = 4 +string_escape_char = 92 +string_escape_char2 = 0 +string_replace_tab_chars = false +tok_split_gte = false +disable_processing_cmt = "" +enable_processing_cmt = "" +enable_digraphs = false +utf8_bom = remove +utf8_byte = false +utf8_force = false +sp_do_brace_open = ignore +sp_brace_close_while = ignore +sp_while_paren_open = ignore +sp_arith = force +sp_arith_additive = ignore +sp_assign = force +sp_cpp_lambda_assign = ignore +sp_cpp_lambda_square_paren = ignore +sp_cpp_lambda_square_brace = ignore +sp_cpp_lambda_paren_brace = ignore +sp_cpp_lambda_fparen = ignore +sp_assign_default = force +sp_before_assign = ignore +sp_after_assign = ignore +sp_enum_paren = force +sp_enum_assign = force +sp_enum_before_assign = ignore +sp_enum_after_assign = ignore +sp_enum_colon = ignore +sp_pp_concat = force +sp_pp_stringify = remove +sp_before_pp_stringify = ignore +sp_bool = force +sp_compare = force +sp_inside_paren = remove +sp_paren_paren = remove +sp_cparen_oparen = remove +sp_balance_nested_parens = false +sp_paren_brace = force +sp_brace_brace = force +sp_before_ptr_star = force +sp_before_unnamed_ptr_star = force +sp_between_ptr_star = remove +sp_after_ptr_star = remove +sp_after_ptr_block_caret = remove +sp_after_ptr_star_qualifier = remove +sp_after_ptr_star_func = remove +sp_ptr_star_paren = remove +sp_before_ptr_star_func = force +sp_before_byref = force +sp_before_unnamed_byref = force +sp_after_byref = remove +sp_after_byref_func = remove +sp_before_byref_func = force +sp_after_type = force +sp_after_decltype = ignore +sp_before_template_paren = ignore +sp_template_angle = force +sp_before_angle = remove +sp_inside_angle = remove +sp_inside_angle_empty = remove +sp_angle_colon = ignore +sp_after_angle = remove +sp_angle_paren = remove +sp_angle_paren_empty = remove +sp_angle_word = force +sp_angle_shift = add +sp_permit_cpp11_shift = false +sp_before_sparen = force +sp_inside_sparen = force +sp_inside_sparen_open = ignore +sp_inside_sparen_close = ignore +sp_after_sparen = force +sp_sparen_brace = force +sp_invariant_paren = ignore +sp_after_invariant_paren = ignore +sp_special_semi = force +sp_before_semi = remove +sp_before_semi_for = remove +sp_before_semi_for_empty = remove +sp_after_semi = force +sp_after_semi_for = force +sp_after_semi_for_empty = force +sp_before_square = remove +sp_before_vardef_square = remove +sp_before_square_asm_block = ignore +sp_before_squares = remove +sp_cpp_before_struct_binding = remove +sp_inside_square = remove +sp_inside_square_oc_array = remove +sp_after_comma = force +sp_before_comma = remove +sp_after_mdatype_commas = remove +sp_before_mdatype_commas = remove +sp_between_mdatype_commas = remove +sp_paren_comma = force +sp_before_ellipsis = remove +sp_type_ellipsis = remove +sp_type_question = remove +sp_paren_ellipsis = remove +sp_paren_qualifier = remove +sp_paren_noexcept = remove +sp_after_class_colon = force +sp_before_class_colon = force +sp_after_constr_colon = remove +sp_before_constr_colon = remove +sp_before_case_colon = remove +sp_after_operator = remove +sp_after_operator_sym = force +sp_after_operator_sym_empty = ignore +sp_after_cast = remove +sp_inside_paren_cast = remove +sp_cpp_cast_paren = remove +sp_sizeof_paren = remove +sp_sizeof_ellipsis = remove +sp_sizeof_ellipsis_paren = remove +sp_decltype_paren = remove +sp_after_tag = remove +sp_inside_braces_enum = remove +sp_inside_braces_struct = remove +sp_inside_braces_oc_dict = force +sp_after_type_brace_init_lst_open = ignore +sp_before_type_brace_init_lst_close = ignore +sp_inside_type_brace_init_lst = ignore +sp_inside_braces = force +sp_inside_braces_empty = remove +sp_trailing_return = remove +sp_type_func = force +sp_type_brace_init_lst = ignore +sp_func_proto_paren = remove +sp_func_proto_paren_empty = remove +sp_func_type_paren = remove +sp_func_def_paren = remove +sp_func_def_paren_empty = remove +sp_inside_fparens = remove +sp_inside_fparen = remove +sp_inside_tparen = remove +sp_after_tparen_close = remove +sp_square_fparen = remove +sp_fparen_brace = force +sp_fparen_brace_initializer = force +sp_fparen_dbrace = force +sp_func_call_paren = remove +sp_func_call_paren_empty = remove +sp_func_call_user_paren = remove +sp_func_call_user_inside_fparen = remove +sp_func_call_user_paren_paren = remove +sp_func_class_paren = remove +sp_func_class_paren_empty = remove +sp_return_paren = force +sp_return_brace = force +sp_attribute_paren = remove +sp_defined_paren = remove +sp_throw_paren = force +sp_after_throw = force +sp_catch_paren = force +sp_oc_catch_paren = force +sp_oc_classname_paren = force +sp_version_paren = ignore +sp_scope_paren = ignore +sp_super_paren = remove +sp_this_paren = remove +sp_macro = force +sp_macro_func = force +sp_else_brace = force +sp_brace_else = force +sp_brace_typedef = force +sp_catch_brace = force +sp_oc_catch_brace = force +sp_brace_catch = force +sp_oc_brace_catch = force +sp_finally_brace = force +sp_brace_finally = force +sp_try_brace = force +sp_getset_brace = force +sp_word_brace = add +sp_word_brace_ns = add +sp_before_dc = remove +sp_after_dc = remove +sp_d_array_colon = remove +sp_not = remove +sp_inv = remove +sp_addr = remove +sp_member = remove +sp_deref = remove +sp_sign = remove +sp_incdec = remove +sp_before_nl_cont = force +sp_after_oc_scope = remove +sp_after_oc_colon = remove +sp_before_oc_colon = remove +sp_after_oc_dict_colon = force +sp_before_oc_dict_colon = remove +sp_after_send_oc_colon = remove +sp_before_send_oc_colon = remove +sp_after_oc_type = remove +sp_after_oc_return_type = remove +sp_after_oc_at_sel = remove +sp_after_oc_at_sel_parens = force +sp_inside_oc_at_sel_parens = remove +sp_before_oc_block_caret = force +sp_after_oc_block_caret = remove +sp_after_oc_msg_receiver = force +sp_after_oc_property = force +sp_after_oc_synchronized = force +sp_cond_colon = force +sp_cond_colon_before = ignore +sp_cond_colon_after = ignore +sp_cond_question = force +sp_cond_question_before = ignore +sp_cond_question_after = ignore +sp_cond_ternary_short = ignore +sp_case_label = force +sp_range = ignore +sp_after_for_colon = ignore +sp_before_for_colon = ignore +sp_extern_paren = remove +sp_cmt_cpp_start = force +sp_cmt_cpp_doxygen = true +sp_cmt_cpp_qttr = false +sp_endif_cmt = force +sp_after_new = force +sp_between_new_paren = ignore +sp_after_newop_paren = ignore +sp_inside_newop_paren = ignore +sp_inside_newop_paren_open = ignore +sp_inside_newop_paren_close = ignore +sp_before_tr_emb_cmt = force +sp_num_before_tr_emb_cmt = 1 +sp_annotation_paren = ignore +sp_skip_vbrace_tokens = false +sp_after_noexcept = ignore +sp_vala_after_translation = ignore +force_tab_after_define = false +indent_columns = 4 +indent_continue = 0 +indent_continue_class_head = 0 +indent_single_newlines = false +indent_param = 0 +indent_with_tabs = 0 +indent_cmt_with_tabs = false +indent_align_string = true +indent_xml_string = 4 +indent_brace = 0 +indent_braces = false +indent_braces_no_func = false +indent_braces_no_class = false +indent_braces_no_struct = false +indent_brace_parent = false +indent_paren_open_brace = false +indent_cs_delegate_brace = false +indent_cs_delegate_body = false +indent_namespace = false +indent_namespace_single_indent = false +indent_namespace_level = 0 +indent_namespace_limit = 0 +indent_extern = false +indent_class = true +indent_class_colon = false +indent_class_on_colon = false +indent_constr_colon = false +indent_ctor_init_leading = 2 +indent_ctor_init = 0 +indent_else_if = false +indent_var_def_blk = 0 +indent_var_def_cont = false +indent_shift = false +indent_func_def_force_col1 = false +indent_func_call_param = false +indent_func_def_param = false +indent_func_def_param_paren_pos_threshold = 0 +indent_func_proto_param = false +indent_func_class_param = false +indent_func_ctor_var_param = false +indent_template_param = false +indent_func_param_double = false +indent_func_const = 1 +indent_func_throw = 1 +indent_macro_brace = true +indent_member = 1 +indent_member_single = false +indent_sing_line_comments = 0 +indent_relative_single_line_comments = true +indent_switch_case = 4 +indent_switch_break_with_case = false +indent_switch_pp = true +indent_case_shift = 0 +indent_case_brace = 0 +indent_col1_comment = false +indent_col1_multi_string_literal = false +indent_label = 1 +indent_access_spec = 1 +indent_access_spec_body = false +indent_paren_nl = false +indent_paren_close = 1 +indent_paren_after_func_def = false +indent_paren_after_func_decl = false +indent_paren_after_func_call = false +indent_comma_paren = false +indent_bool_paren = false +indent_semicolon_for_paren = false +indent_first_bool_expr = false +indent_first_for_expr = false +indent_square_nl = false +indent_preserve_sql = true +indent_align_assign = true +indent_align_paren = true +indent_oc_block = true +indent_oc_block_msg = 0 +indent_oc_msg_colon = 0 +indent_oc_msg_prioritize_first_colon = true +indent_oc_block_msg_xcode_style = false +indent_oc_block_msg_from_keyword = false +indent_oc_block_msg_from_colon = false +indent_oc_block_msg_from_caret = false +indent_oc_block_msg_from_brace = false +indent_min_vbrace_open = 0 +indent_vbrace_open_on_tabstop = false +indent_token_after_brace = true +indent_cpp_lambda_body = false +indent_using_block = true +indent_ternary_operator = 0 +indent_off_after_return_new = false +indent_single_after_return = false +indent_ignore_asm_block = false +nl_collapse_empty_body = false +nl_assign_leave_one_liners = true +nl_class_leave_one_liners = false +nl_enum_leave_one_liners = true +nl_getset_leave_one_liners = false +nl_cs_property_leave_one_liners = true +nl_func_leave_one_liners = true +nl_cpp_lambda_leave_one_liners = false +nl_if_leave_one_liners = false +nl_while_leave_one_liners = false +nl_for_leave_one_liners = false +nl_oc_msg_leave_one_liner = false +nl_oc_mdef_brace = force +nl_oc_block_brace = remove +nl_oc_before_interface = force +nl_oc_before_implementation = force +nl_oc_before_end = force +nl_oc_interface_brace = force +nl_oc_implementation_brace = force +nl_start_of_file = remove +nl_start_of_file_min = 0 +nl_end_of_file = force +nl_end_of_file_min = 1 +nl_assign_brace = remove +nl_assign_square = ignore +nl_tsquare_brace = ignore +nl_after_square_assign = ignore +nl_fcall_brace = force +nl_enum_brace = remove +nl_enum_class = ignore +nl_enum_class_identifier = ignore +nl_enum_identifier_colon = ignore +nl_enum_colon_type = ignore +nl_struct_brace = remove +nl_union_brace = remove +nl_if_brace = remove +nl_brace_else = force +nl_elseif_brace = remove +nl_else_brace = remove +nl_else_if = remove +nl_before_if_closing_paren = ignore +nl_brace_finally = force +nl_finally_brace = remove +nl_try_brace = remove +nl_getset_brace = force +nl_for_brace = remove +nl_catch_brace = remove +nl_oc_catch_brace = remove +nl_brace_catch = force +nl_oc_brace_catch = force +nl_brace_square = remove +nl_brace_fparen = remove +nl_while_brace = remove +nl_scope_brace = ignore +nl_unittest_brace = ignore +nl_version_brace = ignore +nl_using_brace = ignore +nl_brace_brace = force +nl_do_brace = remove +nl_brace_while = force +nl_switch_brace = remove +nl_synchronized_brace = remove +nl_multi_line_cond = false +nl_multi_line_sparen_open = ignore +nl_multi_line_sparen_close = ignore +nl_multi_line_define = false +nl_before_case = true +nl_after_case = true +nl_case_colon_brace = force +nl_before_throw = force +nl_namespace_brace = force +nl_template_class = force +nl_template_class_decl = force +nl_template_class_decl_special = force +nl_template_class_def = force +nl_template_class_def_special = force +nl_template_func = force +nl_template_func_decl = ignore +nl_template_func_decl_special = ignore +nl_template_func_def = force +nl_template_func_def_special = force +nl_template_var = ignore +nl_template_using = ignore +nl_class_brace = force +nl_class_init_args = force +nl_constr_init_args = ignore +nl_enum_own_lines = ignore +nl_func_type_name = remove +nl_func_type_name_class = ignore +nl_func_class_scope = ignore +nl_func_scope_name = remove +nl_func_proto_type_name = remove +nl_func_paren = remove +nl_func_paren_empty = ignore +nl_func_def_paren = remove +nl_func_def_paren_empty = ignore +nl_func_call_paren = ignore +nl_func_call_paren_empty = ignore +nl_func_decl_start = remove +nl_func_def_start = remove +nl_func_decl_start_single = ignore +nl_func_def_start_single = ignore +nl_func_decl_start_multi_line = false +nl_func_def_start_multi_line = false +nl_func_decl_args = ignore +nl_func_def_args = ignore +nl_func_decl_args_multi_line = false +nl_func_def_args_multi_line = false +nl_func_decl_end = remove +nl_func_def_end = remove +nl_func_decl_end_single = ignore +nl_func_def_end_single = ignore +nl_func_decl_end_multi_line = false +nl_func_def_end_multi_line = false +nl_func_decl_empty = remove +nl_func_def_empty = remove +nl_func_call_empty = ignore +nl_func_call_start = ignore +nl_func_call_start_multi_line = false +nl_func_call_args_multi_line = false +nl_func_call_end_multi_line = false +nl_template_start = false +nl_template_args = false +nl_template_end = false +nl_oc_msg_args = false +nl_fdef_brace = force +nl_fdef_brace_cond = force +nl_cpp_ldef_brace = ignore +nl_return_expr = remove +nl_after_semicolon = true +nl_paren_dbrace_open = ignore +nl_type_brace_init_lst = ignore +nl_type_brace_init_lst_open = ignore +nl_type_brace_init_lst_close = ignore +nl_after_brace_open = true +nl_after_brace_open_cmt = false +nl_after_vbrace_open = true +nl_after_vbrace_open_empty = false +nl_after_brace_close = false +nl_after_vbrace_close = false +nl_brace_struct_var = force +nl_define_macro = false +nl_squeeze_paren_close = false +nl_squeeze_ifdef = true +nl_squeeze_ifdef_top_level = false +nl_before_if = ignore +nl_after_if = ignore +nl_before_for = ignore +nl_after_for = ignore +nl_before_while = ignore +nl_after_while = ignore +nl_before_switch = ignore +nl_after_switch = ignore +nl_before_synchronized = ignore +nl_after_synchronized = ignore +nl_before_do = ignore +nl_after_do = ignore +nl_before_return = false +nl_after_return = true +nl_before_member = ignore +nl_after_member = ignore +nl_ds_struct_enum_cmt = false +nl_ds_struct_enum_close_brace = false +nl_class_colon = remove +nl_constr_colon = ignore +nl_namespace_two_to_one_liner = false +nl_create_if_one_liner = true +nl_create_for_one_liner = false +nl_create_while_one_liner = false +nl_create_func_def_one_liner = false +nl_create_list_one_liner = false +nl_split_if_one_liner = false +nl_split_for_one_liner = false +nl_split_while_one_liner = false +nl_max = 2 +nl_max_blank_in_func = 0 +nl_before_func_body_proto = 0 +nl_before_func_body_def = 0 +nl_before_func_class_proto = 0 +nl_before_func_class_def = 0 +nl_after_func_proto = 1 +nl_after_func_proto_group = 2 +nl_after_func_class_proto = 0 +nl_after_func_class_proto_group = 0 +nl_class_leave_one_liner_groups = false +nl_after_func_body = 2 +nl_after_func_body_class = 0 +nl_after_func_body_one_liner = 1 +nl_func_var_def_blk = 1 +nl_typedef_blk_start = 0 +nl_typedef_blk_end = 0 +nl_typedef_blk_in = 0 +nl_var_def_blk_start = 0 +nl_var_def_blk_end = 0 +nl_var_def_blk_in = 0 +nl_before_block_comment = 2 +nl_before_c_comment = 2 +nl_before_cpp_comment = 1 +nl_after_multiline_comment = false +nl_after_label_colon = false +nl_after_struct = 0 +nl_before_class = 0 +nl_after_class = 0 +nl_before_namespace = 0 +nl_inside_namespace = 0 +nl_after_namespace = 0 +nl_before_access_spec = 2 +nl_after_access_spec = 1 +nl_comment_func_def = 1 +nl_after_try_catch_finally = 1 +nl_around_cs_property = 1 +nl_between_get_set = 1 +nl_property_brace = ignore +eat_blanks_after_open_brace = true +eat_blanks_before_close_brace = true +nl_remove_extra_newlines = 0 +nl_after_annotation = ignore +nl_between_annotation = ignore +pos_arith = trail +pos_assign = trail +pos_bool = trail +pos_compare = trail +pos_conditional = trail +pos_comma = trail +pos_enum_comma = ignore +pos_class_comma = trail +pos_constr_comma = ignore +pos_class_colon = trail +pos_constr_colon = ignore +code_width = 0 +ls_for_split_full = true +ls_func_split_full = true +ls_code_width = false +align_keep_tabs = false +align_with_tabs = false +align_on_tabstop = false +align_number_right = false +align_keep_extra_space = false +align_func_params = true +align_func_params_span = 0 +align_func_params_thresh = 0 +align_func_params_gap = 0 +align_constr_value_span = 0 +align_constr_value_thresh = 0 +align_constr_value_gap = 0 +align_same_func_call_params = false +align_same_func_call_params_span = 0 +align_same_func_call_params_thresh = 0 +align_var_def_span = 0 +align_var_def_star_style = 1 +align_var_def_amp_style = 1 +align_var_def_thresh = 0 +align_var_def_gap = 0 +align_var_def_colon = true +align_var_def_colon_gap = 0 +align_var_def_attribute = true +align_var_def_inline = true +align_assign_span = 1 +align_assign_func_proto_span = 0 +align_assign_thresh = 0 +align_assign_decl_func = 0 +align_enum_equ_span = 1 +align_enum_equ_thresh = 0 +align_var_class_span = 0 +align_var_class_thresh = 0 +align_var_class_gap = 0 +align_var_struct_span = 1 +align_var_struct_thresh = 0 +align_var_struct_gap = 1 +align_struct_init_span = 2 +align_typedef_span = 2 +align_typedef_gap = 1 +align_typedef_func = 0 +align_typedef_star_style = 1 +align_typedef_amp_style = 1 +align_right_cmt_span = 2 +align_right_cmt_gap = 1 +align_right_cmt_mix = false +align_right_cmt_same_level = false +align_right_cmt_at_col = 1 +align_func_proto_span = 2 +align_func_proto_thresh = 0 +align_func_proto_gap = 1 +align_on_operator = true +align_mix_var_proto = true +align_single_line_func = true +align_single_line_brace = true +align_single_line_brace_gap = 1 +align_oc_msg_spec_span = 0 +align_nl_cont = false +align_pp_define_together = false +align_pp_define_span = 2 +align_pp_define_gap = 1 +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 +cmt_width = 0 +cmt_reflow_mode = 0 +cmt_convert_tab_to_spaces = true +cmt_indent_multi = true +cmt_c_group = true +cmt_c_nl_start = true +cmt_c_nl_end = true +cmt_cpp_to_c = false +cmt_cpp_group = true +cmt_cpp_nl_start = true +cmt_cpp_nl_end = true +cmt_star_cont = true +cmt_sp_before_star_cont = 0 +cmt_sp_after_star_cont = 0 +cmt_multi_check_last = true +cmt_multi_first_len_minimum = 4 +cmt_insert_file_header = "" +cmt_insert_file_footer = "" +cmt_insert_func_header = "" +cmt_insert_class_header = "" +cmt_insert_oc_msg_header = "" +cmt_insert_before_preproc = false +cmt_insert_before_inlines = true +cmt_insert_before_ctor_dtor = false +mod_full_brace_do = force +mod_full_brace_for = force +mod_full_brace_function = force +mod_full_brace_if = force +mod_full_brace_if_chain = false +mod_full_brace_if_chain_only = false +mod_full_brace_while = force +mod_full_brace_using = ignore +mod_full_brace_nl = 1 +mod_full_brace_nl_block_rem_mlcond = false +mod_paren_on_return = remove +mod_pawn_semicolon = true +mod_full_paren_if_bool = true +mod_remove_extra_semicolon = true +mod_add_long_function_closebrace_comment = 0 mod_add_long_namespace_closebrace_comment = 0 -mod_add_long_switch_closebrace_comment = 0 -mod_add_long_ifdef_endif_comment = 0 -mod_add_long_ifdef_else_comment = 0 -mod_sort_import = true -mod_sort_using = false -mod_sort_include = true -mod_move_case_break = false -mod_case_brace = remove -mod_remove_empty_return = true -cmt_width = 0 -cmt_reflow_mode = 0 -cmt_indent_multi = true -cmt_c_group = true -cmt_c_nl_start = true -cmt_c_nl_end = true -cmt_cpp_group = true -cmt_cpp_nl_start = true -cmt_cpp_nl_end = true -cmt_cpp_to_c = false -cmt_star_cont = true -cmt_sp_before_star_cont = 0 -cmt_sp_after_star_cont = 0 -cmt_multi_check_last = true -cmt_insert_file_header = "" -cmt_insert_file_footer = "" -cmt_insert_func_header = "" -cmt_insert_class_header = "" -cmt_insert_oc_msg_header = "" -cmt_insert_before_preproc = false -pp_indent = force -pp_indent_at_level = false -pp_indent_count = 0 -pp_space = remove -pp_space_count = 0 -pp_indent_region = 0 -pp_region_indent_code = false -pp_indent_if = 0 -pp_if_indent_code = false -pp_define_at_level = false +mod_add_long_class_closebrace_comment = 0 +mod_add_long_switch_closebrace_comment = 0 +mod_add_long_ifdef_endif_comment = 0 +mod_add_long_ifdef_else_comment = 0 +mod_sort_case_sensitive = false +mod_sort_import = true +mod_sort_using = false +mod_sort_include = true +mod_move_case_break = false +mod_case_brace = remove +mod_remove_empty_return = true +mod_enum_last_comma = remove +mod_sort_oc_properties = false +mod_sort_oc_property_class_weight = 0 +mod_sort_oc_property_thread_safe_weight = 0 +mod_sort_oc_property_readwrite_weight = 0 +mod_sort_oc_property_reference_weight = 0 +mod_sort_oc_property_getter_weight = 0 +mod_sort_oc_property_setter_weight = 0 +mod_sort_oc_property_nullability_weight = 0 +pp_indent = force +pp_indent_at_level = false +pp_indent_count = 0 +pp_space = remove +pp_space_count = 0 +pp_indent_region = 0 +pp_region_indent_code = false +pp_indent_if = 0 +pp_if_indent_code = false +pp_define_at_level = false +pp_ignore_define_body = false +pp_indent_case = true +pp_indent_func_def = true +pp_indent_extern = true +pp_indent_brace = true +include_category_0 = "" +include_category_1 = "" +include_category_2 = "" +use_indent_func_call_param = true +use_indent_continue_only_once = false +indent_cpp_lambda_only_once = false +use_sp_after_angle_always = false +use_options_overriding_for_qt_macros = true +warn_level_tabs_found_in_verbatim_string_literals = 2 +# option(s) with 'not default' value: 332 +#