31 Commits

Author SHA1 Message Date
Kaunteya Suryawanshi 6d011fd523 Cleanup 2018-10-10 12:31:12 +05:30
Kaunteya Suryawanshi b7f936dd4f Merge pull request #19 from EpicDraws/master
Changes to support Swift 4.2
2018-10-10 12:15:36 +05:30
EpicDraws 4a02dd081a Changes to support Swift 4.2 2018-10-07 18:33:21 -07:00
Kaunteya Suryawanshi 37b7e3a3b7 Updated podspec 2018-03-15 15:44:27 +05:30
Kaunteya Suryawanshi d5ae9526be Updates for Swift 4 2018-03-15 15:43:13 +05:30
Kaunteya Suryawanshi 5ba59404e8 Updated README 2017-09-28 10:29:30 +05:30
Kaunteya Suryawanshi 325b0d7602 Merge pull request #15 from jbuckner/layer_access
Add `open` designation to Determinate layers
2017-05-28 13:08:01 +05:30
Kaunteya Suryawanshi 1a574d7024 Merge pull request #14 from jbuckner/M_PI-deprecations
Use Double.pi instead of M_PI
2017-05-28 13:06:33 +05:30
Jason Buckner b986faf947 Use Double.pi instead of M_PI 2017-05-23 20:14:25 -07:00
Jason Buckner ac97b80638 Add open designation to Determinate layers
This allows the consumer to customize them
2017-05-23 20:11:06 -07:00
Kaunteya Suryawanshi fca07a4fbd updated to 0.6.1 2016-10-02 17:35:50 +05:30
Kaunteya Suryawanshi 643ac6ee2c Added .swift-version 2016-10-02 17:33:44 +05:30
Kaunteya Suryawanshi 68b340a337 Minor cleanup 2016-09-27 21:36:57 +05:30
Kaunteya Suryawanshi ca6e644069 Updated pod spec to 0.6 2016-09-27 00:37:10 +05:30
Kaunteya Suryawanshi cdb141f3a5 Merge pull request #12 from kaunteya/swift-3
Swift 3
2016-09-27 00:35:12 +05:30
Kaunteya Suryawanshi 1d8f558e20 Added Swift 3 installation instruction 2016-09-03 13:06:57 +05:30
Kaunteya Suryawanshi bde87514fc Updated Circular snail for Material progress 2016-09-03 13:00:08 +05:30
Kaunteya Suryawanshi 42e369284b App delegate cleanup 2016-09-03 12:56:36 +05:30
Kaunteya Suryawanshi c2c30f62a1 Updated podspec for Version 1.0 2016-09-03 12:55:01 +05:30
Kaunteya Suryawanshi 51ba0fc1e9 CircularSnail renamed to Material Progress 2016-09-03 12:55:01 +05:30
Kaunteya Suryawanshi 0b5d70f63a Converted to Swift 3 2016-09-03 12:55:00 +05:30
Kaunteya Suryawanshi 69676b77c6 Updated podspec to 0.5.1 2016-08-01 00:22:42 +05:30
Kaunteya Suryawanshi a7a84116ed Updated for Swift 3 compatibility changes 2016-07-24 13:02:13 +05:30
Kaunteya Suryawanshi 423936c334 Minor changes 2016-02-12 17:55:52 +05:30
Kaunteya Suryawanshi 7d84b4e697 Merge pull request #4 from schemers/master
Updated access modifiers of IBInspectable to public so as to make them usable outside of IB
2015-11-22 11:49:37 +05:30
Roland Schemers 27cdcf5c53 Update access modifiers to make usable outside of IB
- make all @IBInspectable properties public

- make BaseView init(frame frameRect: NSRect) public
2015-11-21 19:07:44 -08:00
Kaunteya Suryawanshi 0113a09f57 Added badges 2015-11-10 21:47:08 +05:30
Kaunteya Suryawanshi a3b7a4c3bc Alt for image 2015-11-06 23:17:18 +05:30
Kaunteya Suryawanshi b9fef1fb29 Minor changes in README 2015-11-05 22:26:22 +05:30
Kaunteya Suryawanshi 9f7a41e2d8 Updated tag to 0.4.1 2015-11-05 22:21:49 +05:30
Kaunteya Suryawanshi c6b46dcd53 Updated access modifiers 2015-11-05 22:20:23 +05:30
22 changed files with 295 additions and 260 deletions
+1
View File
@@ -1,3 +1,4 @@
.DS_Store
# Xcode
#
build/
+1
View File
@@ -0,0 +1 @@
3.0
+6 -6
View File
@@ -9,9 +9,9 @@
import AppKit
@IBDesignable
public class BaseView : NSView {
open class BaseView : NSView {
override init(frame frameRect: NSRect) {
override public init(frame frameRect: NSRect) {
super.init(frame: frameRect)
self.configureLayers()
}
@@ -27,19 +27,19 @@ public class BaseView : NSView {
notifyViewRedesigned()
}
@IBInspectable var background: NSColor = NSColor(red: 88.3 / 256, green: 104.4 / 256, blue: 118.5 / 256, alpha: 1.0) {
@IBInspectable open var background: NSColor = NSColor(red: 88.3 / 256, green: 104.4 / 256, blue: 118.5 / 256, alpha: 1.0) {
didSet {
self.notifyViewRedesigned()
}
}
@IBInspectable var foreground: NSColor = NSColor(red: 66.3 / 256, green: 173.7 / 256, blue: 106.4 / 256, alpha: 1.0) {
@IBInspectable open var foreground: NSColor = NSColor(red: 66.3 / 256, green: 173.7 / 256, blue: 106.4 / 256, alpha: 1.0) {
didSet {
self.notifyViewRedesigned()
}
}
@IBInspectable var cornerRadius: CGFloat = 5.0 {
@IBInspectable open var cornerRadius: CGFloat = 5.0 {
didSet {
self.notifyViewRedesigned()
}
@@ -47,7 +47,7 @@ public class BaseView : NSView {
/// Call when any IBInspectable variable is changed
func notifyViewRedesigned() {
self.layer?.backgroundColor = background.CGColor
self.layer?.backgroundColor = background.cgColor
self.layer?.cornerRadius = cornerRadius
}
}
+21 -21
View File
@@ -10,19 +10,19 @@ import Foundation
import Cocoa
@IBDesignable
public class CircularProgressView: DeterminateAnimation {
open class CircularProgressView: DeterminateAnimation {
var backgroundCircle = CAShapeLayer()
var progressLayer = CAShapeLayer()
var percentLabelLayer = CATextLayer()
open var backgroundCircle = CAShapeLayer()
open var progressLayer = CAShapeLayer()
open var percentLabelLayer = CATextLayer()
@IBInspectable var strokeWidth: CGFloat = -1 {
@IBInspectable open var strokeWidth: CGFloat = -1 {
didSet {
notifyViewRedesigned()
}
}
@IBInspectable var showPercent: Bool = true {
@IBInspectable open var showPercent: Bool = true {
didSet {
notifyViewRedesigned()
}
@@ -32,11 +32,11 @@ public class CircularProgressView: DeterminateAnimation {
super.notifyViewRedesigned()
backgroundCircle.lineWidth = self.strokeWidth / 2
progressLayer.lineWidth = strokeWidth
percentLabelLayer.hidden = !showPercent
percentLabelLayer.isHidden = !showPercent
backgroundCircle.strokeColor = foreground.colorWithAlphaComponent(0.5).CGColor
progressLayer.strokeColor = foreground.CGColor
percentLabelLayer.foregroundColor = foreground.CGColor
backgroundCircle.strokeColor = foreground.withAlphaComponent(0.5).cgColor
progressLayer.strokeColor = foreground.cgColor
percentLabelLayer.foregroundColor = foreground.cgColor
}
override func updateProgress() {
@@ -46,7 +46,7 @@ public class CircularProgressView: DeterminateAnimation {
} else {
CATransaction.setDisableActions(true)
}
let timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
let timing = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
CATransaction.setAnimationTimingFunction(timing)
progressLayer.strokeEnd = max(0, min(progress, 1))
percentLabelLayer.string = "\(Int(progress * 100))%"
@@ -65,10 +65,10 @@ public class CircularProgressView: DeterminateAnimation {
backgroundCircle.frame = rect
backgroundCircle.lineWidth = strokeWidth == -1 ? (rect.width * strokeScalingFactor / 2) : strokeWidth / 2
backgroundCircle.strokeColor = foreground.colorWithAlphaComponent(0.5).CGColor
backgroundCircle.fillColor = NSColor.clearColor().CGColor
backgroundCircle.strokeColor = foreground.withAlphaComponent(0.5).cgColor
backgroundCircle.fillColor = NSColor.clear.cgColor
let backgroundPath = NSBezierPath()
backgroundPath.appendBezierPathWithArcWithCenter(rect.mid, radius: radius, startAngle: 0, endAngle: 360)
backgroundPath.appendArc(withCenter: rect.mid, radius: radius, startAngle: 0, endAngle: 360)
backgroundCircle.path = backgroundPath.CGPath
self.layer?.addSublayer(backgroundCircle)
}
@@ -76,15 +76,15 @@ public class CircularProgressView: DeterminateAnimation {
// Progress Layer
do {
progressLayer.strokeEnd = 0 //REMOVe this
progressLayer.fillColor = NSColor.clearColor().CGColor
progressLayer.lineCap = kCALineCapRound
progressLayer.fillColor = NSColor.clear.cgColor
progressLayer.lineCap = .round
progressLayer.lineWidth = strokeWidth == -1 ? (rect.width * strokeScalingFactor) : strokeWidth
progressLayer.frame = rect
progressLayer.strokeColor = foreground.CGColor
progressLayer.strokeColor = foreground.cgColor
let arcPath = NSBezierPath()
let startAngle = CGFloat(90)
arcPath.appendBezierPathWithArcWithCenter(rect.mid, radius: radius, startAngle: startAngle, endAngle: (startAngle - 360), clockwise: true)
arcPath.appendArc(withCenter: rect.mid, radius: radius, startAngle: startAngle, endAngle: (startAngle - 360), clockwise: true)
progressLayer.path = arcPath.CGPath
self.layer?.addSublayer(progressLayer)
}
@@ -92,10 +92,10 @@ public class CircularProgressView: DeterminateAnimation {
// Percentage Layer
do {
percentLabelLayer.string = "0%"
percentLabelLayer.foregroundColor = foreground.CGColor
percentLabelLayer.foregroundColor = foreground.cgColor
percentLabelLayer.frame = rect
percentLabelLayer.font = "Helvetica Neue Light"
percentLabelLayer.alignmentMode = kCAAlignmentCenter
percentLabelLayer.font = "Helvetica Neue Light" as CFTypeRef
percentLabelLayer.alignmentMode = CATextLayerAlignmentMode.center
percentLabelLayer.position.y = rect.midY * 0.25
percentLabelLayer.fontSize = rect.width * 0.2
self.layer?.addSublayer(percentLabelLayer)
+3 -3
View File
@@ -14,12 +14,12 @@ protocol DeterminableAnimation {
}
@IBDesignable
public class DeterminateAnimation: BaseView, DeterminableAnimation {
open class DeterminateAnimation: BaseView, DeterminableAnimation {
@IBInspectable var animated: Bool = true
@IBInspectable open var animated: Bool = true
/// Value of progress now. Range 0..1
@IBInspectable var progress: CGFloat = 0 {
@IBInspectable open var progress: CGFloat = 0 {
didSet {
updateProgress()
}
+8 -8
View File
@@ -10,12 +10,12 @@ import Foundation
import Cocoa
@IBDesignable
public class ProgressBar: DeterminateAnimation {
open class ProgressBar: DeterminateAnimation {
var borderLayer = CAShapeLayer()
var progressLayer = CAShapeLayer()
open var borderLayer = CAShapeLayer()
open var progressLayer = CAShapeLayer()
@IBInspectable var borderColor: NSColor = NSColor.blackColor() {
@IBInspectable open var borderColor: NSColor = .black {
didSet {
notifyViewRedesigned()
}
@@ -24,8 +24,8 @@ public class ProgressBar: DeterminateAnimation {
override func notifyViewRedesigned() {
super.notifyViewRedesigned()
self.layer?.cornerRadius = self.frame.height / 2
borderLayer.borderColor = borderColor.CGColor
progressLayer.backgroundColor = foreground.CGColor
borderLayer.borderColor = borderColor.cgColor
progressLayer.backgroundColor = foreground.cgColor
}
override func configureLayers() {
@@ -39,7 +39,7 @@ public class ProgressBar: DeterminateAnimation {
progressLayer.frame = NSInsetRect(borderLayer.bounds, 3, 3)
progressLayer.frame.size.width = (borderLayer.bounds.width - 6)
progressLayer.cornerRadius = progressLayer.frame.height / 2
progressLayer.backgroundColor = foreground.CGColor
progressLayer.backgroundColor = foreground.cgColor
borderLayer.addSublayer(progressLayer)
}
@@ -51,7 +51,7 @@ public class ProgressBar: DeterminateAnimation {
} else {
CATransaction.setDisableActions(true)
}
let timing = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
let timing = CAMediaTimingFunction(name: .easeOut)
CATransaction.setAnimationTimingFunction(timing)
progressLayer.frame.size.width = (borderLayer.bounds.width - 6) * progress
CATransaction.commit()
+14 -13
View File
@@ -9,12 +9,12 @@
import Foundation
import Cocoa
private let defaultForegroundColor = NSColor.whiteColor()
private let defaultForegroundColor = NSColor.white
private let defaultBackgroundColor = NSColor(white: 0.0, alpha: 0.4)
private let duration = 1.2
@IBDesignable
public class Crawler: IndeterminateAnimation {
open class Crawler: IndeterminateAnimation {
var starList = [CAShapeLayer]()
@@ -27,46 +27,47 @@ public class Crawler: IndeterminateAnimation {
override func notifyViewRedesigned() {
super.notifyViewRedesigned()
for star in starList {
star.backgroundColor = foreground.CGColor
star.backgroundColor = foreground.cgColor
}
}
override func configureLayers() {
super.configureLayers()
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
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)
self.layer?.addSublayer(starShape)
let arcPath = NSBezierPath()
arcPath.appendBezierPathWithArcWithCenter(insetRect.mid, radius: insetRect.width / 2, startAngle: 90, endAngle: -360 + 90, clockwise: true)
arcPath.appendArc(withCenter: insetRect.mid, radius: insetRect.width / 2, startAngle: 90, endAngle: -360 + 90, clockwise: true)
let rotationAnimation = CAKeyframeAnimation(keyPath: "position")
rotationAnimation.path = arcPath.CGPath
rotationAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseOut)
rotationAnimation.beginTime = (duration * 0.075) * i
rotationAnimation.calculationMode = kCAAnimationCubicPaced
rotationAnimation.timingFunction = CAMediaTimingFunction(name: CAMediaTimingFunctionName.easeOut)
rotationAnimation.beginTime = (duration * 0.075) * Double(i)
rotationAnimation.calculationMode = .cubicPaced
let animationGroup = CAAnimationGroup()
animationGroup.animations = [rotationAnimation]
animationGroup.duration = duration
animationGroup.repeatCount = Float.infinity
animationGroup.repeatCount = .infinity
animationGroups.append(animationGroup)
}
}
override func startAnimation() {
for (index, star) in starList.enumerate() {
star.addAnimation(animationGroups[index], forKey: "")
for (index, star) in starList.enumerated() {
star.add(animationGroups[index], forKey: "")
}
}
+7 -7
View File
@@ -6,32 +6,32 @@
// Copyright (c) 2015 Kauntey Suryawanshi. All rights reserved.
//
import Foundation
import Cocoa
protocol AnimationActivityProtocol {
protocol AnimationStatusDelegate {
func startAnimation()
func stopAnimation()
}
public class IndeterminateAnimation: BaseView, AnimationActivityProtocol {
open class IndeterminateAnimation: BaseView, AnimationStatusDelegate {
/// View is hidden when *animate* property is false
@IBInspectable var displayAfterAnimationEnds: Bool = false
@IBInspectable open var displayAfterAnimationEnds: Bool = false
/**
Control point for all Indeterminate animation
True invokes `startAnimation()` on subclass of IndeterminateAnimation
False invokes `stopAnimation()` on subclass of IndeterminateAnimation
*/
var animate: Bool = false {
open var animate: Bool = false {
didSet {
guard animate != oldValue else { return }
if animate {
self.hidden = false
self.isHidden = false
startAnimation()
} else {
if !displayAfterAnimationEnds {
self.hidden = true
self.isHidden = true
}
stopAnimation()
}
@@ -1,5 +1,5 @@
//
// WhatsAppCircular.swift
// MaterialProgress.swift
// ProgressKit
//
// Created by Kauntey Suryawanshi on 30/06/15.
@@ -13,9 +13,9 @@ private let duration = 1.5
private let strokeRange = (start: 0.0, end: 0.8)
@IBDesignable
public class CircularSnail: IndeterminateAnimation {
open class MaterialProgress: IndeterminateAnimation {
@IBInspectable var lineWidth: CGFloat = -1 {
@IBInspectable open var lineWidth: CGFloat = -1 {
didSet {
progressLayer.lineWidth = lineWidth
}
@@ -23,7 +23,7 @@ public class CircularSnail: IndeterminateAnimation {
override func notifyViewRedesigned() {
super.notifyViewRedesigned()
progressLayer.strokeColor = foreground.CGColor
progressLayer.strokeColor = foreground.cgColor
}
var backgroundRotationLayer = CAShapeLayer()
@@ -31,8 +31,8 @@ public class CircularSnail: IndeterminateAnimation {
var progressLayer: CAShapeLayer = {
var tempLayer = CAShapeLayer()
tempLayer.strokeEnd = CGFloat(strokeRange.end)
tempLayer.lineCap = kCALineCapRound
tempLayer.fillColor = NSColor.clearColor().CGColor
tempLayer.lineCap = .round
tempLayer.fillColor = NSColor.clear.cgColor
return tempLayer
}()
@@ -50,7 +50,7 @@ public class CircularSnail: IndeterminateAnimation {
tempRotation.repeatCount = Float.infinity
tempRotation.fromValue = 0
tempRotation.toValue = 1
tempRotation.cumulative = true
tempRotation.isCumulative = true
tempRotation.duration = duration / 2
return tempRotation
}()
@@ -60,11 +60,11 @@ public class CircularSnail: IndeterminateAnimation {
var strokeStartAnimation: CABasicAnimation!
var strokeEndAnimation: CABasicAnimation!
func makeAnimationforKeyPath(keyPath: String) -> CABasicAnimation {
func makeAnimationforKeyPath(_ keyPath: String) -> CABasicAnimation {
let tempAnimation = CABasicAnimation(keyPath: keyPath)
tempAnimation.repeatCount = 1
tempAnimation.speed = 2.0
tempAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut)
tempAnimation.timingFunction = CAMediaTimingFunction(name: .easeInEaseOut)
tempAnimation.fromValue = strokeRange.start
tempAnimation.toValue = strokeRange.end
@@ -92,30 +92,33 @@ public class CircularSnail: IndeterminateAnimation {
progressLayer.frame = rect
progressLayer.lineWidth = lineWidth == -1 ? radius / 10: lineWidth
let arcPath = NSBezierPath()
arcPath.appendBezierPathWithArcWithCenter(rect.mid, radius: radius, startAngle: 0, endAngle: 360, clockwise: false)
arcPath.appendArc(withCenter: rect.mid, radius: radius, startAngle: 0, endAngle: 360, clockwise: false)
progressLayer.path = arcPath.CGPath
backgroundRotationLayer.addSublayer(progressLayer)
}
var currentRotation = 0.0
let π2 = M_PI * 2
override public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
if !animate { return }
CATransaction.begin()
CATransaction.setDisableActions(true)
currentRotation += strokeRange.end * π2
currentRotation %= π2
progressLayer.setAffineTransform(CGAffineTransformMakeRotation(CGFloat( currentRotation)))
CATransaction.commit()
progressLayer.addAnimation(animationGroup, forKey: "strokeEnd")
}
let π2 = Double.pi * 2
override func startAnimation() {
progressLayer.addAnimation(animationGroup, forKey: "strokeEnd")
backgroundRotationLayer.addAnimation(rotationAnimation, forKey: rotationAnimation.keyPath)
progressLayer.add(animationGroup, forKey: "strokeEnd")
backgroundRotationLayer.add(rotationAnimation, forKey: rotationAnimation.keyPath)
}
override func stopAnimation() {
backgroundRotationLayer.removeAllAnimations()
progressLayer.removeAllAnimations()
}
}
extension MaterialProgress: CAAnimationDelegate {
open func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
if !animate { return }
CATransaction.begin()
CATransaction.setDisableActions(true)
currentRotation += strokeRange.end * π2
currentRotation = currentRotation.truncatingRemainder(dividingBy: π2)
progressLayer.setAffineTransform(CGAffineTransform(rotationAngle: CGFloat( currentRotation)))
CATransaction.commit()
progressLayer.add(animationGroup, forKey: "strokeEnd")
}
}
+9 -9
View File
@@ -10,29 +10,29 @@ import Foundation
import Cocoa
@IBDesignable
public class Rainbow: CircularSnail {
open class Rainbow: MaterialProgress {
@IBInspectable var onLightOffDark: Bool = false
@IBInspectable open var onLightOffDark: Bool = false
override func configureLayers() {
super.configureLayers()
self.background = NSColor.clearColor()
self.background = NSColor.clear
}
override public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
override open func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
super.animationDidStop(anim, finished: flag)
if onLightOffDark {
progressLayer.strokeColor = lightColorList[Int(arc4random()) % lightColorList.count].CGColor
progressLayer.strokeColor = lightColorList[Int(arc4random()) % lightColorList.count].cgColor
} else {
progressLayer.strokeColor = darkColorList[Int(arc4random()) % darkColorList.count].CGColor
progressLayer.strokeColor = darkColorList[Int(arc4random()) % darkColorList.count].cgColor
}
}
}
var randomColor: NSColor {
let red = CGFloat(Double(arc4random()) % 256.0 / 256.0)
let green = CGFloat(Double(arc4random()) % 256.0 / 256.0)
let blue = CGFloat(Double(arc4random()) % 256.0 / 256.0)
let red = CGFloat(Double(arc4random()).truncatingRemainder(dividingBy: 256.0) / 256.0)
let green = CGFloat(Double(arc4random()).truncatingRemainder(dividingBy: 256.0) / 256.0)
let blue = CGFloat(Double(arc4random()).truncatingRemainder(dividingBy: 256.0) / 256.0)
return NSColor(calibratedRed: red, green: green, blue: blue, alpha: 1.0)
}
+15 -15
View File
@@ -12,24 +12,24 @@ import Cocoa
private let duration = 0.25
@IBDesignable
public class RotatingArc: IndeterminateAnimation {
open class RotatingArc: IndeterminateAnimation {
var backgroundCircle = CAShapeLayer()
var arcLayer = CAShapeLayer()
@IBInspectable var strokeWidth: CGFloat = 5 {
@IBInspectable open var strokeWidth: CGFloat = 5 {
didSet {
notifyViewRedesigned()
}
}
@IBInspectable var arcLength: Int = 35 {
@IBInspectable open var arcLength: Int = 35 {
didSet {
notifyViewRedesigned()
}
}
@IBInspectable var clockWise: Bool = true {
@IBInspectable open var clockWise: Bool = true {
didSet {
notifyViewRedesigned()
}
@@ -41,10 +41,10 @@ public class RotatingArc: IndeterminateAnimation {
var rotationAnimation: CABasicAnimation = {
var tempRotation = CABasicAnimation(keyPath: "transform.rotation")
tempRotation.repeatCount = Float.infinity
tempRotation.repeatCount = .infinity
tempRotation.fromValue = 0
tempRotation.toValue = 1
tempRotation.cumulative = true
tempRotation.isCumulative = true
tempRotation.duration = duration
return tempRotation
}()
@@ -52,8 +52,8 @@ public class RotatingArc: IndeterminateAnimation {
override func notifyViewRedesigned() {
super.notifyViewRedesigned()
arcLayer.strokeColor = foreground.CGColor
backgroundCircle.strokeColor = foreground.colorWithAlphaComponent(0.4).CGColor
arcLayer.strokeColor = foreground.cgColor
backgroundCircle.strokeColor = foreground.withAlphaComponent(0.4).cgColor
backgroundCircle.lineWidth = self.strokeWidth
arcLayer.lineWidth = strokeWidth
@@ -61,7 +61,7 @@ public class RotatingArc: IndeterminateAnimation {
let arcPath = NSBezierPath()
let endAngle: CGFloat = CGFloat(-360) * CGFloat(arcLength) / 100
arcPath.appendBezierPathWithArcWithCenter(self.bounds.mid, radius: radius, startAngle: 0, endAngle: endAngle, clockwise: true)
arcPath.appendArc(withCenter: self.bounds.mid, radius: radius, startAngle: 0, endAngle: endAngle, clockwise: true)
arcLayer.path = arcPath.CGPath
}
@@ -75,27 +75,27 @@ public class RotatingArc: IndeterminateAnimation {
backgroundCircle.frame = rect
backgroundCircle.lineWidth = strokeWidth
backgroundCircle.strokeColor = foreground.colorWithAlphaComponent(0.5).CGColor
backgroundCircle.fillColor = NSColor.clearColor().CGColor
backgroundCircle.strokeColor = foreground.withAlphaComponent(0.5).cgColor
backgroundCircle.fillColor = NSColor.clear.cgColor
let backgroundPath = NSBezierPath()
backgroundPath.appendBezierPathWithArcWithCenter(rect.mid, radius: radius, startAngle: 0, endAngle: 360)
backgroundPath.appendArc(withCenter: rect.mid, radius: radius, startAngle: 0, endAngle: 360)
backgroundCircle.path = backgroundPath.CGPath
self.layer?.addSublayer(backgroundCircle)
}
// Arc Layer
do {
arcLayer.fillColor = NSColor.clearColor().CGColor
arcLayer.fillColor = NSColor.clear.cgColor
arcLayer.lineWidth = strokeWidth
arcLayer.frame = rect
arcLayer.strokeColor = foreground.CGColor
arcLayer.strokeColor = foreground.cgColor
self.layer?.addSublayer(arcLayer)
}
}
override func startAnimation() {
arcLayer.addAnimation(rotationAnimation, forKey: "")
arcLayer.add(rotationAnimation, forKey: "")
}
override func stopAnimation() {
+19 -17
View File
@@ -10,8 +10,8 @@ import Foundation
import Cocoa
@IBDesignable
public class ShootingStars: IndeterminateAnimation {
private let animationDuration = 1.0
open class ShootingStars: IndeterminateAnimation {
fileprivate let animationDuration = 1.0
var starLayer1 = CAShapeLayer()
var starLayer2 = CAShapeLayer()
@@ -20,8 +20,8 @@ public class ShootingStars: IndeterminateAnimation {
override func notifyViewRedesigned() {
super.notifyViewRedesigned()
starLayer1.backgroundColor = foreground.CGColor
starLayer2.backgroundColor = foreground.CGColor
starLayer1.backgroundColor = foreground.cgColor
starLayer2.backgroundColor = foreground.cgColor
}
override func configureLayers() {
@@ -37,12 +37,12 @@ public class ShootingStars: IndeterminateAnimation {
do {
starLayer1.position = CGPoint(x: dimension / 2, y: dimension / 2)
starLayer1.bounds.size = CGSize(width: starWidth, height: dimension)
starLayer1.backgroundColor = foreground.CGColor
starLayer1.backgroundColor = foreground.cgColor
self.layer?.addSublayer(starLayer1)
starLayer2.position = CGPoint(x: rect.midX, y: dimension / 2)
starLayer2.bounds.size = CGSize(width: starWidth, height: dimension)
starLayer2.backgroundColor = foreground.CGColor
starLayer2.backgroundColor = foreground.cgColor
self.layer?.addSublayer(starLayer2)
}
@@ -51,9 +51,9 @@ public class ShootingStars: IndeterminateAnimation {
animation.fromValue = -dimension
animation.toValue = rect.width * 0.9
animation.duration = animationDuration
animation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
animation.removedOnCompletion = false
animation.repeatCount = Float.infinity
animation.timingFunction = CAMediaTimingFunction(name: .easeIn)
animation.isRemovedOnCompletion = false
animation.repeatCount = .infinity
}
/** Temp animation will be removed after first animation
@@ -64,17 +64,13 @@ public class ShootingStars: IndeterminateAnimation {
tempAnimation.toValue = rect.width
tempAnimation.delegate = self
tempAnimation.duration = animationDuration / 2
tempAnimation.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseIn)
tempAnimation.timingFunction = CAMediaTimingFunction(name: .easeIn)
}
override public func animationDidStop(anim: CAAnimation, finished flag: Bool) {
starLayer2.addAnimation(animation, forKey: "default")
}
//MARK: Indeterminable protocol
override func startAnimation() {
starLayer1.addAnimation(animation, forKey: "default")
starLayer2.addAnimation(tempAnimation, forKey: "tempAnimation")
starLayer1.add(animation, forKey: "default")
starLayer2.add(tempAnimation, forKey: "tempAnimation")
}
override func stopAnimation() {
@@ -82,3 +78,9 @@ public class ShootingStars: IndeterminateAnimation {
starLayer2.removeAllAnimations()
}
}
extension ShootingStars: CAAnimationDelegate {
open func animationDidStop(_ anim: CAAnimation, finished flag: Bool) {
starLayer2.add(animation, forKey: "default")
}
}
+16 -15
View File
@@ -10,7 +10,7 @@ import Foundation
import Cocoa
@IBDesignable
public class Spinner: IndeterminateAnimation {
open class Spinner: IndeterminateAnimation {
var basicShape = CAShapeLayer()
var containerLayer = CAShapeLayer()
@@ -18,43 +18,43 @@ public class Spinner: IndeterminateAnimation {
var animation: CAKeyframeAnimation = {
var animation = CAKeyframeAnimation(keyPath: "transform.rotation")
animation.repeatCount = Float.infinity
animation.calculationMode = kCAAnimationDiscrete
animation.repeatCount = .infinity
animation.calculationMode = .discrete
return animation
}()
@IBInspectable var starSize:CGSize = CGSize(width: 6, height: 15) {
@IBInspectable open var starSize:CGSize = CGSize(width: 6, height: 15) {
didSet {
notifyViewRedesigned()
}
}
@IBInspectable var roundedCorners: Bool = true {
@IBInspectable open var roundedCorners: Bool = true {
didSet {
notifyViewRedesigned()
}
}
@IBInspectable var distance: CGFloat = CGFloat(20) {
@IBInspectable open var distance: CGFloat = CGFloat(20) {
didSet {
notifyViewRedesigned()
}
}
@IBInspectable var starCount: Int = 10 {
@IBInspectable open var starCount: Int = 10 {
didSet {
notifyViewRedesigned()
}
}
@IBInspectable var duration: Double = 1 {
@IBInspectable open var duration: Double = 1 {
didSet {
animation.duration = duration
}
}
@IBInspectable var clockwise: Bool = false {
@IBInspectable open var clockwise: Bool = false {
didSet {
notifyViewRedesigned()
}
@@ -72,12 +72,12 @@ public class Spinner: IndeterminateAnimation {
override func notifyViewRedesigned() {
super.notifyViewRedesigned()
starList.removeAll(keepCapacity: true)
starList.removeAll(keepingCapacity: true)
containerLayer.sublayers = nil
animation.values = [Double]()
for var i = 0.0; i < 360; i = i + Double(360 / starCount) {
var iRadian = CGFloat(i * M_PI / 180.0)
var i = 0.0
while i < 360 {
var iRadian = CGFloat(i * Double.pi / 180.0)
if clockwise { iRadian = -iRadian }
animation.values?.append(iRadian)
@@ -88,7 +88,7 @@ public class Spinner: IndeterminateAnimation {
starShape.frame = CGRect(origin: centerLocation, size: starSize)
starShape.backgroundColor = foreground.CGColor
starShape.backgroundColor = foreground.cgColor
starShape.anchorPoint = CGPoint(x: 0.5, y: 0)
var rotation: CATransform3D = CATransform3DMakeTranslation(0, 0, 0.0);
@@ -100,11 +100,12 @@ public class Spinner: IndeterminateAnimation {
starShape.opacity = Float(360 - i) / 360
containerLayer.addSublayer(starShape)
starList.append(starShape)
i = i + Double(360 / starCount)
}
}
override func startAnimation() {
containerLayer.addAnimation(animation, forKey: "rotation")
containerLayer.add(animation, forKey: "rotation")
}
override func stopAnimation() {
+2 -2
View File
@@ -1,8 +1,8 @@
Pod::Spec.new do |spec|
spec.name = 'ProgressKit'
spec.version = '0.4.0'
spec.version = '0.8'
spec.license = 'MIT'
spec.summary = 'Animated ProgressViews for OS X'
spec.summary = 'Animated ProgressViews for macOS'
spec.homepage = 'https://github.com/kaunteya/ProgressKit'
spec.authors = { 'Kaunteya Suryawanshi' => 'k.suryawanshi@gmail.com' }
spec.source = { :git => 'https://github.com/kaunteya/ProgressKit.git', :tag => spec.version }
+41 -8
View File
@@ -8,11 +8,11 @@
/* Begin PBXBuildFile section */
E31617A61BC0596C007AD70F /* BaseView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E31617A51BC0596C007AD70F /* BaseView.swift */; };
E340FDB81BDE45F000CE6550 /* RotatingArc.swift in Sources */ = {isa = PBXBuildFile; fileRef = E340FDB71BDE45F000CE6550 /* RotatingArc.swift */; settings = {ASSET_TAGS = (); }; };
E340FDB81BDE45F000CE6550 /* RotatingArc.swift in Sources */ = {isa = PBXBuildFile; fileRef = E340FDB71BDE45F000CE6550 /* RotatingArc.swift */; };
E35D1C6C1B676889001DBAF2 /* Spinner.swift in Sources */ = {isa = PBXBuildFile; fileRef = E35D1C6B1B676889001DBAF2 /* Spinner.swift */; };
E37568DF1B6AAB530073E26F /* ProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = E37568DE1B6AAB530073E26F /* ProgressBar.swift */; };
E3918F811B4E88CF00558DAB /* CircularProgressView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3918F801B4E88CF00558DAB /* CircularProgressView.swift */; };
E3918F841B4E88DE00558DAB /* CircularSnail.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3918F821B4E88DE00558DAB /* CircularSnail.swift */; };
E3918F841B4E88DE00558DAB /* MaterialProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3918F821B4E88DE00558DAB /* MaterialProgress.swift */; };
E3918F851B4E88DE00558DAB /* ShootingStars.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3918F831B4E88DE00558DAB /* ShootingStars.swift */; };
E3918F8D1B4E8AB100558DAB /* IndeterminateAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3918F8C1B4E8AB100558DAB /* IndeterminateAnimation.swift */; };
E3918F8F1B4E8C2900558DAB /* DeterminateAnimation.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3918F8E1B4E8C2900558DAB /* DeterminateAnimation.swift */; };
@@ -23,7 +23,6 @@
E3AD65DF1B426758009541CD /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E3AD65DD1B426758009541CD /* Main.storyboard */; };
E3AD65EB1B426758009541CD /* ProgressKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3AD65EA1B426758009541CD /* ProgressKitTests.swift */; };
E3AD65F71B427511009541CD /* InDeterminateVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3AD65F61B427511009541CD /* InDeterminateVC.swift */; };
E3CCD5981BBC19ED00F7DB9A /* ProgressKit.podspec in Resources */ = {isa = PBXBuildFile; fileRef = E3CCD5971BBC19ED00F7DB9A /* ProgressKit.podspec */; };
E3CCD59A1BBC2B9B00F7DB9A /* ProgressUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3CCD5991BBC2B9B00F7DB9A /* ProgressUtils.swift */; };
/* End PBXBuildFile section */
@@ -38,12 +37,14 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
E310B1D21D7AB2D4008DEF62 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; path = README.md; sourceTree = SOURCE_ROOT; };
E310B1D41D7AB2EA008DEF62 /* LICENSE */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = LICENSE; sourceTree = SOURCE_ROOT; };
E31617A51BC0596C007AD70F /* BaseView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BaseView.swift; sourceTree = "<group>"; };
E340FDB71BDE45F000CE6550 /* RotatingArc.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RotatingArc.swift; path = InDeterminate/RotatingArc.swift; sourceTree = "<group>"; };
E35D1C6B1B676889001DBAF2 /* Spinner.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Spinner.swift; path = InDeterminate/Spinner.swift; sourceTree = "<group>"; };
E37568DE1B6AAB530073E26F /* ProgressBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ProgressBar.swift; path = Determinate/ProgressBar.swift; sourceTree = "<group>"; };
E3918F801B4E88CF00558DAB /* CircularProgressView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CircularProgressView.swift; path = Determinate/CircularProgressView.swift; sourceTree = "<group>"; };
E3918F821B4E88DE00558DAB /* CircularSnail.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = CircularSnail.swift; path = InDeterminate/CircularSnail.swift; sourceTree = "<group>"; };
E3918F821B4E88DE00558DAB /* MaterialProgress.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = MaterialProgress.swift; path = InDeterminate/MaterialProgress.swift; sourceTree = "<group>"; };
E3918F831B4E88DE00558DAB /* ShootingStars.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ShootingStars.swift; path = InDeterminate/ShootingStars.swift; sourceTree = "<group>"; };
E3918F8C1B4E8AB100558DAB /* IndeterminateAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = IndeterminateAnimation.swift; path = InDeterminate/IndeterminateAnimation.swift; sourceTree = "<group>"; };
E3918F8E1B4E8C2900558DAB /* DeterminateAnimation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = DeterminateAnimation.swift; path = Determinate/DeterminateAnimation.swift; sourceTree = "<group>"; };
@@ -84,7 +85,7 @@
isa = PBXGroup;
children = (
E3918F8C1B4E8AB100558DAB /* IndeterminateAnimation.swift */,
E3918F821B4E88DE00558DAB /* CircularSnail.swift */,
E3918F821B4E88DE00558DAB /* MaterialProgress.swift */,
E3918FA71B4ECF7100558DAB /* Rainbow.swift */,
E3A468511B5434F7006DDE31 /* Crawler.swift */,
E3918F831B4E88DE00558DAB /* ShootingStars.swift */,
@@ -140,6 +141,8 @@
E3AD65D51B426758009541CD /* Supporting Files */ = {
isa = PBXGroup;
children = (
E310B1D21D7AB2D4008DEF62 /* README.md */,
E310B1D41D7AB2EA008DEF62 /* LICENSE */,
E3CCD5991BBC2B9B00F7DB9A /* ProgressUtils.swift */,
E3CCD5971BBC19ED00F7DB9A /* ProgressKit.podspec */,
E3AD65D61B426758009541CD /* Info.plist */,
@@ -210,14 +213,16 @@
attributes = {
LastSwiftMigration = 0700;
LastSwiftUpdateCheck = 0700;
LastUpgradeCheck = 0700;
LastUpgradeCheck = 1000;
ORGANIZATIONNAME = "Kauntey Suryawanshi";
TargetAttributes = {
E3AD65D11B426758009541CD = {
CreatedOnToolsVersion = 6.3.2;
LastSwiftMigration = 0920;
};
E3AD65E31B426758009541CD = {
CreatedOnToolsVersion = 6.3.2;
LastSwiftMigration = 0920;
TestTargetID = E3AD65D11B426758009541CD;
};
};
@@ -246,7 +251,6 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
E3CCD5981BBC19ED00F7DB9A /* ProgressKit.podspec in Resources */,
E3AD65DF1B426758009541CD /* Main.storyboard in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -272,7 +276,7 @@
E3918F851B4E88DE00558DAB /* ShootingStars.swift in Sources */,
E3918F811B4E88CF00558DAB /* CircularProgressView.swift in Sources */,
E35D1C6C1B676889001DBAF2 /* Spinner.swift in Sources */,
E3918F841B4E88DE00558DAB /* CircularSnail.swift in Sources */,
E3918F841B4E88DE00558DAB /* MaterialProgress.swift in Sources */,
E3AD65D81B426758009541CD /* AppDelegate.swift in Sources */,
E37568DF1B6AAB530073E26F /* ProgressBar.swift in Sources */,
E340FDB81BDE45F000CE6550 /* RotatingArc.swift in Sources */,
@@ -321,13 +325,23 @@
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;
CODE_SIGN_IDENTITY = "-";
@@ -366,13 +380,23 @@
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;
CODE_SIGN_IDENTITY = "-";
@@ -391,6 +415,7 @@
MACOSX_DEPLOYMENT_TARGET = 10.10;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
};
name = Release;
};
@@ -403,6 +428,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
};
name = Debug;
};
@@ -415,6 +442,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = Default;
SWIFT_VERSION = 4.2;
};
name = Release;
};
@@ -435,6 +464,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ProgressKit.app/Contents/MacOS/ProgressKit";
};
name = Debug;
@@ -452,6 +483,8 @@
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = "com.kaunteya.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_SWIFT3_OBJC_INFERENCE = On;
SWIFT_VERSION = 4.0;
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/ProgressKit.app/Contents/MacOS/ProgressKit";
};
name = Release;
+3 -7
View File
@@ -11,16 +11,12 @@ import Cocoa
@NSApplicationMain
class AppDelegate: NSObject, NSApplicationDelegate {
func applicationDidFinishLaunching(aNotification: NSNotification) {
func applicationDidFinishLaunching(_ aNotification: Notification) {
// Insert code here to initialize your application
}
func applicationWillTerminate(aNotification: NSNotification) {
// Insert code here to tear down your application
func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
return true
}
}
+60 -67
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="8191" systemVersion="15A284" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="11198.2" systemVersion="15G31" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8191"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11198.2"/>
</dependencies>
<scenes>
<!--Application-->
@@ -674,7 +674,6 @@
<tabView key="tabView" focusRingType="none" type="noTabsNoBorder" id="nfr-Au-q0a">
<rect key="frame" x="0.0" y="0.0" width="321" height="113"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<font key="font" metaFont="message"/>
<tabViewItems/>
</tabView>
@@ -695,13 +694,13 @@
<rect key="frame" x="0.0" y="0.0" width="500" height="184"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qjG-BT-qLK" customClass="CircularSnail" customModule="ProgressKit" customModuleProvider="target">
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qjG-BT-qLK" customClass="MaterialProgress" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="84" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8Ph-2H-wiR">
<rect key="frame" x="59" y="59" width="41" height="17"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="inline" title="More" bezelStyle="inline" alignment="center" borderStyle="border" inset="2" id="lBv-3R-Zg0">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystemBold"/>
@@ -712,7 +711,7 @@
</button>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3VR-oT-y2I" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="250" y="84" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="7" height="14"/>
@@ -725,14 +724,14 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="haM-Vg-aIY" customClass="Crawler" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="129" y="84" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="displayAfterAnimationEnds" value="YES"/>
</userDefinedRuntimeAttributes>
</customView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Npu-8G-HkC">
<rect key="frame" x="168" y="59" width="41" height="17"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="inline" title="More" bezelStyle="inline" alignment="center" borderStyle="border" inset="2" id="SqX-Fr-AwH">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystemBold"/>
@@ -743,7 +742,7 @@
</button>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kmB-H3-AT2" customClass="ShootingStars" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="34" width="438" height="3"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="foreground">
<color key="value" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -755,10 +754,10 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="NfH-n9-vtu" customClass="ShootingStars" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="11" width="438" height="3"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<shadow key="shadow" blurRadius="1">
<color key="color" red="0.25490197539329529" green="0.63529413938522339" blue="0.87058824300765991" alpha="1" colorSpace="calibratedRGB"/>
</shadow>
<animations/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="foreground">
<color key="value" white="1" alpha="1" colorSpace="calibratedWhite"/>
@@ -773,7 +772,7 @@
</customView>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Q8N-1B-PXN">
<rect key="frame" x="289" y="59" width="41" height="17"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="inline" title="More" bezelStyle="inline" alignment="center" controlSize="small" borderStyle="border" inset="2" id="Z8O-Rd-zkL">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystemBold"/>
@@ -784,7 +783,7 @@
</button>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vs0-Bp-9Zv">
<rect key="frame" x="422" y="59" width="41" height="17"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="inline" title="More" bezelStyle="inline" alignment="center" controlSize="small" borderStyle="border" inset="2" id="zgh-wl-Oer">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystemBold"/>
@@ -795,10 +794,9 @@
</button>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lR0-9k-CEu" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="378" y="84" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
</subviews>
<animations/>
</view>
</viewController>
<customObject id="lcO-Gc-g97" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
@@ -815,7 +813,7 @@
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="kmw-BV-WIW" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="14" y="126" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="strokeWidth">
<real key="value" value="9"/>
@@ -827,7 +825,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BN1-ct-TGA" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="215" y="126" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="arcLength">
<integer key="value" value="75"/>
@@ -839,7 +837,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="IUA-cq-CIL" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="31" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="clockWise" value="NO"/>
<userDefinedRuntimeAttribute type="number" keyPath="arcLength">
@@ -849,7 +847,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hgU-aF-axh" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="113" y="126" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.1647058874" green="0.65882354970000001" blue="0.53333336109999996" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -864,7 +862,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qTF-Fa-o4i" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="31" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.0" green="0.23137255012989044" blue="0.51372551918029785" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -877,7 +875,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="gqN-0P-V6h" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="128" y="30" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.0" green="0.23137255012989044" blue="0.51372551918029785" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -889,7 +887,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="swG-XB-dD9" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="121" y="23" width="95" height="95"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.0" green="0.23137255009999999" blue="0.51372551919999998" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -904,7 +902,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="8WU-rT-wd5" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="138" y="40" width="60" height="60"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.0" green="0.23137255009999999" blue="0.51372551919999998" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -919,7 +917,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bfz-P2-8sn" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="224" y="30" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.47450980544090271" green="0.23529411852359772" blue="0.46666666865348816" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -937,7 +935,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="j2W-FJ-v1G" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="229" y="35" width="70" height="70"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.47450980539999998" green="0.23529411850000001" blue="0.46666666870000001" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -952,7 +950,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="bgf-hY-ZRh" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="234" y="40" width="60" height="60"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.47450980539999998" green="0.23529411850000001" blue="0.46666666870000001" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -970,7 +968,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RtF-Gh-lRq" customClass="RotatingArc" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="239" y="45" width="50" height="50"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.47450980539999998" green="0.23529411850000001" blue="0.46666666870000001" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -987,7 +985,6 @@
</userDefinedRuntimeAttributes>
</customView>
</subviews>
<animations/>
</view>
</viewController>
<customObject id="Aep-y6-iJb" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
@@ -1002,9 +999,9 @@
<rect key="frame" x="0.0" y="0.0" width="450" height="180"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Qkh-Jc-Yju" customClass="CircularSnail" customModule="ProgressKit" customModuleProvider="target">
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Qkh-Jc-Yju" customClass="MaterialProgress" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="80" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.93725490570068359" green="0.92941176891326904" blue="0.92156863212585449" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -1014,9 +1011,9 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lq1-2r-OsR" customClass="CircularSnail" customModule="ProgressKit" customModuleProvider="target">
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lq1-2r-OsR" customClass="MaterialProgress" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="235" y="80" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.13725490868091583" green="0.49019607901573181" blue="0.81568628549575806" alpha="0.57000000000000006" colorSpace="calibratedRGB"/>
@@ -1032,9 +1029,9 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zv2-cL-kGS" customClass="CircularSnail" customModule="ProgressKit" customModuleProvider="target">
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Zv2-cL-kGS" customClass="MaterialProgress" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="370" y="102" width="40" height="40"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.13725490868091583" green="0.49019607901573181" blue="0.81568628549575806" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -1047,9 +1044,9 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BCf-PU-fcx" customClass="CircularSnail" customModule="ProgressKit" customModuleProvider="target">
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="BCf-PU-fcx" customClass="MaterialProgress" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="123" y="80" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="40"/>
@@ -1058,11 +1055,11 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Rp1-na-hhA" customClass="Rainbow" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="0.0" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Gyx-mO-3Yh" customClass="Rainbow" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="123" y="0.0" width="80" height="80"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="onLightOffDark" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="lineWidth">
@@ -1071,7 +1068,6 @@
</userDefinedRuntimeAttributes>
</customView>
</subviews>
<animations/>
</view>
</viewController>
<customObject id="qek-pA-X3K" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
@@ -1088,7 +1084,7 @@
<subviews>
<slider verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="vwx-DU-bI3">
<rect key="frame" x="136" y="264" width="289" height="20"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<sliderCell key="cell" continuous="YES" state="on" alignment="left" maxValue="1" doubleValue="0.29999999999999999" tickMarkPosition="above" sliderType="linear" id="kV7-A8-t5m"/>
<connections>
<action selector="sliderDragged:" target="XfG-lQ-9wD" id="mes-ql-pK5"/>
@@ -1096,7 +1092,7 @@
</slider>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="p9y-Jj-cPs">
<rect key="frame" x="18" y="266" width="106" height="18"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Live Progress" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Pp0-aX-cfK">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
@@ -1107,7 +1103,7 @@
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="0tx-N3-gG1">
<rect key="frame" x="437" y="265" width="45" height="17"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="100 %" id="7Nr-gz-yTj">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -1119,7 +1115,7 @@
</textField>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="fRz-hN-yoj" customClass="ProgressBar" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="26" y="45" width="454" height="9"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="foreground">
<color key="value" red="0.29411765933036804" green="0.22352941334247589" blue="0.5372549295425415" alpha="1" colorSpace="calibratedRGB"/>
@@ -1134,7 +1130,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ejA-gs-jO8" customClass="ProgressBar" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="26" y="91" width="454" height="15"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="progress">
<real key="value" value="0.34999999999999998"/>
@@ -1143,7 +1139,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="dYN-D7-hBy" customClass="CircularProgressView" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="26" y="132" width="101" height="101"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="progress">
<real key="value" value="0.40999999999999998"/>
@@ -1152,7 +1148,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="S81-p1-vGt" customClass="CircularProgressView" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="171" y="150" width="64" height="64"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.83921569585800171" green="0.44705882668495178" blue="0.43921568989753723" alpha="1" colorSpace="calibratedRGB"/>
@@ -1170,7 +1166,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Bbh-Em-IM9" customClass="CircularProgressView" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="265" y="132" width="101" height="101"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" white="1" alpha="0.0" colorSpace="calibratedWhite"/>
@@ -1189,7 +1185,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4q2-PV-rE0" customClass="ProgressBar" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="26" y="67" width="454" height="11"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="progress">
<real key="value" value="0.80000000000000004"/>
@@ -1206,7 +1202,6 @@
</userDefinedRuntimeAttributes>
</customView>
</subviews>
<animations/>
</view>
<connections>
<outlet property="slider" destination="vwx-DU-bI3" id="esn-lC-yUN"/>
@@ -1226,7 +1221,7 @@
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="X2k-vb-sC9" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="20" y="122" width="56" height="56"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="7" height="7"/>
@@ -1238,7 +1233,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="EOH-IG-9v8" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="103" y="117" width="67" height="67"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="3" height="13"/>
@@ -1254,7 +1249,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="xbE-4t-MsT" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="198" y="98" width="87" height="87"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="8" height="8"/>
@@ -1272,7 +1267,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4re-h9-0B8" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="324" y="98" width="87" height="87"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="8" height="8"/>
@@ -1291,7 +1286,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cxV-XU-BMs" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="324" y="98" width="87" height="87"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="8" height="8"/>
@@ -1310,7 +1305,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LQW-TQ-ZTf" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="198" y="13" width="87" height="87"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="8" height="8"/>
@@ -1332,7 +1327,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="qCX-xw-cn0" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="198" y="13" width="87" height="87"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="7" height="7"/>
@@ -1354,11 +1349,11 @@
</customView>
<progressIndicator horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" maxValue="100" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="rV6-J2-9Jn">
<rect key="frame" x="20" y="48" width="16" height="16"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</progressIndicator>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="M0A-06-Wvu" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="103" y="23" width="67" height="67"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="9" height="6"/>
@@ -1380,7 +1375,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="cRc-hQ-H17" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="339" y="28" width="56" height="56"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="7" height="7"/>
@@ -1395,7 +1390,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="sop-qz-vfQ" customClass="Spinner" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="58" y="48" width="18" height="18"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="size" keyPath="starSize">
<size key="value" width="2" height="4"/>
@@ -1416,7 +1411,6 @@
</userDefinedRuntimeAttributes>
</customView>
</subviews>
<animations/>
</view>
</viewController>
<customObject id="aXo-xa-gLk" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
@@ -1433,7 +1427,7 @@
<subviews>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="4ZV-ge-io4" customClass="Crawler" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="12" y="17" width="70" height="70"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.96470588445663452" green="0.48627451062202454" blue="0.0" alpha="0.0" colorSpace="calibratedRGB"/>
@@ -1445,7 +1439,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="mje-ex-whw" customClass="Crawler" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="105" y="17" width="70" height="70"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="35"/>
@@ -1454,7 +1448,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="C1d-xS-5EM" customClass="Crawler" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="193" y="17" width="70" height="70"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.76862746477127075" green="0.25882354378700256" blue="0.27058824896812439" alpha="1" colorSpace="calibratedRGB"/>
@@ -1466,7 +1460,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5mj-vA-VO1" customClass="Crawler" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="284" y="17" width="70" height="70"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" white="0.1178155164969595" alpha="0.65000000000000002" colorSpace="calibratedWhite"/>
@@ -1478,7 +1472,7 @@
</customView>
<customView fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="GLF-fC-Weh" customClass="Crawler" customModule="ProgressKit" customModuleProvider="target">
<rect key="frame" x="369" y="17" width="70" height="70"/>
<animations/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="color" keyPath="background">
<color key="value" red="0.46666666865348816" green="0.7137255072593689" blue="0.94901961088180542" alpha="1" colorSpace="calibratedRGB"/>
@@ -1489,7 +1483,6 @@
</userDefinedRuntimeAttributes>
</customView>
</subviews>
<animations/>
</view>
</viewController>
<customObject id="puf-Qu-TvG" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
+6 -6
View File
@@ -10,8 +10,8 @@ import Cocoa
class DeterminateViewController: NSViewController {
dynamic var liveProgress: Bool = true
dynamic var labelPercentage: String = "30%"
@objc dynamic var liveProgress: Bool = true
@objc dynamic var labelPercentage: String = "30%"
override func viewDidLoad() {
preferredContentSize = NSMakeSize(500, 300)
@@ -19,11 +19,11 @@ class DeterminateViewController: NSViewController {
@IBOutlet weak var slider: NSSlider!
@IBAction func sliderDragged(sender: NSSlider) {
@IBAction func sliderDragged(_ sender: NSSlider) {
let event = NSApplication.sharedApplication().currentEvent
let event = NSApplication.shared.currentEvent
// let dragStart = event!.type == NSEventType.LeftMouseDown
let dragEnd = event!.type == NSEventType.LeftMouseUp
let dragEnd = event!.type == NSEvent.EventType.leftMouseUp
// let dragging = event!.type == NSEventType.LeftMouseDragged
if liveProgress || dragEnd {
@@ -32,7 +32,7 @@ class DeterminateViewController: NSViewController {
labelPercentage = "\(Int(sender.floatValue * 100))%"
}
func setProgress(progress: CGFloat) {
func setProgress(_ progress: CGFloat) {
for view in self.view.subviews {
if view is DeterminateAnimation {
(view as! DeterminateAnimation).progress = progress
+2 -6
View File
@@ -13,17 +13,13 @@ class InDeterminateViewController: NSViewController {
override func viewDidAppear() {
for view in self.view.subviews {
if view is IndeterminateAnimation {
(view as! IndeterminateAnimation).animate = true
}
(view as? IndeterminateAnimation)?.animate = true
}
}
override func viewWillDisappear() {
for view in self.view.subviews {
if view is IndeterminateAnimation {
(view as! IndeterminateAnimation).animate = false
}
(view as? IndeterminateAnimation)?.animate = false
}
}
}
-3
View File
@@ -28,9 +28,6 @@ class ProgressKitTests: XCTestCase {
func testPerformanceExample() {
// This is an example of a performance test case.
self.measureBlock() {
// Put the code you want to measure the time of here.
}
}
}
+18 -18
View File
@@ -11,42 +11,42 @@ import AppKit
extension NSRect {
var mid: CGPoint {
return CGPoint(x: CGRectGetMidX(self), y: CGRectGetMidY(self))
return CGPoint(x: self.midX, y: self.midY)
}
}
extension NSBezierPath {
/// Converts NSBezierPath to CGPath
var CGPath: CGPathRef {
let path = CGPathCreateMutable()
let points = UnsafeMutablePointer<NSPoint>.alloc(3)
var CGPath: CGPath {
let path = CGMutablePath()
let points = UnsafeMutablePointer<NSPoint>.allocate(capacity: 3)
let numElements = self.elementCount
for index in 0..<numElements {
let pathType = self.elementAtIndex(index, associatedPoints: points)
let pathType = self.element(at: index, associatedPoints: points)
switch pathType {
case .MoveToBezierPathElement:
CGPathMoveToPoint(path, nil, points[0].x, points[0].y)
case .LineToBezierPathElement:
CGPathAddLineToPoint(path, nil, points[0].x, points[0].y)
case .CurveToBezierPathElement:
CGPathAddCurveToPoint(path, nil, points[0].x, points[0].y, points[1].x, points[1].y, points[2].x, points[2].y)
case .ClosePathBezierPathElement:
CGPathCloseSubpath(path)
case .moveTo:
path.move(to: points[0])
case .lineTo:
path.addLine(to: points[0])
case .curveTo:
path.addCurve(to: points[2], control1: points[0], control2: points[1])
case .closePath:
path.closeSubpath()
}
}
points.dealloc(3)
points.deallocate()
return path
}
}
func degreeToRadian(degree: Int) -> Double {
return Double(degree) * (M_PI / 180)
func degreeToRadian(_ degree: Int) -> Double {
return Double(degree) * (Double.pi / 180)
}
func radianToDegree(radian: Double) -> Int {
return Int(radian * (180 / M_PI))
func radianToDegree(_ radian: Double) -> Int {
return Int(radian * (180 / Double.pi))
}
func + (p1: CGPoint, p2: CGPoint) -> CGPoint {
+17 -6
View File
@@ -1,21 +1,27 @@
![Image](/Images/banner.gif)
![ProgressKit Banner](/Images/banner.gif)
[![Cocoapods Compatible](https://img.shields.io/cocoapods/v/ProgressKit.svg)](https://img.shields.io/cocoapods/v/ProgressKit.svg)
[![Platform](https://img.shields.io/cocoapods/p/ProgressKit.svg?style=flat)](http://cocoadocs.org/docsets/ProgressKit)
[![License](https://img.shields.io/cocoapods/l/ProgressKit.svg?style=flat)](http://cocoadocs.org/docsets/ProgressKit)
`ProgressKit` has set of cool `IBDesignable` progress views, with huge customisation options.
You can now make spinners, progress bar, crawlers etc, which nicely gets integrated according to your app theme.
You can now make spinners, progress bar, crawlers etc, which can be finely customised according to your app palette.
# Contents
- [Installation](#installation)
- [Usage](#usage)
- [Indeterminate Progress](#indeterminate-progress)
- [CircularSnail](#circularsnail)
- [MaterialProgress](#MaterialProgress)
- [Rainbow](#rainbow)
- [Crawler](#crawler)
- [Spinner](#spinner)
- [Shooting Stars](#shooting-stars)
- [Rotating Arc](#rotating-arc)
- [Determinate Progress](#determinate-progress)
- [Circular Progress] (#circular-progress)
- [Circular Progress](#circular-progress)
- [Progress Bar](#progress-bar)
- [License](#license)
@@ -30,6 +36,11 @@ use_frameworks!
pod 'ProgressKit'
```
For Swift 3 install directly from `swift-3` branch form github
```ruby
pod 'ProgressKit', :git => "https://github.com/kaunteya/ProgressKit.git", :branch => 'swift-3'
```
Then, run the following command:
@@ -43,7 +54,7 @@ $ pod install
- Set the size such that width and height are equal
- Drag `IBOutlet` to View Controller
- For `Indeterminate` Progress Views
- Set `Boolean` value to `view.animate`
- Set `true / false` to `view.animate`
- For `Determinate` Progress Views:
- Set `view.progress` to value in `0...1`
@@ -55,7 +66,7 @@ Progress indicators which animate indefinately are `Indeterminate Progress` View
This are the set of Indeterminate Progress Indicators.
## CircularSnail
## MaterialProgress
![CircularSnail](/Images/CircularSnail.gif)
## Rainbow