If you want to draw a custom view using calls similar to Core Graphics’s CGContext calls in a SwiftUI custom view, paths can be drawn like this:

struct CurveEditor: View {
    var body: some View
        GeometryReader { geom in
            let width = geom.width                  //  Make the rest of the code a bit cleaner
            let height = geom. height
            Path { path in
                path.move(to: CGPoint(x: 10.0, y: 10.0))
                path.addLine(to: CGPoint(x: geom.size.width - 10.0, y: geom.size.height - 10.0))
            .stroke(style: StrokeStyle(lineWidth: 20.0, lineCap: .round))

which produces the above.