Skip to content

Commit b7641c8

Browse files
committed
2 parents c9d5f86 + d1f4c58 commit b7641c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+204
-164
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,27 @@ This project adheres to [Semantic Versioning](http://semver.org/).
44

55
## [Unreleased]
66

7+
## [0.6.2] - 2018.09.15
8+
- Fix iPad demo crash
9+
- Add missing AppIcon image sizes
10+
- Fix Xcode 10 compilation
11+
- Fix dividing by zero while calculating axis inner frame
12+
- Fill area width fixed: now it is equal to graph line width
13+
- Expose bar views, e.g. to enable highlighting by external events
14+
15+
## [0.6.1] - 2017.12.04
16+
- Fix area chart broken with straight line generator
17+
- Fix unclipped container behind content view, don't mask if there's no clip rect
18+
- Implemented gradient fill for curved areas
19+
- Added support for gradient line charts
20+
- Make candle stick fill colours configurable
21+
- ChartPointViewBarStacked: allowing only rounding some corners
22+
- Make candle stick fill colours configurable, show usage in example
23+
- Fixed 2 leaks setting stackedTapHandler
24+
- Bar chart axis labels now use provided label font and color
25+
- Swift 4 support
26+
- Fix passing incorrect parameter to Zoomable
27+
728
## [0.6] - 2017.04.23
829
- Fix guidelines overlap with axis lines
930
- Fix axis line minor irregularities (fixes #151)

Examples/AppDelegate.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UISplitViewControllerDele
1414
var window: UIWindow?
1515

1616

17-
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
17+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
1818

1919
if UIDevice.current.userInterfaceIdiom == .pad {
2020

Examples/DetailViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ class DetailViewController: UIViewController, UISplitViewControllerDelegate {
114114

115115
fileprivate func showExampleController(_ controller: UIViewController) {
116116
if let currentExampleController = currentExampleController {
117-
currentExampleController.removeFromParentViewController()
117+
currentExampleController.removeFromParent()
118118
currentExampleController.view.removeFromSuperview()
119119
}
120-
addChildViewController(controller)
120+
addChild(controller)
121121
view.addSubview(controller.view)
122122
currentExampleController = controller
123123
}

Examples/Examples/AreasExample.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ class AreasExample: UIViewController, ChartDelegate {
9696
bubbleView.addSubview(infoView)
9797
weakSelf.popups.append(bubbleView)
9898

99-
UIView.animate(withDuration: 0.2, delay: 0, options: UIViewAnimationOptions(), animations: {
99+
UIView.animate(withDuration: 0.2, delay: 0, options: UIView.AnimationOptions(), animations: {
100100
view.selected = true
101101
selectedView = view
102102

@@ -105,7 +105,7 @@ class AreasExample: UIViewController, ChartDelegate {
105105
}
106106
}
107107

108-
UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: UIViewAnimationOptions(), animations: {
108+
UIView.animate(withDuration: 0.7, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: UIView.AnimationOptions(), animations: {
109109
let w: CGFloat = v.frame.size.width
110110
let h: CGFloat = v.frame.size.height
111111
let frame = CGRect(x: screenLoc.x - (w/2), y: screenLoc.y - (h/2), width: w, height: h)

Examples/Examples/BarsExample.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,9 @@ class BarsExample: UIViewController {
111111
self.controller = controller
112112

113113
horizontal = UIButton()
114-
horizontal.setTitle("Horizontal", for: UIControlState())
114+
horizontal.setTitle("Horizontal", for: UIControl.State())
115115
vertical = UIButton()
116-
vertical.setTitle("Vertical", for: UIControlState())
116+
vertical.setTitle("Vertical", for: UIControl.State())
117117

118118
buttonDirs = [horizontal : true, vertical : false]
119119

@@ -124,7 +124,7 @@ class BarsExample: UIViewController {
124124

125125
for button in [horizontal, vertical] {
126126
button.titleLabel?.font = ExamplesDefaults.fontWithSize(14)
127-
button.setTitleColor(UIColor.blue, for: UIControlState())
127+
button.setTitleColor(UIColor.blue, for: UIControl.State())
128128
button.addTarget(self, action: #selector(DirSelector.buttonTapped(_:)), for: .touchUpInside)
129129
}
130130
}
@@ -155,9 +155,9 @@ class BarsExample: UIViewController {
155155
"\(str)-(\(buttonsSpace))-[\(tuple.0)]"
156156
}
157157

158-
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|[\($0.0)]", options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)}
158+
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|[\($0.0)]", options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)}
159159

160-
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)
160+
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)
161161
+ vConstraits)
162162
}
163163

Examples/Examples/CandleStickInteractiveExample.swift

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,7 @@ class CandleStickInteractiveExample: UIViewController {
7878
let calendar = Calendar.current
7979
let monthDays = calendar.range(of: .day, in: .month, for: date)!
8080

81-
let arr = CountableRange<Int>(monthDays)
82-
83-
return arr.map {day in
81+
return monthDays.map {day in
8482
let date = dateWithComponents(day, month, year)
8583
let axisValue = ChartAxisValueDate(date: date, formatter: displayFormatter, labelSettings: labelSettings)
8684
axisValue.hidden = !(day % 5 == 0)
@@ -252,9 +250,9 @@ private class InfoView: UIView {
252250
"\(str)-(\(labelsSpace))-[\(tuple.0)]"
253251
}
254252

255-
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|-(18)-[\($0.0)(\(circleDiameter))]", options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)}
253+
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|-(18)-[\($0.0)(\(circleDiameter))]", options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)}
256254

257-
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)
255+
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)
258256
+ vConstraits)
259257

260258
}

Examples/Examples/GroupedAndStackedBarsExample.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ class GroupedAndStackedBarsExample: UIViewController {
170170
self.controller = controller
171171

172172
horizontal = UIButton()
173-
horizontal.setTitle("Horizontal", for: UIControlState())
173+
horizontal.setTitle("Horizontal", for: UIControl.State())
174174
vertical = UIButton()
175-
vertical.setTitle("Vertical", for: UIControlState())
175+
vertical.setTitle("Vertical", for: UIControl.State())
176176

177177
buttonDirs = [horizontal: true, vertical: false]
178178

@@ -183,7 +183,7 @@ class GroupedAndStackedBarsExample: UIViewController {
183183

184184
for button in [horizontal, vertical] {
185185
button.titleLabel?.font = ExamplesDefaults.fontWithSize(14)
186-
button.setTitleColor(UIColor.blue, for: UIControlState())
186+
button.setTitleColor(UIColor.blue, for: UIControl.State())
187187
button.addTarget(self, action: #selector(DirSelector.buttonTapped(_:)), for: .touchUpInside)
188188
}
189189
}
@@ -214,9 +214,9 @@ class GroupedAndStackedBarsExample: UIViewController {
214214
"\(str)-(\(buttonsSpace))-[\(tuple.0)]"
215215
}
216216

217-
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|[\($0.0)]", options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)}
217+
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|[\($0.0)]", options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)}
218218

219-
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)
219+
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)
220220
+ vConstraits)
221221
}
222222

Examples/Examples/GroupedBarsExample.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ class GroupedBarsExample: UIViewController {
151151
self.controller = controller
152152

153153
horizontal = UIButton()
154-
horizontal.setTitle("Horizontal", for: UIControlState())
154+
horizontal.setTitle("Horizontal", for: UIControl.State())
155155
vertical = UIButton()
156-
vertical.setTitle("Vertical", for: UIControlState())
156+
vertical.setTitle("Vertical", for: UIControl.State())
157157

158158
buttonDirs = [horizontal : true, vertical : false]
159159

@@ -164,7 +164,7 @@ class GroupedBarsExample: UIViewController {
164164

165165
for button in [horizontal, vertical] {
166166
button.titleLabel?.font = ExamplesDefaults.fontWithSize(14)
167-
button.setTitleColor(UIColor.blue, for: UIControlState())
167+
button.setTitleColor(UIColor.blue, for: UIControl.State())
168168
button.addTarget(self, action: #selector(DirSelector.buttonTapped(_:)), for: .touchUpInside)
169169
}
170170
}
@@ -195,9 +195,9 @@ class GroupedBarsExample: UIViewController {
195195
"\(str)-(\(buttonsSpace))-[\(tuple.0)]"
196196
}
197197

198-
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|[\($0.0)]", options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)}
198+
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|[\($0.0)]", options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)}
199199

200-
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)
200+
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)
201201
+ vConstraits)
202202
}
203203

Examples/Examples/NotificationsExample.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class NotificationsExample: UIViewController {
4646
label.transform = CGAffineTransform(scaleX: 0, y: 0)
4747

4848
chartPointView.movedToSuperViewHandler = {
49-
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: UIViewAnimationOptions(), animations: {
49+
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 0.6, initialSpringVelocity: 0, options: UIView.AnimationOptions(), animations: {
5050
label.transform = CGAffineTransform(scaleX: 1, y: 1)
5151
}, completion: nil)
5252
}
@@ -58,8 +58,8 @@ class NotificationsExample: UIViewController {
5858
let ok = "Ok"
5959

6060
if #available(iOS 8.0, *) {
61-
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertControllerStyle.alert)
62-
alert.addAction(UIAlertAction(title: ok, style: UIAlertActionStyle.default, handler: nil))
61+
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
62+
alert.addAction(UIAlertAction(title: ok, style: UIAlertAction.Style.default, handler: nil))
6363
self!.present(alert, animated: true, completion: nil)
6464

6565
} else {

Examples/Examples/RangedAxisExample.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class RangedAxisExample: UIViewController {
2222

2323
view.backgroundColor = UIColor.black
2424

25-
NotificationCenter.default.addObserver(self, selector: #selector(rotated), name: NSNotification.Name.UIDeviceOrientationDidChange, object: nil)
25+
NotificationCenter.default.addObserver(self, selector: #selector(rotated), name: UIDevice.orientationDidChangeNotification, object: nil)
2626
}
2727

2828
private func initChart() {

Examples/Examples/StackedBarsExample.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,9 @@ class StackedBarsExample: UIViewController {
131131
self.controller = controller
132132

133133
self.horizontal = UIButton()
134-
self.horizontal.setTitle("Horizontal", for: UIControlState())
134+
self.horizontal.setTitle("Horizontal", for: UIControl.State())
135135
self.vertical = UIButton()
136-
self.vertical.setTitle("Vertical", for: UIControlState())
136+
self.vertical.setTitle("Vertical", for: UIControl.State())
137137

138138
self.buttonDirs = [horizontal: true, vertical: false]
139139

@@ -144,7 +144,7 @@ class StackedBarsExample: UIViewController {
144144

145145
for button in [horizontal, vertical] {
146146
button.titleLabel?.font = ExamplesDefaults.fontWithSize(14)
147-
button.setTitleColor(UIColor.blue, for: UIControlState())
147+
button.setTitleColor(UIColor.blue, for: UIControl.State())
148148
button.addTarget(self, action: #selector(DirSelector.buttonTapped(_:)), for: .touchUpInside)
149149
}
150150
}
@@ -175,9 +175,9 @@ class StackedBarsExample: UIViewController {
175175
"\(str)-(\(buttonsSpace))-[\(tuple.0)]"
176176
}
177177

178-
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|[\($0.0)]", options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)}
178+
let vConstraits = namedViews.flatMap {NSLayoutConstraint.constraints(withVisualFormat: "V:|[\($0.0)]", options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)}
179179

180-
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutFormatOptions(), metrics: nil, views: viewsDict)
180+
addConstraints(NSLayoutConstraint.constraints(withVisualFormat: hConstraintStr, options: NSLayoutConstraint.FormatOptions(), metrics: nil, views: viewsDict)
181181
+ vConstraits)
182182
}
183183

Examples/MasterViewController.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MasterViewController: UITableViewController {
5959

6060
navigationController?.navigationBar.titleTextAttributes = [.font : ExamplesDefaults.fontWithSize(22)]
6161
UIBarButtonItem.appearance().setTitleTextAttributes([.font : ExamplesDefaults.fontWithSize(22)],
62-
for: UIControlState())
62+
for: UIControl.State())
6363

6464
if let split = splitViewController {
6565

@@ -72,8 +72,9 @@ class MasterViewController: UITableViewController {
7272
detailViewController?.title = example.1
7373
}
7474

75-
76-
performSegue(withIdentifier: "showDetail", sender: self)
75+
if (UIDevice.current.userInterfaceIdiom != .pad) {
76+
performSegue(withIdentifier: "showDetail", sender: self)
77+
}
7778
}
7879

7980
// MARK: - Segues

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Easy to use and highly customizable charts library for iOS
2626

2727
<sub>*These are separate repos for better focus and reusability.</sub>
2828

29-
Swift 4 - 1.2, iOS 11 - 7
29+
iOS 7+
3030

3131
[Video](https://www.youtube.com/watch?v=bD6uDF-KckM)
3232

@@ -64,7 +64,7 @@ Add to your Podfile:
6464
Swift 4.x:
6565
```ruby
6666
use_frameworks!
67-
pod 'SwiftCharts', '~> 0.6.1'
67+
pod 'SwiftCharts', '~> 0.6.2'
6868
```
6969

7070
Swift 3.x:
@@ -94,7 +94,7 @@ Add to your Cartfile:
9494

9595
Swift 4.x:
9696
```
97-
github "i-schuetz/SwiftCharts" ~> 0.6.1
97+
github "i-schuetz/SwiftCharts" ~> 0.6.2
9898
```
9999

100100
Swift 3.x:

SwiftCharts.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Pod::Spec.new do |s|
22
s.name = "SwiftCharts"
3-
s.version = "0.6.1"
3+
s.version = "0.6.2"
44
s.summary = "Easy to use and highly customizable charts library for iOS"
55
s.homepage = "https://github.com/i-schuetz/SwiftCharts"
66
s.license = { :type => "Apache License, Version 2.0", :file => "LICENSE" }
77
s.authors = { "Ivan Schuetz" => "[email protected]"}
88
s.ios.deployment_target = "8.0"
99
s.tvos.deployment_target = "9.0"
10-
s.source = { :git => "https://github.com/i-schuetz/SwiftCharts.git", :tag => '0.6.1'}
10+
s.source = { :git => "https://github.com/i-schuetz/SwiftCharts.git", :tag => '0.6.2'}
1111
s.source_files = 'SwiftCharts/*.swift', 'SwiftCharts/**/*.swift'
1212
s.frameworks = "Foundation", "UIKit", "CoreGraphics"
1313
end

SwiftCharts.xcodeproj/project.pbxproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -980,11 +980,11 @@
980980
06342AC01B8AAD7F001C9F5D = {
981981
CreatedOnToolsVersion = 6.4;
982982
DevelopmentTeam = 37QAPDY2PR;
983-
LastSwiftMigration = 0800;
983+
LastSwiftMigration = 1000;
984984
};
985985
06405DA51B8AA74700A689FF = {
986986
CreatedOnToolsVersion = 6.4;
987-
LastSwiftMigration = 0900;
987+
LastSwiftMigration = 1000;
988988
};
989989
22E7020E1BF5B8EC00C19675 = {
990990
CreatedOnToolsVersion = 7.1.1;
@@ -1386,7 +1386,7 @@
13861386
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
13871387
PRODUCT_BUNDLE_IDENTIFIER = "com.schuetz.$(PRODUCT_NAME:rfc1034identifier)";
13881388
PRODUCT_NAME = "$(TARGET_NAME)";
1389-
SWIFT_VERSION = 4.0;
1389+
SWIFT_VERSION = 4.2;
13901390
};
13911391
name = Debug;
13921392
};
@@ -1402,7 +1402,7 @@
14021402
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
14031403
PRODUCT_BUNDLE_IDENTIFIER = "com.schuetz.$(PRODUCT_NAME:rfc1034identifier)";
14041404
PRODUCT_NAME = "$(TARGET_NAME)";
1405-
SWIFT_VERSION = 4.0;
1405+
SWIFT_VERSION = 4.2;
14061406
};
14071407
name = Release;
14081408
};
@@ -1537,7 +1537,7 @@
15371537
PRODUCT_NAME = "$(TARGET_NAME)";
15381538
SKIP_INSTALL = YES;
15391539
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
1540-
SWIFT_VERSION = 4.0;
1540+
SWIFT_VERSION = 4.2;
15411541
};
15421542
name = Debug;
15431543
};
@@ -1558,7 +1558,7 @@
15581558
PRODUCT_BUNDLE_IDENTIFIER = "com.schuetz.$(PRODUCT_NAME:rfc1034identifier)";
15591559
PRODUCT_NAME = "$(TARGET_NAME)";
15601560
SKIP_INSTALL = YES;
1561-
SWIFT_VERSION = 4.0;
1561+
SWIFT_VERSION = 4.2;
15621562
};
15631563
name = Release;
15641564
};

SwiftCharts/Axis/ChartAxis.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ open class ChartAxis: CustomStringConvertible {
2525
open internal(set) var firstVisibleScreen: CGFloat
2626
open internal(set) var lastVisibleScreen: CGFloat
2727

28-
open let paddingFirstScreen: CGFloat
29-
open let paddingLastScreen: CGFloat
28+
public let paddingFirstScreen: CGFloat
29+
public let paddingLastScreen: CGFloat
3030

3131
/// Optional fixed padding value which overwrites paddingFirstScreen/paddingLastScreen when determining if model values are in bounds. This is useful e.g. when setting an initial zoom level, and scaling the padding proportionally such that it appears constant for different zoom levels. In this case it may be necessary to store the un-scaled padding in these variables to keep the bounds constant.
3232
open var fixedPaddingFirstScreen: CGFloat?

SwiftCharts/Axis/ChartAxisLabel.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import UIKit
1212
open class ChartAxisLabel {
1313

1414
/// Displayed text. Can be truncated.
15-
open let text: String
15+
public let text: String
1616

17-
open let settings: ChartLabelSettings
17+
public let settings: ChartLabelSettings
1818

1919
open fileprivate(set) var originalText: String
2020

0 commit comments

Comments
 (0)