Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

Kellyroach/upgrade to xcode941 #307

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 64 additions & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,68 @@
# Adapted from https://github.com/github/gitignore/blob/master/Objective-C.gitignore

# Finder
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

# Xcode
## Build generated
build/
DerivedData/

## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.xcuserstate

*.xcuserstate
## Other
*.moved-aside
*.xccheckout
*.xcscmblueprint

## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control

Pods/

# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build

# fastlane
#
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
# screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

*.xcuserstate
iOSInjectionProject/
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode7
osx_image: xcode9.4
# xcode_project: Sample Project/SimpleLineChart.xcodeproj
# xcode_scheme: SimpleLineChartTests
# xcode_sdk: iphonesimulator
Expand Down
4 changes: 4 additions & 0 deletions Classes/BEMSimpleLineGraphView.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,12 @@ IB_DESIGNABLE @interface BEMSimpleLineGraphView : UIView <UIGestureRecognizerDel
/// Alpha of the bottom part of the graph (between the line and the X-axis).
@property (nonatomic) IBInspectable CGFloat alphaBottom;

NS_ASSUME_NONNULL_END

/// Fill gradient of the bottom part of the graph (between the line and the X-axis). When set, it will draw a gradient over top of the fill provided by the \p colorBottom and \p alphaBottom properties.
@property (assign, nonatomic) CGGradientRef gradientBottom;

NS_ASSUME_NONNULL_BEGIN

/// Color of the top part of the graph (between the line and the top of the view the graph is drawn in).
@property (strong, nonatomic) IBInspectable UIColor *colorTop;
Expand All @@ -245,10 +247,12 @@ IB_DESIGNABLE @interface BEMSimpleLineGraphView : UIView <UIGestureRecognizerDel
/// Alpha of the top part of the graph (between the line and the top of the view the graph is drawn in).
@property (nonatomic) IBInspectable CGFloat alphaTop;

NS_ASSUME_NONNULL_END

/// Fill gradient of the top part of the graph (between the line and the top of the view the graph is drawn in). When set, it will draw a gradient over top of the fill provided by the \p colorTop and \p alphaTop properties.
@property (assign, nonatomic) CGGradientRef gradientTop;

NS_ASSUME_NONNULL_BEGIN

/// Color of the line of the graph.
@property (strong, nonatomic) IBInspectable UIColor *colorLine;
Expand Down
83 changes: 57 additions & 26 deletions Classes/BEMSimpleLineGraphView.m
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,31 @@ - (CGFloat)minValue;

@implementation BEMSimpleLineGraphView

#pragma mark - Initialization
#pragma mark - Properties

- (void)setGradientBottom:(CGGradientRef)gradientBottom {
if (_gradientBottom) {
CGGradientRelease(_gradientBottom);
_gradientBottom=nil;
}
if (gradientBottom) {
CGGradientRetain(gradientBottom);
_gradientBottom=gradientBottom;
}
}

- (void)setGradientTop:(CGGradientRef)gradientTop {
if (_gradientTop) {
CGGradientRelease(_gradientTop);
_gradientTop=nil;
}
if (gradientTop) {
CGGradientRetain(gradientTop);
_gradientTop=gradientTop;
}
}

#pragma mark - Life Cycle

- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
Expand Down Expand Up @@ -213,30 +237,13 @@ - (void)prepareForInterfaceBuilder {
[self drawEntireGraph];
}

- (void)drawGraph {
// Let the delegate know that the graph began layout updates
if ([self.delegate respondsToSelector:@selector(lineGraphDidBeginLoading:)])
[self.delegate lineGraphDidBeginLoading:self];

// Get the number of points in the graph
[self layoutNumberOfPoints];

if (numberOfPoints <= 1) {
return;
} else {
// Draw the graph
[self drawEntireGraph];

// Setup the touch report
[self layoutTouchReport];

// Let the delegate know that the graph finished updates
if ([self.delegate respondsToSelector:@selector(lineGraphDidFinishLoading:)])
[self.delegate lineGraphDidFinishLoading:self];
}

- (void)dealloc {
self.gradientBottom = nil;
self.gradientTop = nil;
}

#pragma mark - Layout

- (void)layoutSubviews {
[super layoutSubviews];

Expand Down Expand Up @@ -393,6 +400,30 @@ - (void)layoutTouchReport {

#pragma mark - Drawing

- (void)drawGraph {
// Let the delegate know that the graph began layout updates
if ([self.delegate respondsToSelector:@selector(lineGraphDidBeginLoading:)])
[self.delegate lineGraphDidBeginLoading:self];

// Get the number of points in the graph
[self layoutNumberOfPoints];

if (numberOfPoints <= 1) {
return;
} else {
// Draw the graph
[self drawEntireGraph];

// Setup the touch report
[self layoutTouchReport];

// Let the delegate know that the graph finished updates
if ([self.delegate respondsToSelector:@selector(lineGraphDidFinishLoading:)])
[self.delegate lineGraphDidFinishLoading:self];
}

}

- (void)didFinishDrawingIncludingYAxis:(BOOL)yAxisFinishedDrawing {
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, self.animationGraphEntranceTime * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
if (self.enableYAxisLabel == NO) {
Expand Down Expand Up @@ -785,7 +816,7 @@ - (void)drawXAxis {
if (idx == 0) {
lastMatchIndex = 0;
} else { // Skip first one
UILabel *prevLabel = [xAxisLabels objectAtIndex:lastMatchIndex];
UILabel *prevLabel = [self->xAxisLabels objectAtIndex:lastMatchIndex];
CGRect r = CGRectIntersection(prevLabel.frame, label.frame);
if (CGRectIsNull(r)) lastMatchIndex = idx;
else [overlapLabels addObject:label]; // Overlapped
Expand Down Expand Up @@ -1030,7 +1061,7 @@ - (void)drawYAxis {
BOOL fullyContainsLabel = CGRectContainsRect(self.bounds, label.frame);
if (!fullyContainsLabel) {
[overlapLabels addObject:label];
[yAxisLabelPoints removeObject:@(label.center.y)];
[self->yAxisLabelPoints removeObject:@(label.center.y)];
}
}];

Expand Down Expand Up @@ -1356,7 +1387,7 @@ - (void)handleGestureAction:(UIGestureRecognizer *)recognizer {

[UIView animateWithDuration:0.2 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
if (self.alwaysDisplayDots == NO && self.displayDotsOnly == NO) {
closestDot.alpha = 0;
self->closestDot.alpha = 0;
}

self.touchInputLine.alpha = 0;
Expand Down
22 changes: 19 additions & 3 deletions Sample Project/SimpleLineChart.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@
C3FD814D186DFD9A00FD8ED3 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0800;
LastUpgradeCheck = 0940;
ORGANIZATIONNAME = "Boris Emorine";
TargetAttributes = {
C3FD8175186DFD9A00FD8ED3 = {
Expand Down Expand Up @@ -380,14 +380,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand Down Expand Up @@ -424,14 +432,22 @@
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
Expand All @@ -457,7 +473,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SimpleLineChart/SimpleLineChart-Prefix.pch";
INFOPLIST_FILE = "SimpleLineChart/SimpleLineChart-Info.plist";
Expand All @@ -471,7 +487,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = "";
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "SimpleLineChart/SimpleLineChart-Prefix.pch";
INFOPLIST_FILE = "SimpleLineChart/SimpleLineChart-Info.plist";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0800"
LastUpgradeVersion = "0940"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
18 changes: 11 additions & 7 deletions Sample Project/SimpleLineChart/Base.lproj/Launch Screen.storyboard
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14113" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
<device id="retina5_9" orientation="portrait">
<adaptation id="fullscreen"/>
</device>
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
<capability name="Constraints with non-1.0 multipliers" minToolsVersion="5.1"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
<!--View Controller-->
Expand All @@ -15,17 +19,17 @@
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="812"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="BEMSimpleLineChart" textAlignment="center" lineBreakMode="middleTruncation" baselineAdjustment="alignBaselines" minimumFontSize="18" translatesAutoresizingMaskIntoConstraints="NO" id="GJd-Yh-RWb">
<rect key="frame" x="20" y="180" width="560" height="43"/>
<rect key="frame" x="20" y="250.33333333333337" width="335" height="43"/>
<fontDescription key="fontDescription" type="system" weight="thin" pointSize="36"/>
<color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" red="0.1215686275" green="0.73333333329999995" blue="0.65098039220000004" alpha="1" colorSpace="calibratedRGB"/>
<color key="backgroundColor" red="0.1215686275" green="0.73333333329999995" blue="0.65098039220000004" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
<constraints>
<constraint firstAttribute="centerX" secondItem="GJd-Yh-RWb" secondAttribute="centerX" id="Q3B-4B-g5h"/>
<constraint firstItem="GJd-Yh-RWb" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="bottom" multiplier="1/3" constant="1" id="moa-c2-u7t"/>
Expand Down
Loading