Commit f45e8ec6 by Daniel Dahan

development: cleanup to Pulse API when calling pulse method

parent 0372b3bc
...@@ -720,13 +720,13 @@ ...@@ -720,13 +720,13 @@
96BCB8051CB40F9C00C806FE /* Collection */ = { 96BCB8051CB40F9C00C806FE /* Collection */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
96BCB7711CB40DC500C806FE /* CollectionView.swift */,
96BCB7721CB40DC500C806FE /* CollectionViewCell.swift */, 96BCB7721CB40DC500C806FE /* CollectionViewCell.swift */,
966ECF291CF4C20100BB0BDF /* CollectionReusableView.swift */,
96BCB7711CB40DC500C806FE /* CollectionView.swift */,
96BCB7771CB40DC500C806FE /* CollectionDataSourceItem.swift */,
96BCB7731CB40DC500C806FE /* CollectionViewDataSource.swift */, 96BCB7731CB40DC500C806FE /* CollectionViewDataSource.swift */,
96BCB7741CB40DC500C806FE /* CollectionViewDelegate.swift */, 96BCB7741CB40DC500C806FE /* CollectionViewDelegate.swift */,
96BCB7751CB40DC500C806FE /* CollectionViewLayout.swift */, 96BCB7751CB40DC500C806FE /* CollectionViewLayout.swift */,
966ECF291CF4C20100BB0BDF /* CollectionReusableView.swift */,
96BCB7771CB40DC500C806FE /* CollectionDataSourceItem.swift */,
); );
name = Collection; name = Collection;
sourceTree = "<group>"; sourceTree = "<group>";
......
...@@ -40,7 +40,7 @@ open class Button: UIButton, Pulseable { ...@@ -40,7 +40,7 @@ open class Button: UIButton, Pulseable {
open let visualLayer = CAShapeLayer() open let visualLayer = CAShapeLayer()
/// A Pulse reference. /// A Pulse reference.
open fileprivate(set) var pulse: Pulse! fileprivate var pulse: Pulse!
/// PulseAnimation value. /// PulseAnimation value.
open var pulseAnimation: PulseAnimation { open var pulseAnimation: PulseAnimation {
...@@ -176,14 +176,11 @@ open class Button: UIButton, Pulseable { ...@@ -176,14 +176,11 @@ open class Button: UIButton, Pulseable {
from the center. from the center.
*/ */
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p = point ?? center
pulse.expandAnimation(point: p) pulse.expandAnimation(point: p)
Motion.delay(time: 0.35) { [weak self] in Motion.delay(time: 0.35) { [weak self] in
guard let s = self else { self?.pulse.contractAnimation()
return
}
s.pulse.contractAnimation()
} }
} }
......
...@@ -41,7 +41,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable { ...@@ -41,7 +41,7 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable {
open let visualLayer = CAShapeLayer() open let visualLayer = CAShapeLayer()
/// A Pulse reference. /// A Pulse reference.
open fileprivate(set) var pulse: Pulse! fileprivate var pulse: Pulse!
/// PulseAnimation value. /// PulseAnimation value.
open var pulseAnimation: PulseAnimation { open var pulseAnimation: PulseAnimation {
...@@ -237,14 +237,11 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable { ...@@ -237,14 +237,11 @@ open class CollectionReusableView: UICollectionReusableView, Pulseable {
from the center. from the center.
*/ */
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p = point ?? center
pulse.expandAnimation(point: p) pulse.expandAnimation(point: p)
Motion.delay(time: 0.35) { [weak self] in Motion.delay(time: 0.35) { [weak self] in
guard let s = self else { self?.pulse.contractAnimation()
return
}
s.pulse.contractAnimation()
} }
} }
......
...@@ -120,7 +120,7 @@ open class CollectionView: UICollectionView { ...@@ -120,7 +120,7 @@ open class CollectionView: UICollectionView {
*/ */
open func prepare() { open func prepare() {
contentScaleFactor = Screen.scale contentScaleFactor = Screen.scale
backgroundColor = .clear backgroundColor = nil
contentEdgeInsets = .zero contentEdgeInsets = .zero
} }
} }
...@@ -41,7 +41,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable { ...@@ -41,7 +41,7 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable {
open let visualLayer = CAShapeLayer() open let visualLayer = CAShapeLayer()
/// A Pulse reference. /// A Pulse reference.
open fileprivate(set) var pulse: Pulse! fileprivate var pulse: Pulse!
/// PulseAnimation value. /// PulseAnimation value.
open var pulseAnimation: PulseAnimation { open var pulseAnimation: PulseAnimation {
...@@ -237,14 +237,11 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable { ...@@ -237,14 +237,11 @@ open class CollectionViewCell: UICollectionViewCell, Pulseable {
from the center. from the center.
*/ */
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p = point ?? center
pulse.expandAnimation(point: p) pulse.expandAnimation(point: p)
Motion.delay(time: 0.35) { [weak self] in Motion.delay(time: 0.35) { [weak self] in
guard let s = self else { self?.pulse.contractAnimation()
return
}
s.pulse.contractAnimation()
} }
} }
......
...@@ -30,6 +30,4 @@ ...@@ -30,6 +30,4 @@
import UIKit import UIKit
public protocol CollectionViewDelegate: UICollectionViewDelegate { public protocol CollectionViewDelegate: UICollectionViewDelegate {}
}
...@@ -134,7 +134,7 @@ open class Layer: CAShapeLayer { ...@@ -134,7 +134,7 @@ open class Layer: CAShapeLayer {
*/ */
public override init(layer: Any) { public override init(layer: Any) {
contentsGravityPreset = .resizeAspectFill contentsGravityPreset = .resizeAspectFill
super.init() super.init(layer: layer)
prepareVisualLayer() prepareVisualLayer()
} }
......
...@@ -32,7 +32,7 @@ import UIKit ...@@ -32,7 +32,7 @@ import UIKit
open class PulseView: View, Pulseable { open class PulseView: View, Pulseable {
/// A Pulse reference. /// A Pulse reference.
open fileprivate(set) var pulse: Pulse! fileprivate var pulse: Pulse!
/// PulseAnimation value. /// PulseAnimation value.
open var pulseAnimation: PulseAnimation { open var pulseAnimation: PulseAnimation {
...@@ -72,14 +72,11 @@ open class PulseView: View, Pulseable { ...@@ -72,14 +72,11 @@ open class PulseView: View, Pulseable {
from the center. from the center.
*/ */
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p = point ?? center
pulse.expandAnimation(point: p) pulse.expandAnimation(point: p)
Motion.delay(time: 0.35) { [weak self] in Motion.delay(time: 0.35) { [weak self] in
guard let s = self else { self?.pulse.contractAnimation()
return
}
s.pulse.contractAnimation()
} }
} }
......
...@@ -40,7 +40,7 @@ open class TableViewCell: UITableViewCell, Pulseable { ...@@ -40,7 +40,7 @@ open class TableViewCell: UITableViewCell, Pulseable {
open let visualLayer = CAShapeLayer() open let visualLayer = CAShapeLayer()
/// A Pulse reference. /// A Pulse reference.
open fileprivate(set) var pulse: Pulse! fileprivate var pulse: Pulse!
/// PulseAnimation value. /// PulseAnimation value.
open var pulseAnimation: PulseAnimation { open var pulseAnimation: PulseAnimation {
...@@ -114,14 +114,11 @@ open class TableViewCell: UITableViewCell, Pulseable { ...@@ -114,14 +114,11 @@ open class TableViewCell: UITableViewCell, Pulseable {
from the center. from the center.
*/ */
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p = point ?? center
pulse.expandAnimation(point: p) pulse.expandAnimation(point: p)
Motion.delay(time: 0.35) { [weak self] in Motion.delay(time: 0.35) { [weak self] in
guard let s = self else { self?.pulse.contractAnimation()
return
}
s.pulse.contractAnimation()
} }
} }
......
...@@ -105,7 +105,7 @@ open class View: UIView { ...@@ -105,7 +105,7 @@ open class View: UIView {
/// A Preset for the contentsGravity property. /// A Preset for the contentsGravity property.
@IBInspectable @IBInspectable
open var contentsGravityPreset = Gravity.resize { open var contentsGravityPreset: Gravity {
didSet { didSet {
contentsGravity = GravityToValue(gravity: contentsGravityPreset) contentsGravity = GravityToValue(gravity: contentsGravityPreset)
} }
...@@ -135,6 +135,7 @@ open class View: UIView { ...@@ -135,6 +135,7 @@ open class View: UIView {
- Parameter aDecoder: A NSCoder instance. - Parameter aDecoder: A NSCoder instance.
*/ */
public required init?(coder aDecoder: NSCoder) { public required init?(coder aDecoder: NSCoder) {
contentsGravityPreset = .resizeAspectFill
super.init(coder: aDecoder) super.init(coder: aDecoder)
prepare() prepare()
} }
...@@ -146,7 +147,8 @@ open class View: UIView { ...@@ -146,7 +147,8 @@ open class View: UIView {
- Parameter frame: A CGRect instance. - Parameter frame: A CGRect instance.
*/ */
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: frame) contentsGravityPreset = .resizeAspectFill
super.init(frame: frame)
prepare() prepare()
} }
......
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