Jul 21, 2017 · 1 min read
I ported this to Swift 3 if anyone is interested.
import UIKitclass CustomDisclosureIndicator: UIView { @IBInspectable var color = UIColor.black { didSet {
setNeedsDisplay()
}
} override func draw(_ rect: CGRect) { let context = UIGraphicsGetCurrentContext()
let x = self.bounds.maxX — 3
let y = self.bounds.midY
let R = CGFloat(4.5) context?.move(to: CGPoint(x: x — R, y: y — R))
context?.addLine(to: CGPoint(x: x, y: y))
context?.addLine(to: CGPoint(x: x — R, y: y + R))
context?.setLineCap(CGLineCap.square)
context?.setLineJoin(CGLineJoin.miter)
context?.setLineWidth(2)
color.setStroke()
context?.strokePath()
}
}