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