Commit f45e8ec6 by Daniel Dahan

development: cleanup to Pulse API when calling pulse method

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