Commit 9875036d by Daniel Dahan

development: rename to Motion classes, where adding Motion as a suffix rather than a prefix

parent 63d8d3af
......@@ -30,7 +30,7 @@
import UIKit
open class Button: UIButton, MotionPulseable {
open class Button: UIButton, PulseableMotion {
/**
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
......@@ -40,10 +40,10 @@ open class Button: UIButton, MotionPulseable {
open let visualLayer = CAShapeLayer()
/// A Pulse reference.
fileprivate var pulse: MotionPulse!
fileprivate var pulse: PulseMotion!
/// MotionPulseAnimation value.
open var pulseAnimation: MotionPulseAnimation {
/// PulseMotionAnimation value.
open var pulseAnimation: PulseMotionAnimation {
get {
return pulse.animation
}
......@@ -52,7 +52,7 @@ open class Button: UIButton, MotionPulseable {
}
}
/// MotionPulseAnimation color.
/// PulseMotionAnimation color.
@IBInspectable
open var pulseColor: UIColor {
get {
......@@ -261,7 +261,7 @@ extension Button {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
pulse = PulseMotion(pulseView: self, pulseLayer: visualLayer)
}
/**
......
......@@ -31,7 +31,7 @@
import UIKit
@objc(CollectionReusableView)
open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
open class CollectionReusableView: UICollectionReusableView, PulseableMotion {
/**
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
......@@ -41,10 +41,10 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
open let visualLayer = CAShapeLayer()
/// A Pulse reference.
fileprivate var pulse: MotionPulse!
fileprivate var pulse: PulseMotion!
/// MotionPulseAnimation value.
open var pulseAnimation: MotionPulseAnimation {
/// PulseMotionAnimation value.
open var pulseAnimation: PulseMotionAnimation {
get {
return pulse.animation
}
......@@ -53,7 +53,7 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
}
}
/// MotionPulseAnimation color.
/// PulseMotionAnimation color.
@IBInspectable
open var pulseColor: UIColor {
get {
......@@ -295,7 +295,7 @@ open class CollectionReusableView: UICollectionReusableView, MotionPulseable {
extension CollectionReusableView {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
pulse = PulseMotion(pulseView: self, pulseLayer: visualLayer)
pulseAnimation = .none
}
......
......@@ -31,7 +31,7 @@
import UIKit
@objc(CollectionViewCell)
open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
open class CollectionViewCell: UICollectionViewCell, PulseableMotion {
/**
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
......@@ -41,10 +41,10 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
open let visualLayer = CAShapeLayer()
/// A Pulse reference.
fileprivate var pulse: MotionPulse!
fileprivate var pulse: PulseMotion!
/// MotionPulseAnimation value.
open var pulseAnimation: MotionPulseAnimation {
/// PulseMotionAnimation value.
open var pulseAnimation: PulseMotionAnimation {
get {
return pulse.animation
}
......@@ -53,7 +53,7 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
}
}
/// MotionPulseAnimation color.
/// PulseMotionAnimation color.
@IBInspectable
open var pulseColor: UIColor {
get {
......@@ -256,7 +256,7 @@ open class CollectionViewCell: UICollectionViewCell, MotionPulseable {
extension CollectionViewCell {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
pulse = PulseMotion(pulseView: self, pulseLayer: visualLayer)
}
/// Prepares the visualLayer property.
......
......@@ -53,12 +53,12 @@ public protocol FABMenuDelegate {
@objc(FABMenu)
open class FABMenu: View, MotionSpringable {
/// A reference to the MotionSpring object.
internal let spring = MotionSpring()
open class FABMenu: View, SpringableMotion {
/// A reference to the SpringMotion object.
internal let spring = SpringMotion()
/// The direction in which the animation opens the menu.
open var springDirection = MotionSpringDirection.up {
open var springDirection = SpringMotionDirection.up {
didSet {
layoutSubviews()
}
......
......@@ -66,7 +66,8 @@ extension Motion {
animation.keyPath = AnimationKeyPath.position.rawValue
animation.path = bezierPath.cgPath
animation.rotationMode = AnimationRotationModeToValue(mode: mode)
if let v = duration {
if let v = duration {
animation.duration = v
}
return animation
......
......@@ -53,15 +53,15 @@ public protocol MenuDelegate {
@objc(Menu)
open class Menu: View, MotionSpringable {
/// A reference to the MotionSpring object.
internal let spring = MotionSpring()
open class Menu: View, SpringableMotion {
/// A reference to the SpringMotion object.
internal let spring = SpringMotion()
/// An optional delegation handler.
open weak var delegate: MenuDelegate?
/// The direction in which the animation opens the menu.
open var springDirection = MotionSpringDirection.up {
open var springDirection = SpringMotionDirection.up {
didSet {
layoutSubviews()
}
......
......@@ -30,8 +30,8 @@
import UIKit
@objc(MotionPulseAnimation)
public enum MotionPulseAnimation: Int {
@objc(PulseMotionAnimation)
public enum PulseMotionAnimation: Int {
case none
case center
case centerWithBacking
......@@ -42,9 +42,9 @@ public enum MotionPulseAnimation: Int {
case pointWithBacking
}
public protocol MotionPulseable {
/// A reference to the MotionPulseAnimation.
var pulseAnimation: MotionPulseAnimation { get set }
public protocol PulseableMotion {
/// A reference to the PulseMotionAnimation.
var pulseAnimation: PulseMotionAnimation { get set }
/// A UIColor.
var pulseColor: UIColor { get set }
......@@ -53,8 +53,8 @@ public protocol MotionPulseable {
var pulseOpacity: CGFloat { get set }
}
public struct MotionPulse {
/// A UIView that is MotionPulseable.
public struct PulseMotion {
/// A UIView that is PulseableMotion.
fileprivate weak var pulseView: UIView?
/// The layer the pulse layers are added to.
......@@ -63,8 +63,8 @@ public struct MotionPulse {
/// Pulse layers.
fileprivate var layers = [CAShapeLayer]()
/// A reference to the MotionPulseAnimation.
public var animation = MotionPulseAnimation.pointWithBacking
/// A reference to the PulseMotionAnimation.
public var animation = PulseMotionAnimation.pointWithBacking
/// A UIColor.
public var color = Color.grey.base
......@@ -83,7 +83,7 @@ public struct MotionPulse {
}
}
extension MotionPulse {
extension PulseMotion {
/**
Triggers the expanding animation.
- Parameter point: A point to pulse from.
......@@ -161,7 +161,7 @@ extension MotionPulse {
}
}
extension MotionPulse {
extension PulseMotion {
/// Triggers the contracting animation.
public mutating func contract() {
guard let bLayer = layers.popLast() else {
......
......@@ -30,12 +30,12 @@
import UIKit
open class PulseView: View, MotionPulseable {
open class PulseView: View, PulseableMotion {
/// A Pulse reference.
fileprivate var pulse: MotionPulse!
fileprivate var pulse: PulseMotion!
/// MotionPulseAnimation value.
open var pulseAnimation: MotionPulseAnimation {
/// PulseMotionAnimation value.
open var pulseAnimation: PulseMotionAnimation {
get {
return pulse.animation
}
......@@ -44,7 +44,7 @@ open class PulseView: View, MotionPulseable {
}
}
/// MotionPulseAnimation color.
/// PulseMotionAnimation color.
@IBInspectable
open var pulseColor: UIColor {
get {
......@@ -129,6 +129,6 @@ open class PulseView: View, MotionPulseable {
extension PulseView {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
pulse = PulseMotion(pulseView: self, pulseLayer: visualLayer)
}
}
......@@ -30,22 +30,22 @@
import UIKit
@objc(MotionSpringDirection)
public enum MotionSpringDirection: Int {
@objc(SpringMotionDirection)
public enum SpringMotionDirection: Int {
case up
case down
case left
case right
}
public protocol MotionSpringable {
/// A MotionSpringDirection value.
var springDirection: MotionSpringDirection { get set }
public protocol SpringableMotion {
/// A SpringMotionDirection value.
var springDirection: SpringMotionDirection { get set }
}
open class MotionSpring {
/// A MotionSpringDirection value.
open var direction = MotionSpringDirection.up
open class SpringMotion {
/// A SpringMotionDirection value.
open var direction = SpringMotionDirection.up
/// A Boolean that indicates if the menu is open or not.
open var isOpened = false
......@@ -111,7 +111,7 @@ open class MotionSpring {
}
}
extension MotionSpring {
extension SpringMotion {
/// Disable the Menu if views exist.
fileprivate func disable() {
guard 0 < views.count else {
......@@ -134,7 +134,7 @@ extension MotionSpring {
}
}
extension MotionSpring {
extension SpringMotion {
/**
Expands the Spring component with animation options.
- Parameter duration: The time for each view's animation.
......@@ -194,7 +194,7 @@ extension MotionSpring {
}
}
extension MotionSpring {
extension SpringMotion {
/**
Handles the animation open completion.
- Parameter view: A UIView.
......@@ -227,7 +227,7 @@ extension MotionSpring {
}
}
extension MotionSpring {
extension SpringMotion {
/**
Open the Menu component with animation options in the Up direction.
- Parameter duration: The time for each view's animation.
......
......@@ -30,7 +30,7 @@
import UIKit
open class TableViewCell: UITableViewCell, MotionPulseable {
open class TableViewCell: UITableViewCell, PulseableMotion {
/**
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
......@@ -40,10 +40,10 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
open let visualLayer = CAShapeLayer()
/// A Pulse reference.
fileprivate var pulse: MotionPulse!
fileprivate var pulse: PulseMotion!
/// MotionPulseAnimation value.
open var pulseAnimation: MotionPulseAnimation {
/// PulseMotionAnimation value.
open var pulseAnimation: PulseMotionAnimation {
get {
return pulse.animation
}
......@@ -52,7 +52,7 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
}
}
/// MotionPulseAnimation color.
/// PulseMotionAnimation color.
@IBInspectable
open var pulseColor: UIColor {
get {
......@@ -177,7 +177,7 @@ open class TableViewCell: UITableViewCell, MotionPulseable {
extension TableViewCell {
/// Prepares the pulse motion.
fileprivate func preparePulse() {
pulse = MotionPulse(pulseView: self, pulseLayer: visualLayer)
pulse = PulseMotion(pulseView: self, pulseLayer: visualLayer)
}
/// Prepares the visualLayer property.
......
......@@ -30,16 +30,16 @@
import UIKit
@objc(AnimationTransition)
public enum AnimationTransition: Int {
@objc(TransitionMotion)
public enum TransitionMotion: Int {
case fade
case moveIn
case push
case reveal
}
@objc(AnimationTransitionDirection)
public enum AnimationTransitionDirection: Int {
@objc(TransitionMotionDirection)
public enum TransitionMotionDirection: Int {
case `default`
case right
case left
......@@ -48,11 +48,11 @@ public enum AnimationTransitionDirection: Int {
}
/**
Converts an AnimationTransition to a corresponding CATransition key.
- Parameter transition: An AnimationTransition.
Converts an TransitionMotion to a corresponding CATransition key.
- Parameter transition: An TransitionMotion.
- Returns: A CATransition key String.
*/
public func AnimationTransitionToValue(transition type: AnimationTransition) -> String {
public func TransitionMotionToValue(transition type: TransitionMotion) -> String {
switch type {
case .fade:
return kCATransitionFade
......@@ -66,11 +66,11 @@ public func AnimationTransitionToValue(transition type: AnimationTransition) ->
}
/**
Converts an AnimationTransitionDirection to a corresponding CATransition direction key.
- Parameter direction: An AnimationTransitionDirection.
Converts an TransitionMotionDirection to a corresponding CATransition direction key.
- Parameter direction: An TransitionMotionDirection.
- Returns: An optional CATransition direction key String.
*/
public func AnimationTransitionDirectionToValue(direction: AnimationTransitionDirection) -> String? {
public func TransitionMotionDirectionToValue(direction: TransitionMotionDirection) -> String? {
switch direction {
case .default:
return nil
......@@ -88,15 +88,15 @@ public func AnimationTransitionDirectionToValue(direction: AnimationTransitionDi
extension Motion {
/**
Creates a CATransition animation.
- Parameter type: An AnimationTransition.
- Parameter direction: An optional AnimationTransitionDirection.
- Parameter type: An TransitionMotion.
- Parameter direction: An optional TransitionMotionDirection.
- Parameter duration: An optional duration time.
- Returns: A CATransition.
*/
public static func transition(type: AnimationTransition, direction: AnimationTransitionDirection = .default, duration: CFTimeInterval? = nil) -> CATransition {
public static func transition(type: TransitionMotion, direction: TransitionMotionDirection = .default, duration: CFTimeInterval? = nil) -> CATransition {
let animation = CATransition()
animation.type = AnimationTransitionToValue(transition: type)
animation.subtype = AnimationTransitionDirectionToValue(direction: direction)
animation.type = TransitionMotionToValue(transition: type)
animation.subtype = TransitionMotionDirectionToValue(direction: direction)
if let v = duration {
animation.duration = v
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment