 import UIKit
 
 class ArrowsView: UIView {
+
+  private typealias FactorTuple = (single: CGFloat, double: CGFloat)
 
   private enum Side {
 

  }

  private func drawArrow(_ rect: CGRect, side: Side) {
    let factor: CGFloat = rect.width * factorValue
    let doubleFactor = factor * 2

    let startPointX: CGFloat = {
      switch side {
      case .left:
        return rect.minX + doubleFactor
      case .right:
        return rect.maxX - doubleFactor
      }
    }()

    let startPoint = CGPoint(x: startPointX, y: rect.midY)

    let bottomPoint: CGPoint = {
      switch side {
      case .left:
        return CGPoint(x: (rect.midX - factor), y: (rect.minY + doubleFactor))
      case .right:
        return CGPoint(x: (rect.midX + factor), y: (rect.minY + doubleFactor))
      }
    }()

    let topPoint: CGPoint = {
      switch side {
      case .left:
        return CGPoint(x: (rect.midX - factor), y: (rect.maxY - doubleFactor))
      case .right:
        return CGPoint(x: (rect.midX + factor), y: (rect.maxY - doubleFactor))
      }
    }()

    let arrow = UIBezierPath()
    arrow.move(to: startPoint)
    arrow.addLine(to: bottomPoint)
    arrow.addLine(to: topPoint)
    arrow.addLine(to: startPoint)

    let arrowLeftLayer = CAShapeLayer()

    arrowLeftLayer.fillColor = UIColor.white.cgColor
    layer.addSublayer(arrowLeftLayer)
  }

  private func makeFactor(_ rect: CGRect) -> FactorTuple {
    let factor = rect.width * factorValue

    return (factor, 2 * factor)
  }

  private func makeStartPoint(_ rect: CGRect, side: Side, factor: FactorTuple) -> CGPoint {
    let startPointX: CGFloat = {
      switch side {
      case .left:
        return rect.minX + factor.double
      case .right:
        return rect.maxX - factor.double
      }
    }()

    return CGPoint(x: startPointX, y: rect.midY)
  }

  private func makeBottomPoint(_ rect: CGRect, side: Side, factor: FactorTuple) -> CGPoint {
      switch side {
      case .left:
        return CGPoint(x: (rect.midX - factor.single), y: (rect.minY + factor.double))
      case .right:
        return CGPoint(x: (rect.midX + factor.single), y: (rect.minY + factor.double))
      }
  }

  private func makeTopPoint(_ rect: CGRect, side: Side, factor: FactorTuple) -> CGPoint {
      switch side {
      case .left:
        return CGPoint(x: (rect.midX - factor.single), y: (rect.maxY - factor.double))
      case .right:
        return CGPoint(x: (rect.midX + factor.single), y: (rect.maxY - factor.double))
      }
  }
  
}
