【SwiftUI】図形の描画『Rectangle()・Circle()』の使い方について解説

Rectangle()

struct ContentView: View {
    var body: some View {
        Rectangle()
            .frame(width: 200, height: 200)
            .foregroundColor(.red)
            .cornerRadius(30)
    }
}

Circle()

struct ContentView: View {
    var body: some View {
        Circle()
            .frame(width: 200, height: 200)
            .foregroundColor(.green)
    }
}