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

Commit

Permalink
Updated for Swift 3 compatibility changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaunteya committed Jul 24, 2016
1 parent 423936c commit a7a8411
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 67 deletions.
6 changes: 3 additions & 3 deletions InDeterminate/Crawler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ public class Crawler: IndeterminateAnimation {
let rect = self.bounds
let insetRect = NSInsetRect(rect, rect.width * 0.15, rect.width * 0.15)

for var i = 0.0; i < 5; i++ {
for i in 0 ..< 5 {
let starShape = CAShapeLayer()
starList.append(starShape)
starShape.backgroundColor = foreground.CGColor

let circleWidth = smallCircleSize - i * 2
let circleWidth = smallCircleSize - Double(i) * 2
starShape.bounds = CGRect(x: 0, y: 0, width: circleWidth, height: circleWidth)
starShape.cornerRadius = CGFloat(circleWidth / 2)
starShape.position = CGPoint(x: rect.midX, y: rect.midY + insetRect.height / 2)
Expand All @@ -52,7 +52,7 @@ public class Crawler: IndeterminateAnimation {
let rotationAnimation = CAKeyframeAnimation(keyPath: "position")
rotationAnimation.path = arcPath.CGPath
rotationAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
rotationAnimation.beginTime = (duration * 0.075) * i
rotationAnimation.beginTime = (duration * 0.075) * Double(i)
rotationAnimation.calculationMode = kCAAnimationCubicPaced

let animationGroup = CAAnimationGroup()
Expand Down
5 changes: 3 additions & 2 deletions InDeterminate/Spinner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ public class Spinner: IndeterminateAnimation {
starList.removeAll(keepCapacity: true)
containerLayer.sublayers = nil
animation.values = [Double]()

for var i = 0.0; i < 360; i = i + Double(360 / starCount) {
var i = 0.0
while i < 360 {
var iRadian = CGFloat(i * M_PI / 180.0)
if clockwise { iRadian = -iRadian }

Expand All @@ -100,6 +100,7 @@ public class Spinner: IndeterminateAnimation {
starShape.opacity = Float(360 - i) / 360
containerLayer.addSublayer(starShape)
starList.append(starShape)
i = i + Double(360 / starCount)
}
}

Expand Down
Loading

0 comments on commit a7a8411

Please sign in to comment.