diff --git a/Classes/BEMAverageLine.m b/Classes/BEMAverageLine.m index 585b19e..6e1229b 100644 --- a/Classes/BEMAverageLine.m +++ b/Classes/BEMAverageLine.m @@ -22,8 +22,7 @@ - (instancetype)init { return self; } -- (instancetype) initWithCoder:(NSCoder *)coder { - +- (instancetype)initWithCoder:(NSCoder *)coder { #define RestoreProperty(property, type) {\ if ([coder containsValueForKey:@#property]) { \ self.property = [coder decode ## type ##ForKey:@#property ]; \ @@ -32,7 +31,6 @@ - (instancetype) initWithCoder:(NSCoder *)coder { self = [self init]; #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wnullable-to-nonnull-conversion" - RestoreProperty (enableAverageLine, Bool); RestoreProperty (color, Object); RestoreProperty (yValue, Double); @@ -42,12 +40,10 @@ - (instancetype) initWithCoder:(NSCoder *)coder { RestoreProperty (title, Object); #pragma clang diagnostic pop - //AverageLine return self; } -- (void) encodeWithCoder: (NSCoder *)coder { - +- (void)encodeWithCoder:(NSCoder *)coder { #define EncodeProperty(property, type) [coder encode ## type: self.property forKey:@#property] EncodeProperty (enableAverageLine, Bool); EncodeProperty (color, Object); @@ -58,8 +54,6 @@ - (void) encodeWithCoder: (NSCoder *)coder { EncodeProperty (title, Object); } - - - (void)setLabel:(UILabel *)label { if (_label != label) { [_label removeFromSuperview]; @@ -68,6 +62,7 @@ - (void)setLabel:(UILabel *)label { } - (void)dealloc { - self.label= nil; + self.label = nil; } + @end diff --git a/Classes/BEMSimpleLineGraphView.m b/Classes/BEMSimpleLineGraphView.m index 0dbb997..2cb7bfa 100644 --- a/Classes/BEMSimpleLineGraphView.m +++ b/Classes/BEMSimpleLineGraphView.m @@ -125,13 +125,13 @@ @implementation BEMSimpleLineGraphView // MARK: - Initialization -- (instancetype) initWithFrame:(CGRect)frame { +- (instancetype)initWithFrame:(CGRect)frame { self = [super initWithFrame:frame]; if (self) [self commonInit]; return self; } -- (instancetype) initWithCoder:(NSCoder *)coder { +- (instancetype)initWithCoder:(NSCoder *)coder { self = [super initWithCoder:coder]; if (self) [self commonInit]; [self restorePropertyWithCoder:coder]; @@ -202,7 +202,7 @@ - (void)encodeRestorableStateWithCoder:(NSCoder *)coder { [self encodePropertiesWithCoder:coder]; } -- (void)encodeWithCoder: (NSCoder *)coder { +- (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; [self encodePropertiesWithCoder:coder]; } @@ -515,7 +515,7 @@ - (CGFloat)labelWidthForValue:(CGFloat)value { return [labelString sizeWithAttributes:attributes].width; } -- (CGFloat) calculateWidestLabel { +- (CGFloat)calculateWidestLabel { NSDictionary *attributes = @{NSFontAttributeName: self.labelFont}; CGFloat widestNumber; if (self.autoScaleYAxis == YES){ @@ -570,7 +570,6 @@ - (BEMCircle *)circleDotAtIndex:(NSUInteger)index forValue:(CGFloat)dotValue reu } - (void)drawDots { - // Remove all data points before adding them to the array [dataPoints removeAllObjects]; diff --git a/Sample Project/SimpleLineChart.xcodeproj/project.pbxproj b/Sample Project/SimpleLineChart.xcodeproj/project.pbxproj index 1481fb1..8097671 100644 --- a/Sample Project/SimpleLineChart.xcodeproj/project.pbxproj +++ b/Sample Project/SimpleLineChart.xcodeproj/project.pbxproj @@ -254,8 +254,8 @@ C3B90A59187D15F7003E407D /* BEMCircle.m */, C3B90A5A187D15F7003E407D /* BEMLine.h */, C3B90A5B187D15F7003E407D /* BEMLine.m */, - A63990B41AD4923900B14D88 /* BEMAverageLine.m */, A63990B31AD4923900B14D88 /* BEMAverageLine.h */, + A63990B41AD4923900B14D88 /* BEMAverageLine.m */, A6AC89591C5882DD0052AB1C /* BEMGraphCalculator.h */, A6AC895A1C5882DD0052AB1C /* BEMGraphCalculator.m */, );