If I make it as close to c-style as possible. I can convert the code as the followings:
for var i: CGFloat = start; i <= stop; i += step { //c-style for statement has been removed in swift3
x1 = self.x.scale(i) + x.axis.inset
path.move(to: CGPoint(x: x1, y: y1))
path.addLine(to: CGPoint(x: x1, y: y2))
}
-> in Swift5.5 as of Oct 23, 2021.
for i in sequence(first:start, next:{ (($0-step)<=stop) ? $0+step:nil }) {
x1 = self.x.scale(i) + x.axis.inset
path.move(to: CGPoint(x: x1, y: y1))
path.addLine(to: CGPoint(x: x1, y: y2))
}
I hope this helps.
Topic:
Developer Tools & Services
SubTopic:
Xcode
Tags: