Skip to content
Open
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
4 changes: 3 additions & 1 deletion PieChart/PieChartView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,8 @@ class PieChartView: UIView {
animation.duration = getDuration(slice)
animation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.linear)
animation.delegate = self
animation.isRemovedOnCompletion = false
animation.fillMode = .forwards

let canvasWidth = canvasView.frame.width
let path = UIBezierPath(arcCenter: canvasView.center,
Expand All @@ -96,7 +98,7 @@ class PieChartView: UIView {
sliceLayer.fillColor = nil
sliceLayer.strokeColor = slice.color.cgColor
sliceLayer.lineWidth = canvasWidth * 2 / 8
sliceLayer.strokeEnd = 1
sliceLayer.strokeEnd = 0
sliceLayer.add(animation, forKey: animation.keyPath)

canvasView.layer.addSublayer(sliceLayer)
Expand Down