Skip to content

Instantly share code, notes, and snippets.

@DaisukeNagata
Created February 9, 2020 10:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DaisukeNagata/939345223ae6e2e149ddf97093ac4c90 to your computer and use it in GitHub Desktop.
Save DaisukeNagata/939345223ae6e2e149ddf97093ac4c90 to your computer and use it in GitHub Desktop.
SwiftUI_Graph
import SwiftUI
struct ContentView: View {
var body: some View {
Path { path in
path.move(to: CGPoint(x: 45, y: 250))
path.addArc(center: CGPoint(x: 50,y: 250), radius: 5, startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 360),clockwise: false)
path.addLine(to: CGPoint(x: 100, y: 200))
path.addArc(center: CGPoint(x: 100,y: 200), radius: 5, startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 360),clockwise: false)
path.addLine(to: CGPoint(x: 150, y: 143))
path.addArc(center: CGPoint(x: 150,y: 143), radius: 5, startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 360),clockwise: false)
path.addLine(to: CGPoint(x: 200, y: 150))
path.addArc(center: CGPoint(x: 200,y: 150), radius: 5, startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 360),clockwise: false)
path.addLine(to: CGPoint(x: 250, y: 120))
path.addArc(center: CGPoint(x: 250,y: 120), radius: 5, startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 360),clockwise: false)
path.addLine(to: CGPoint(x: 300, y: 124))
path.addArc(center: CGPoint(x: 300,y: 124), radius: 5, startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 360),clockwise: false)
path.addLine(to: CGPoint(x: 350, y: 65))
path.addArc(center: CGPoint(x: 350,y: 65), radius: 5, startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 360),clockwise: false)
}
.stroke(Color.blue, lineWidth: 5)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
@DaisukeNagata
Copy link
Author

スクリーンショット 2020-02-09 19 28 46

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment