BezierPath on iOS and macOS?

Asked by At

I have a SKSpriteNode that draws a grid that is displayed in the background of my SK game. It is based on this post. This uses...

let size = CGSize(width: CGFloat(cols)*blockSize+1.0, height: CGFloat(rows)*blockSize+1.0)

guard let context = UIGraphicsGetCurrentContext() else {
  return nil
let bezierPath = UIBezierPath()

Now I would like to port this so it works under macOS as well. However, the class names change, so we have NSBezierPath and NSGraphics... etc.

In contrast, the coordinates and colors have been virtualized, so as long as I use CFPoints and SKColor, all is well.

Do similar virtualized versions of these other calls exist as well? If not, does anyone know a solution or do I just ifdef everything?

0 Answers