From 6a274d9220ea239f88e00264590508cdaa330702 Mon Sep 17 00:00:00 2001 From: Quang Nguyen Date: Wed, 9 Oct 2019 11:24:56 +0900 Subject: [PATCH] Remove empty spaces and lines --- MaterialShowcase/MaterialShowcase+Calculations.swift | 2 +- MaterialShowcase/MaterialShowcase.swift | 11 +++-------- MaterialShowcase/MaterialShowcaseController.swift | 5 +++-- .../MaterialShowcaseInstructionView.swift | 12 ++++++------ 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/MaterialShowcase/MaterialShowcase+Calculations.swift b/MaterialShowcase/MaterialShowcase+Calculations.swift index a503a19..da72227 100644 --- a/MaterialShowcase/MaterialShowcase+Calculations.swift +++ b/MaterialShowcase/MaterialShowcase+Calculations.swift @@ -10,7 +10,7 @@ import Foundation import UIKit extension MaterialShowcase { - + func isInGutter(center: CGPoint) -> Bool { return center.y < offsetThreshold || containerView.frame.height - center.y < offsetThreshold } diff --git a/MaterialShowcase/MaterialShowcase.swift b/MaterialShowcase/MaterialShowcase.swift index 6949be6..312ffca 100644 --- a/MaterialShowcase/MaterialShowcase.swift +++ b/MaterialShowcase/MaterialShowcase.swift @@ -14,7 +14,6 @@ import UIKit public class MaterialShowcase: UIView { - @objc public enum BackgroundTypeStyle: Int { case circle //default case full//full screen @@ -52,7 +51,7 @@ public class MaterialShowcase: UIView { var targetRippleView: UIView! var targetCopyView: UIView! var instructionView: MaterialShowcaseInstructionView! - + var onTapThrough: (() -> Void)? // MARK: Public Properties @@ -91,8 +90,6 @@ public class MaterialShowcase: UIView { // Delegate @objc public weak var delegate: MaterialShowcaseDelegate? - - public init() { // Create frame let frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: UIScreen.main.bounds.height) @@ -200,9 +197,7 @@ extension MaterialShowcase { handler() } } - - - + } // MARK: - Utility API @@ -522,7 +517,7 @@ extension MaterialShowcase { if delegate != nil && delegate?.showCaseDidDismiss != nil { delegate?.showCaseDidDismiss?(showcase: self, didTapTarget: didTapTarget) } - + if didTapTarget { onTapThrough?() } diff --git a/MaterialShowcase/MaterialShowcaseController.swift b/MaterialShowcase/MaterialShowcaseController.swift index 275811f..ea04948 100644 --- a/MaterialShowcase/MaterialShowcaseController.swift +++ b/MaterialShowcase/MaterialShowcaseController.swift @@ -84,10 +84,11 @@ open class MaterialShowcaseController { } extension MaterialShowcaseController: MaterialShowcaseDelegate { - public func showCaseWillDismiss(showcase: MaterialShowcase, didTapTarget: Bool) { + public func showCaseWillDismiss(showcase: MaterialShowcase, didTapTarget: Bool) { delegate?.materialShowcaseController(self, materialShowcaseWillDisappear: showcase, forIndex: currentIndex) } - public func showCaseDidDismiss(showcase: MaterialShowcase, didTapTarget: Bool) { + + public func showCaseDidDismiss(showcase: MaterialShowcase, didTapTarget: Bool) { delegate?.materialShowcaseController(self, materialShowcaseDidDisappear: showcase, forIndex: currentIndex) currentShowcase = nil if started { diff --git a/MaterialShowcase/MaterialShowcaseInstructionView.swift b/MaterialShowcase/MaterialShowcaseInstructionView.swift index 9966f0e..411c60f 100644 --- a/MaterialShowcase/MaterialShowcaseInstructionView.swift +++ b/MaterialShowcase/MaterialShowcaseInstructionView.swift @@ -63,7 +63,7 @@ public class MaterialShowcaseInstructionView: UIView { /// Configures and adds primary label view private func addPrimaryLabel() { if primaryLabel != nil { - primaryLabel.removeFromSuperview() + primaryLabel.removeFromSuperview() } primaryLabel = UILabel() @@ -89,7 +89,7 @@ public class MaterialShowcaseInstructionView: UIView { /// Configures and adds secondary label view private func addSecondaryLabel() { if secondaryLabel != nil { - secondaryLabel.removeFromSuperview() + secondaryLabel.removeFromSuperview() } secondaryLabel = UILabel() @@ -117,14 +117,14 @@ public class MaterialShowcaseInstructionView: UIView { private func getWidth() -> CGFloat{ //superview was left side if (self.superview?.frame.origin.x)! < CGFloat(0) { - return frame.width - (frame.minX/2) + return frame.width - (frame.minX/2) } else if ((self.superview?.frame.origin.x)! + (self.superview?.frame.size.width)! > - UIScreen.main.bounds.width) { //superview was right side - return (frame.width - frame.minX)/2 + UIScreen.main.bounds.width) { //superview was right side + return (frame.width - frame.minX)/2 } return (frame.width - frame.minX) } - + /// Overrides this to add subviews. They will be drawn when calling show() public override func layoutSubviews() { super.layoutSubviews()