Iam using UIBeizerPath for drawing stepsdotview, Please help in fliping the BeizerPath, check the code in attached image
Check the code:
public override func draw(_ rect: CGRect) {
let availableSpace = bounds.width - (insets.left + insets.right)
let availableSpaceForLines = availableSpace - (dotRadius * 2) * CGFloat(numberOfSteps)
var lineWidth: CGFloat = availableSpaceForLines
if numberOfLines > 0 {
lineWidth = availableSpaceForLines / CGFloat(numberOfLines)
}
let origin = CGPoint(x: insets.left, y: (bounds.height - (dotDiameter)) / 2.0)
let dotSize = CGSize(width: dotDiameter, height: dotDiameter)
var dotRect = CGRect(origin: origin, size: dotSize)
//Create dots and lines
for index in 0 ..< numberOfSteps {
var dotColor = unSelectedColor
if index <= selectedIndex {
dotColor = dotColors[index] ?? selectedIndexColor
}
dotColor.setFill()
//Draw line
if index > 0 {
let xCoordinate = dotRect.origin.x - lineWidth + dotRadius / 2
let yCoordinate = dotRect.midY - lineHeight / 2.0
let lineOrigin = CGPoint(x: xCoordinate, y: yCoordinate)
let lineSize = CGSize(width: lineWidth - dotRadius, height: lineHeight)
let lineRect = CGRect(origin: lineOrigin, size: lineSize)
let leftLine = UIBezierPath(rect: lineRect)
dotColor.setFill()
leftLine.fill()
}
//Draw dot
let dot = UIBezierPath(ovalIn: dotRect)
dot.fill()
//Frame for next dot
dotRect.origin.x += dotDiameter + lineWidth
}
}
[1]: https://i.stack.imgur.com/t3wJW.png**strong text**
Check this snippet, using rotation angle works