Skip to content

Commit

Permalink
remove unused protocols
Browse files Browse the repository at this point in the history
  • Loading branch information
AugustRush committed May 9, 2017
1 parent ff0107b commit 6c57962
Show file tree
Hide file tree
Showing 8 changed files with 110 additions and 167 deletions.
6 changes: 1 addition & 5 deletions Sources/AttachmentConfigurable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,5 @@
import UIKit

public protocol AttachmentConfigurable: BasicChainable {
func attachment(_ damping: CGFloat, frequency: CGFloat) -> AttachmentConfigurable
}

public protocol AttachmentConfigurable1: BasicChainable1 {
func attachment(_ damping: CGFloat, frequency: CGFloat) -> AttachmentConfigurable1
func attachment(_ damping: CGFloat, frequency: CGFloat) -> Self
}
85 changes: 28 additions & 57 deletions Sources/BasicChainable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,61 +9,32 @@
import UIKit

public protocol BasicChainable: Chainable {
func moveX(_ increment: CGFloat) -> UIView
func moveY(_ increment: CGFloat) -> UIView
func moveTo(_ point: CGPoint) -> UIView
func makeColor(_ color: UIColor) -> UIView
func makeAlpha(_ alpha: CGFloat) -> UIView
func rotate(_ z: CGFloat) -> UIView
func rotateX(_ x: CGFloat) -> UIView
func rotateY(_ y: CGFloat) -> UIView
func rotateXY(_ xy: CGFloat) -> UIView
func makeWidth(_ width: CGFloat) -> UIView
func makeHeight(_ height: CGFloat) -> UIView
func makeSize(_ size: CGSize) -> UIView
func makeFrame(_ frame: CGRect) -> UIView
func makeBounds(_ bounds: CGRect) -> UIView
func scaleX(_ x: CGFloat) -> UIView
func scaleY(_ y: CGFloat) -> UIView
func scaleXY(_ x: CGFloat, _ y: CGFloat) -> UIView
func cornerRadius(_ radius: CGFloat) -> UIView
func borderWidth(_ width: CGFloat) -> UIView
func shadowRadius(_ radius: CGFloat) -> UIView
func zPosition(_ position: CGFloat) -> UIView
func anchorPoint(_ point: CGPoint) -> UIView
func anchorPointZ(_ z: CGFloat) -> UIView
func shadowOffset(_ offset: CGSize) -> UIView
func shadowColor(_ color: UIColor) -> UIView
func shadowOpacity(_ opacity: Float) -> UIView
func makeTintColor(_ color: UIColor) -> UIView
func completion(_ c: @escaping () -> Void) -> UIView
}

//CALayer
public protocol BasicChainable1: Chainable1 {
func moveTo(_ point: CGPoint) -> CALayer
func makeColor(_ color: UIColor) -> CALayer
func makeOpacity(_ opacity: Float) -> CALayer
func rotate(_ z: CGFloat) -> CALayer
func rotateX(_ x: CGFloat) -> CALayer
func rotateY(_ y: CGFloat) -> CALayer
func rotateXY(_ xy: CGFloat) -> CALayer
func makeWidth(_ width: CGFloat) -> CALayer
func makeHeight(_ height: CGFloat) -> CALayer
func makeSize(_ size: CGSize) -> CALayer
func makeFrame(_ frame: CGRect) -> CALayer
func makeBounds(_ bounds: CGRect) -> CALayer
func scaleX(_ x: CGFloat) -> CALayer
func scaleY(_ y: CGFloat) -> CALayer
func scaleXY(_ x: CGFloat, _ y: CGFloat) -> CALayer
func cornerRadius(_ radius: CGFloat) -> CALayer
func borderWidth(_ width: CGFloat) -> CALayer
func shadowRadius(_ radius: CGFloat) -> CALayer
func zPosition(_ position: CGFloat) -> CALayer
func anchorPoint(_ point: CGPoint) -> CALayer
func anchorPointZ(_ z: CGFloat) -> CALayer
func shadowOffset(_ offset: CGSize) -> CALayer
func shadowColor(_ color: UIColor) -> CALayer
func shadowOpacity(_ opacity: Float) -> CALayer
func completion(_ c: @escaping () -> Void) -> CALayer
// func moveX(_ increment: CGFloat) -> Self
// func moveY(_ increment: CGFloat) -> Self
func moveTo(_ point: CGPoint) -> Self
func makeColor(_ color: UIColor) -> Self
// func makeAlpha(_ alpha: CGFloat) -> Self
func rotate(_ z: CGFloat) -> Self
func rotateX(_ x: CGFloat) -> Self
func rotateY(_ y: CGFloat) -> Self
func rotateXY(_ xy: CGFloat) -> Self
func makeWidth(_ width: CGFloat) -> Self
func makeHeight(_ height: CGFloat) -> Self
func makeSize(_ size: CGSize) -> Self
func makeFrame(_ frame: CGRect) -> Self
func makeBounds(_ bounds: CGRect) -> Self
func scaleX(_ x: CGFloat) -> Self
func scaleY(_ y: CGFloat) -> Self
func scaleXY(_ x: CGFloat, _ y: CGFloat) -> Self
func cornerRadius(_ radius: CGFloat) -> Self
func borderWidth(_ width: CGFloat) -> Self
func shadowRadius(_ radius: CGFloat) -> Self
func zPosition(_ position: CGFloat) -> Self
func anchorPoint(_ point: CGPoint) -> Self
func anchorPointZ(_ z: CGFloat) -> Self
func shadowOffset(_ offset: CGSize) -> Self
func shadowColor(_ color: UIColor) -> Self
func shadowOpacity(_ opacity: Float) -> Self
func makeTintColor(_ color: UIColor) -> Self
func completion(_ c: @escaping () -> Void) -> Self
}
19 changes: 5 additions & 14 deletions Sources/BasicConfigurable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,9 @@
import UIKit

public protocol BasicConfigurable: BasicChainable {
func duration(_ d: CFTimeInterval) -> BasicConfigurable
func easing(_ type: TimingFunctionType) -> BasicConfigurable
func delay(_ d: CFTimeInterval) -> BasicConfigurable
func autoreverses() -> BasicConfigurable
func repeatCount(_ count: Int) -> BasicConfigurable
}

//CALayer
public protocol BasicConfigurable1: BasicChainable1 {
func duration(_ d: CFTimeInterval) -> BasicConfigurable1
func easing(_ type: TimingFunctionType) -> BasicConfigurable1
func delay(_ d: CFTimeInterval) -> BasicConfigurable1
func autoreverses() -> BasicConfigurable1
func repeatCount(_ count: Int) -> BasicConfigurable1
func duration(_ d: CFTimeInterval) -> Self
func easing(_ type: TimingFunctionType) -> Self
func delay(_ d: CFTimeInterval) -> Self
func autoreverses() -> Self
func repeatCount(_ count: Int) -> Self
}
72 changes: 36 additions & 36 deletions Sources/CALayer+Stellar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,213 +8,213 @@

import UIKit

extension CALayer: BasicConfigurable1, SnapConfigurable1, AttachmentConfigurable1, GravityConfigurable1, StepControllable {
extension CALayer: BasicConfigurable, SnapConfigurable, AttachmentConfigurable, GravityConfigurable, StepControllable {

//MARK: animation methods
public func moveTo(_ point: CGPoint) -> CALayer {
public func moveTo(_ point: CGPoint) -> Self {
let type = AnimationType(type: .basic, subType: .moveTo(point))
context.addAnimationType(type)
return self
}

public func makeColor(_ color: UIColor) -> CALayer {
public func makeColor(_ color: UIColor) -> Self {
let type = AnimationType(type: .basic, subType: .color(color))
context.addAnimationType(type)
return self
}

public func makeOpacity(_ opacity: Float) -> CALayer {
public func makeOpacity(_ opacity: Float) -> Self {
let type = AnimationType(type: .basic, subType: .opacity(opacity))
context.addAnimationType(type)
return self
}

public func rotate(_ z: CGFloat) -> CALayer {
public func rotate(_ z: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .rotate(z))
context.addAnimationType(type)
return self
}

public func rotateX(_ x: CGFloat) -> CALayer {
public func rotateX(_ x: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .rotateX(x))
context.addAnimationType(type)
return self
}

public func rotateY(_ y: CGFloat) -> CALayer {
public func rotateY(_ y: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .rotateY(y))
context.addAnimationType(type)
return self
}

public func rotateXY(_ xy: CGFloat) -> CALayer {
public func rotateXY(_ xy: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .rotateXY(xy))
context.addAnimationType(type)
return self
}

public func makeWidth(_ width: CGFloat) -> CALayer {
public func makeWidth(_ width: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .width(width))
context.addAnimationType(type)
return self
}

public func makeHeight(_ height: CGFloat) -> CALayer {
public func makeHeight(_ height: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .height(height))
context.addAnimationType(type)
return self
}

public func makeSize(_ size: CGSize) -> CALayer {
public func makeSize(_ size: CGSize) -> Self {
let type = AnimationType(type: .basic, subType: .size(size))
context.addAnimationType(type)
return self
}

public func makeFrame(_ frame: CGRect) -> CALayer {
public func makeFrame(_ frame: CGRect) -> Self {
let type = AnimationType(type: .basic, subType: .frame(frame))
context.addAnimationType(type)
return self
}

public func makeBounds(_ bounds: CGRect) -> CALayer {
public func makeBounds(_ bounds: CGRect) -> Self {
let type = AnimationType(type: .basic, subType: .bounds(bounds))
context.addAnimationType(type)
return self
}

public func scaleX(_ x: CGFloat) -> CALayer {
public func scaleX(_ x: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .scaleX(x))
context.addAnimationType(type)
return self
}

public func scaleY(_ y: CGFloat) -> CALayer {
public func scaleY(_ y: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .scaleY(y))
context.addAnimationType(type)
return self
}

public func scaleXY(_ x: CGFloat, _ y: CGFloat) -> CALayer {
public func scaleXY(_ x: CGFloat, _ y: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .scaleXY(x,y))
context.addAnimationType(type)
return self
}

public func cornerRadius(_ radius: CGFloat) -> CALayer {
public func cornerRadius(_ radius: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .cornerRadius(radius))
context.addAnimationType(type)
return self
}

public func borderWidth(_ width: CGFloat) -> CALayer {
public func borderWidth(_ width: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .borderWidth(width))
context.addAnimationType(type)
return self
}

public func shadowRadius(_ radius: CGFloat) -> CALayer {
public func shadowRadius(_ radius: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .shadowRadius(radius))
context.addAnimationType(type)
return self
}

public func zPosition(_ position: CGFloat) -> CALayer {
public func zPosition(_ position: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .zPosition(position))
context.addAnimationType(type)
return self
}

public func anchorPoint(_ point: CGPoint) -> CALayer {
public func anchorPoint(_ point: CGPoint) -> Self {
let type = AnimationType(type: .basic, subType: .anchorPoint(point))
context.addAnimationType(type)
return self
}

public func anchorPointZ(_ z: CGFloat) -> CALayer {
public func anchorPointZ(_ z: CGFloat) -> Self {
let type = AnimationType(type: .basic, subType: .anchorPointZ(z))
context.addAnimationType(type)
return self
}

public func shadowOffset(_ offset: CGSize) -> CALayer {
public func shadowOffset(_ offset: CGSize) -> Self {
let type = AnimationType(type: .basic, subType: .shadowOffset(offset))
context.addAnimationType(type)
return self
}

public func shadowColor(_ color: UIColor) -> CALayer {
public func shadowColor(_ color: UIColor) -> Self {
let type = AnimationType(type: .basic, subType: .shadowColor(color))
context.addAnimationType(type)
return self
}

public func shadowOpacity(_ opacity: Float) -> CALayer {
public func shadowOpacity(_ opacity: Float) -> Self {
let type = AnimationType(type: .basic, subType: .shadowOpacity(opacity))
context.addAnimationType(type)
return self
}

public func makeTintColor(_ color: UIColor) -> CALayer {
public func makeTintColor(_ color: UIColor) -> Self {
let type = AnimationType(type: .basic, subType: .tintColor(color))
context.addAnimationType(type)
return self
}

public func completion(_ c: @escaping () -> Void) -> CALayer {
public func completion(_ c: @escaping () -> Void) -> Self {
context.changeCompletion(c)
return self
}

//MARK: Physical Animation

//Snap
public func snap(_ damping: CGFloat = 0.5) -> SnapConfigurable1 {
public func snap(_ damping: CGFloat = 0.5) -> Self {
context.changeMainType(.snap(damping))
return self
}

//Attachment
public func attachment(_ damping: CGFloat = 0.5, frequency: CGFloat = 0.5) -> AttachmentConfigurable1 {
public func attachment(_ damping: CGFloat = 0.5, frequency: CGFloat = 0.5) -> Self {
context.changeMainType(.attachment(damping, frequency))
return self
}

//Gravity
public func gravity(_ magnitude: Double = 1.0) -> GravityConfigurable1 {
public func gravity(_ magnitude: Double = 1.0) -> Self {
context.changeMainType(.gravity(magnitude))
return self
}

//MARK: Basic Animation configurations
public func duration(_ d: CFTimeInterval) -> BasicConfigurable1 {
public func duration(_ d: CFTimeInterval) -> Self {
context.changeDuration(d)
return self
}

public func easing(_ type: TimingFunctionType) -> BasicConfigurable1 {
public func easing(_ type: TimingFunctionType) -> Self {
context.changeEasing(type)
return self
}

public func delay(_ d: CFTimeInterval) -> BasicConfigurable1 {
public func delay(_ d: CFTimeInterval) -> Self {
context.changeDelay(d)
return self
}

public func autoreverses() -> BasicConfigurable1 {
public func autoreverses() -> Self {
context.changeAutoreverses(true)
return self
}

public func repeatCount(_ count: Int) -> BasicConfigurable1 {
public func repeatCount(_ count: Int) -> Self {
context.changeRepeatCount(count)
return self
}

//MARK: Chainable methods

public func then() -> CALayer {
public func then() -> Self {
context.makeNextStep()
return self
}
Expand Down
9 changes: 1 addition & 8 deletions Sources/Chainable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@ import UIKit

public protocol Chainable {
//Chainable methods
func then() -> UIView
func animate() -> Void
}

//CALayer
public protocol Chainable1 {
//Chainable methods
func then() -> CALayer
func then() -> Self
func animate() -> Void
}
Loading

0 comments on commit 6c57962

Please sign in to comment.