Draw a Line Using Path

Опубликовано: 31 Октябрь 2024
на канале: TwoBitCodeCafe
49
0

import SwiftUI

struct ContentView: View {
var body: some View {
Path { path in
path.move(to: CGPoint(x: UIScreen.main.bounds.width / 4,
y: UIScreen.main.bounds.height / 2))
path.addLine(to: CGPoint(x: UIScreen.main.bounds.width / (1.4),
y: UIScreen.main.bounds.height / 4))
}
.stroke(lineWidth: 5)
}
}

struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}