One approach I tried is the following:
let circle = Circle.init()
let path = circle.path(in: kServiceRightFrame)
let serviceRightPath = UIBezierPath.init(cgPath: path.cgPath)
serviceRightPath.lineWidth = 2.0
serviceRightPath.fill()
serviceRightPath.stroke()
I played around with flatness too, but that did not get the job done either. How can a smoother looking circle be drawn programmatically?
EDIT:A more extensive view of my code:
UIGraphicsBeginImageContext(kWatchInterfaceSize)
let context = UIGraphicsGetCurrentContext()
//draw service path
kSBScoreLabelFontColor.setStroke()
kSBServiceBallColor.setFill()
---> code from above
// Convert to UIImage
let cgimage = context!.makeImage()
//create scoreboardimage
let scoreBoardImage = UIImage(cgImage: cgimage!)
// End the graphics context'
UIGraphicsEndImageContext()
George put me on the right track. It was a scaling issue. The code that I changed was the following:
//Replaced this
//UIGraphicsBeginImageContext(kWatchInterfaceSize)
//with this
UIGraphicsBeginImageContextWithOptions(kWatchInterfaceSize,
false, 4.0)
That fixed it. Now the circle looks a lot smoother in appearance.