Search code examples
javaswiftgraphics2d

What would be the Swift equivalent of General Path of Java?


Currently, I'm writing an iOS app based on a previous implementation which is written in Java. The app is a custom map app and involves drawing a lot. I've been trying to find the class or object that most closely represents General Path of Java. Thanks a lot!


Solution

  • If by General Path of Java you mean java.awt.geom.GeneralPath

    The GeneralPath class represents a geometric path constructed from straight lines, and quadratic and cubic (Bézier) curves. It can contain multiple subpaths.

    So you should look for UIBezierPath in iOS's UIKit

    A path that consists of straight and curved line segments that you can render in your custom views.

    A single Bézier path object can contain any number of open or closed subpaths, where each subpath represents a connected series of path segments.