Commit 13bc2246 by Daniel Dahan

update to MaterialAnimation interface

parent 2017544d
...@@ -20,8 +20,8 @@ import UIKit ...@@ -20,8 +20,8 @@ import UIKit
@objc(MaterialCollectionViewCellDelegate) @objc(MaterialCollectionViewCellDelegate)
public protocol MaterialCollectionViewCellDelegate : MaterialDelegate { public protocol MaterialCollectionViewCellDelegate : MaterialDelegate {
optional func materialCollectionViewCellWillRevealLeftLayer(cell: MaterialCollectionViewCell) optional func materialCollectionViewCellWillPassThresholdForLeftLayer(cell: MaterialCollectionViewCell)
optional func materialCollectionViewCellWillRevealRightLayer(cell: MaterialCollectionViewCell) optional func materialCollectionViewCellWillPassThresholdForRightLayer(cell: MaterialCollectionViewCell)
optional func materialCollectionViewCellDidRevealLeftLayer(cell: MaterialCollectionViewCell) optional func materialCollectionViewCellDidRevealLeftLayer(cell: MaterialCollectionViewCell)
optional func materialCollectionViewCellDidRevealRightLayer(cell: MaterialCollectionViewCell) optional func materialCollectionViewCellDidRevealRightLayer(cell: MaterialCollectionViewCell)
optional func materialCollectionViewCellDidCloseLeftLayer(cell: MaterialCollectionViewCell) optional func materialCollectionViewCellDidCloseLeftLayer(cell: MaterialCollectionViewCell)
...@@ -68,7 +68,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell, UIGestureRecogni ...@@ -68,7 +68,7 @@ public class MaterialCollectionViewCell : UICollectionViewCell, UIGestureRecogni
/** /**
:name: delegate :name: delegate
*/ */
public weak var delegate: MaterialDelegate? public weak var delegate: MaterialCollectionViewCellDelegate?
/** /**
:name: pulseScale :name: pulseScale
...@@ -496,16 +496,16 @@ public class MaterialCollectionViewCell : UICollectionViewCell, UIGestureRecogni ...@@ -496,16 +496,16 @@ public class MaterialCollectionViewCell : UICollectionViewCell, UIGestureRecogni
if !revealed && (leftOnDragRelease || rightOnDragRelease) { if !revealed && (leftOnDragRelease || rightOnDragRelease) {
revealed = true revealed = true
if leftOnDragRelease { if leftOnDragRelease {
(delegate as? MaterialCollectionViewCellDelegate)?.materialCollectionViewCellWillRevealLeftLayer?(self) delegate?.materialCollectionViewCellWillPassThresholdForLeftLayer?(self)
} else if rightOnDragRelease { } else if rightOnDragRelease {
(delegate as? MaterialCollectionViewCellDelegate)?.materialCollectionViewCellWillRevealRightLayer?(self) delegate?.materialCollectionViewCellWillPassThresholdForRightLayer?(self)
} }
} }
if leftOnDragRelease { if leftOnDragRelease {
(delegate as? MaterialCollectionViewCellDelegate)?.materialCollectionViewCellDidRevealLeftLayer?(self) delegate?.materialCollectionViewCellDidRevealLeftLayer?(self)
} else if rightOnDragRelease { } else if rightOnDragRelease {
(delegate as? MaterialCollectionViewCellDelegate)?.materialCollectionViewCellDidRevealRightLayer?(self) delegate?.materialCollectionViewCellDidRevealRightLayer?(self)
} }
case .Ended: case .Ended:
...@@ -517,9 +517,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell, UIGestureRecogni ...@@ -517,9 +517,9 @@ public class MaterialCollectionViewCell : UICollectionViewCell, UIGestureRecogni
animation(a) animation(a)
if leftOnDragRelease { if leftOnDragRelease {
(delegate as? MaterialCollectionViewCellDelegate)?.materialCollectionViewCellDidCloseLeftLayer?(self) delegate?.materialCollectionViewCellDidCloseLeftLayer?(self)
} else if rightOnDragRelease { } else if rightOnDragRelease {
(delegate as? MaterialCollectionViewCellDelegate)?.materialCollectionViewCellDidCloseRightLayer?(self) delegate?.materialCollectionViewCellDidCloseRightLayer?(self)
} }
default: default:
......
...@@ -71,11 +71,11 @@ public extension MaterialAnimation { ...@@ -71,11 +71,11 @@ public extension MaterialAnimation {
/** /**
:name: transition :name: transition
*/ */
public static func transition(type: MaterialAnimationTransition, subtype: MaterialAnimationTransitionSubType? = nil, duration: CFTimeInterval? = nil) -> CATransition { public static func transition(type: MaterialAnimationTransition, direction: MaterialAnimationTransitionSubType? = nil, duration: CFTimeInterval? = nil) -> CATransition {
let animation: CATransition = CATransition() let animation: CATransition = CATransition()
animation.type = MaterialAnimationTransitionToValue(type) animation.type = MaterialAnimationTransitionToValue(type)
if let s = subtype { if let d = direction {
animation.subtype = MaterialAnimationTransitionSubTypeToValue(s) animation.subtype = MaterialAnimationTransitionSubTypeToValue(d)
} }
if let d = duration { if let d = duration {
animation.duration = d animation.duration = d
......
...@@ -327,6 +327,13 @@ public class MaterialView : UIView { ...@@ -327,6 +327,13 @@ public class MaterialView : UIView {
} }
/** /**
:name: actionForLayer
*/
public override func actionForLayer(layer: CALayer, forKey event: String) -> CAAction? {
return nil
}
/**
:name: animation :name: animation
*/ */
public func animation(animation: CAAnimation) { public func animation(animation: CAAnimation) {
......
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