struct Shapes: View {
var body: some View {
VStack {
Text("Circular Shapes")
Capsule()
.frame(width: 50.0, height: 100.0)
Circle()
.frame(width: 50.0)
Ellipse()
Text("Rectangular Shapes")
Rectangle()
.fill(Color.green)
RoundedRectangle(cornerRadius: 40)
RoundedRectangle(cornerSize: CGSize(width: 100, height: 100))
}
.font(.title)
.foregroundColor(.blue)
}
}
struct ShapeOutlines_Strokes: View {
var body: some View {
VStack {
Text("Shape Outlines")
Rectangle()
.strokeBorder(Color.green, lineWidth: 20)
Rectangle()
.strokeBorder(Color.green,style: StrokeStyle(lineWidth: 20, lineCap: CGLineCap.butt, dash: [20]))
Rectangle()
.strokeBorder(Color.green,style: StrokeStyle(lineWidth: 20, lineCap: CGLineCap.butt,
dash: [20, 10, 40, 5]))
}
}
}



struct ShapesWithOtherViews: View {
var body: some View {
VStack(spacing: 40.0) {
Text("Using Shapes In UI")
VStack(spacing: 40.0) {
Button(action: {}) {
Text("Button")
.foregroundColor(.white)
.padding()
.padding(.horizontal)
.background(Capsule().shadow(radius: 10, y: 10))
}
.accentColor(.green)
Button(action: {}) {
Text("Button")
.padding()
.padding(.horizontal)
.background(Capsule()
.fill(Color.white)
.shadow(radius: 10))
.background(Capsule()
.stroke(lineWidth: 3))
}
}
.padding(24)
.background(RoundedRectangle(cornerRadius: 15).fill(Color(#colorLiteral(red: 0.4745098054, green: 0.8392156959, blue: 0.9764705896, alpha: 1))))
Image("image")
.resizable()
.aspectRatio(contentMode: .fit)
.clipShape(RoundedRectangle(cornerRadius: 45))
}
.font(.title)
}
}
