Commit 64d0eaea by Daniel Dahan

development: fixed issue where result was causing a warning issue-528

parent ccd546c8
...@@ -59,7 +59,8 @@ public typealias AnimationDelayCancelBlock = (Bool) -> Void ...@@ -59,7 +59,8 @@ public typealias AnimationDelayCancelBlock = (Bool) -> Void
public struct Animation { public struct Animation {
/// Delay helper method. /// Delay helper method.
public static func delay(time: TimeInterval, completion: @escaping () -> Void) -> AnimationDelayCancelBlock { @discardableResult
public static func delay(time: TimeInterval, completion: @escaping () -> Void) -> AnimationDelayCancelBlock? {
func asyncAfter(completion: @escaping () -> Void) { func asyncAfter(completion: @escaping () -> Void) {
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + time, execute: completion) DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + time, execute: completion)
...@@ -80,7 +81,7 @@ public struct Animation { ...@@ -80,7 +81,7 @@ public struct Animation {
cancelable?(false) cancelable?(false)
} }
return delayed; return cancelable;
} }
/** /**
...@@ -127,7 +128,7 @@ public struct Animation { ...@@ -127,7 +128,7 @@ public struct Animation {
:name: animateWithDelay :name: animateWithDelay
*/ */
public static func animateWithDelay(delay d: CFTimeInterval, duration: CFTimeInterval, animations: @escaping (() -> Void), completion: (() -> Void)? = nil) { public static func animateWithDelay(delay d: CFTimeInterval, duration: CFTimeInterval, animations: @escaping (() -> Void), completion: (() -> Void)? = nil) {
_ = delay(time: d) { delay(time: d) {
animateWithDuration(duration: duration, animations: animations, completion: completion) animateWithDuration(duration: duration, animations: animations, completion: completion)
} }
} }
......
...@@ -109,7 +109,7 @@ open class BottomTabBar: UITabBar { ...@@ -109,7 +109,7 @@ open class BottomTabBar: UITabBar {
super.didMoveToSuperview() super.didMoveToSuperview()
if isAlignedToParentAutomatically { if isAlignedToParentAutomatically {
if let v = superview { if let v = superview {
_ = v.layout(self).bottom().horizontally() v.layout(self).bottom().horizontally()
} }
} }
} }
......
...@@ -180,7 +180,7 @@ open class Button: UIButton { ...@@ -180,7 +180,7 @@ open class Button: UIButton {
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 = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
_ = Animation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
......
...@@ -568,7 +568,7 @@ open class Capture: View, UIGestureRecognizerDelegate { ...@@ -568,7 +568,7 @@ open class Capture: View, UIGestureRecognizerDelegate {
} }
v.transform = CATransform3DMakeScale(0.5, 0.5, 1) v.transform = CATransform3DMakeScale(0.5, 0.5, 1)
}) { }) {
_ = Animation.delay(time: 0.4) { [weak layer] in Animation.delay(time: 0.4) { [weak layer] in
Animation.animationDisabled { [weak layer] in Animation.animationDisabled { [weak layer] in
guard let v = layer else { guard let v = layer else {
return return
......
...@@ -286,7 +286,7 @@ open class Card: PulseView { ...@@ -286,7 +286,7 @@ open class Card: PulseView {
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
views["titleLabel"] = v views["titleLabel"] = v
_ = layout(v).horizontally(left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right) layout(v).horizontally(left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right)
} }
// detail // detail
...@@ -301,7 +301,7 @@ open class Card: PulseView { ...@@ -301,7 +301,7 @@ open class Card: PulseView {
verticalFormat += "-[contentView]" verticalFormat += "-[contentView]"
views["contentView"] = v views["contentView"] = v
_ = layout(v).horizontally(left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right) layout(v).horizontally(left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right)
} }
// leftButtons // leftButtons
...@@ -322,7 +322,7 @@ open class Card: PulseView { ...@@ -322,7 +322,7 @@ open class Card: PulseView {
h += "[\(k)]" h += "[\(k)]"
_ = layout(b).bottom(contentInset.bottom + leftButtonsInset.bottom) layout(b).bottom(contentInset.bottom + leftButtonsInset.bottom)
i += 1 i += 1
} }
...@@ -349,7 +349,7 @@ open class Card: PulseView { ...@@ -349,7 +349,7 @@ open class Card: PulseView {
h += "-(right_left)-" h += "-(right_left)-"
} }
_ = layout(b).bottom(contentInset.bottom + rightButtonsInset.bottom) layout(b).bottom(contentInset.bottom + rightButtonsInset.bottom)
i -= 1 i -= 1
} }
......
...@@ -217,7 +217,7 @@ open class MaterialCollectionReusableView: UICollectionReusableView { ...@@ -217,7 +217,7 @@ open class MaterialCollectionReusableView: UICollectionReusableView {
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
_ = Animation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
......
...@@ -227,7 +227,7 @@ open class CollectionViewCell: UICollectionViewCell { ...@@ -227,7 +227,7 @@ open class CollectionViewCell: UICollectionViewCell {
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
_ = Animation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
......
...@@ -135,18 +135,18 @@ open class ContentCard: PulseView { ...@@ -135,18 +135,18 @@ open class ContentCard: PulseView {
if let v = titleBar { if let v = titleBar {
views["titleBar"] = v views["titleBar"] = v
format += "[titleBar]" format += "[titleBar]"
_ = layout(v).horizontally() layout(v).horizontally()
} }
views["contentView"] = contentView views["contentView"] = contentView
format += "[contentView]" format += "[contentView]"
_ = layout(contentView).horizontally() layout(contentView).horizontally()
contentView.layoutIfNeeded() contentView.layoutIfNeeded()
if let v = bottomBar { if let v = bottomBar {
views["bottomBar"] = v views["bottomBar"] = v
format += "[bottomBar]" format += "[bottomBar]"
_ = layout(v).horizontally() layout(v).horizontally()
} }
addConstraints(Layout.constraint(format: "\(format)|", options: [], metrics: nil, views: views)) addConstraints(Layout.constraint(format: "\(format)|", options: [], metrics: nil, views: views))
......
...@@ -394,9 +394,9 @@ open class ImageCard: PulseView { ...@@ -394,9 +394,9 @@ open class ImageCard: PulseView {
verticalFormat += "-[titleLabel]" verticalFormat += "-[titleLabel]"
views["titleLabel"] = v views["titleLabel"] = v
} else { } else {
_ = layout(v).top(contentInset.top + titleLabelInset.top) layout(v).top(contentInset.top + titleLabelInset.top)
} }
_ = layout(v).horizontally(left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right) layout(v).horizontally(left: contentInset.left + titleLabelInset.left, right: contentInset.right + titleLabelInset.right)
} }
// detail // detail
...@@ -411,7 +411,7 @@ open class ImageCard: PulseView { ...@@ -411,7 +411,7 @@ open class ImageCard: PulseView {
verticalFormat += "-[contentView]" verticalFormat += "-[contentView]"
views["contentView"] = v views["contentView"] = v
_ = layout(v).horizontally(left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right) layout(v).horizontally(left: contentInset.left + contentViewInset.left, right: contentInset.right + contentViewInset.right)
} }
// leftButtons // leftButtons
...@@ -432,7 +432,7 @@ open class ImageCard: PulseView { ...@@ -432,7 +432,7 @@ open class ImageCard: PulseView {
h += "[\(k)]" h += "[\(k)]"
_ = layout(b).bottom(contentInset.bottom + leftButtonsInset.bottom) layout(b).bottom(contentInset.bottom + leftButtonsInset.bottom)
i += 1 i += 1
} }
...@@ -459,7 +459,7 @@ open class ImageCard: PulseView { ...@@ -459,7 +459,7 @@ open class ImageCard: PulseView {
h += "-(right_left)-" h += "-(right_left)-"
} }
_ = layout(b).bottom(contentInset.bottom + rightButtonsInset.bottom) layout(b).bottom(contentInset.bottom + rightButtonsInset.bottom)
i -= 1 i -= 1
} }
......
...@@ -102,7 +102,7 @@ internal extension Animation { ...@@ -102,7 +102,7 @@ internal extension Animation {
default:break default:break
} }
_ = Animation.delay(time: duration) { Animation.delay(time: duration) {
bLayer.setValue(true, forKey: "animated") bLayer.setValue(true, forKey: "animated")
} }
} }
...@@ -122,7 +122,7 @@ internal extension Animation { ...@@ -122,7 +122,7 @@ internal extension Animation {
return return
} }
_ = Animation.delay(time: animated ? 0 : 0.15) { Animation.delay(time: animated ? 0 : 0.15) {
guard let pLayer = bLayer.sublayers?.first as? CAShapeLayer else { guard let pLayer = bLayer.sublayers?.first as? CAShapeLayer else {
return return
} }
...@@ -144,7 +144,7 @@ internal extension Animation { ...@@ -144,7 +144,7 @@ internal extension Animation {
default:break default:break
} }
_ = Animation.delay(time: duration) { Animation.delay(time: duration) {
pLayer.removeFromSuperlayer() pLayer.removeFromSuperlayer()
bLayer.removeFromSuperlayer() bLayer.removeFromSuperlayer()
} }
......
...@@ -53,7 +53,7 @@ open class PulseView: View { ...@@ -53,7 +53,7 @@ open class PulseView: View {
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
_ = Animation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
......
...@@ -102,7 +102,7 @@ open class SnackbarController: RootController { ...@@ -102,7 +102,7 @@ open class SnackbarController: RootController {
Animates to a SnackbarStatus. Animates to a SnackbarStatus.
- Parameter status: A SnackbarStatus enum value. - Parameter status: A SnackbarStatus enum value.
*/ */
open func animate(snackbar status: SnackbarStatus, delay: TimeInterval = 0, animations: ((Snackbar) -> Void)? = nil, completion: ((Snackbar) -> Void)? = nil) -> AnimationDelayCancelBlock { open func animate(snackbar status: SnackbarStatus, delay: TimeInterval = 0, animations: ((Snackbar) -> Void)? = nil, completion: ((Snackbar) -> Void)? = nil) -> AnimationDelayCancelBlock? {
return Animation.delay(time: delay) { [weak self, status = status, animations = animations, completion = completion] in return Animation.delay(time: delay) { [weak self, status = status, animations = animations, completion = completion] in
guard let s = self else { guard let s = self else {
return return
......
...@@ -79,6 +79,6 @@ open class StatusBarController: RootController { ...@@ -79,6 +79,6 @@ open class StatusBarController: RootController {
private func prepareStatusBarView() { private func prepareStatusBarView() {
statusBarView.zPosition = 3000 statusBarView.zPosition = 3000
statusBarView.backgroundColor = Color.black.withAlphaComponent(0.12) statusBarView.backgroundColor = Color.black.withAlphaComponent(0.12)
_ = view.layout(statusBarView).top(0).horizontally().height(20) view.layout(statusBarView).top(0).horizontally().height(20)
} }
} }
...@@ -101,7 +101,7 @@ open class TableViewCell: UITableViewCell { ...@@ -101,7 +101,7 @@ open class TableViewCell: UITableViewCell {
open func pulse(point: CGPoint? = nil) { open func pulse(point: CGPoint? = nil) {
let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point! let p: CGPoint = nil == point ? CGPoint(x: CGFloat(width / 2), y: CGFloat(height / 2)) : point!
Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation) Animation.pulseExpandAnimation(layer: layer, visualLayer: visualLayer, pulseColor: pulseColor, pulseOpacity: pulseOpacity, point: p, width: width, height: height, pulseLayers: &pulseLayers, pulseAnimation: pulseAnimation)
_ = Animation.delay(time: 0.35) { [weak self] in Animation.delay(time: 0.35) { [weak self] in
guard let s = self else { guard let s = self else {
return return
} }
......
...@@ -161,11 +161,11 @@ public class TextView: UITextView { ...@@ -161,11 +161,11 @@ public class TextView: UITextView {
internal func reloadView() { internal func reloadView() {
if let p = placeholderLabel { if let p = placeholderLabel {
removeConstraints(constraints) removeConstraints(constraints)
_ = layout(p).edges( layout(p).edges(
top: textContainerInset.top, top: textContainerInset.top,
left: textContainerInset.left + textContainer.lineFragmentPadding, left: textContainerInset.left + textContainer.lineFragmentPadding,
bottom: textContainerInset.bottom, bottom: textContainerInset.bottom,
right: textContainerInset.right + textContainer.lineFragmentPadding) right: textContainerInset.right + textContainer.lineFragmentPadding)
} }
} }
......
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