如何使用 Swift UI 繪製 Apple Photo icon
Published in
1 min readDec 2, 2019
Github 連結:https://github.com/00757306/Drawing
struct ContentView: View {
var body: some View {
ZStack{
Circle()
.stroke()
.frame(width:75,height:75)
//opacity(0)
roundRect()
.foregroundColor(.blue)
roundRect()
.foregroundColor(.green)
.rotationEffect(.degrees(-90))
roundRect()
.foregroundColor(.pink)
.rotationEffect(.degrees(90))
roundRect()
.foregroundColor(.orange)
.rotationEffect(.degrees(180))
roundRect()
.foregroundColor(.green)
.rotationEffect(.degrees(-45))
roundRect()
.foregroundColor(.purple)
.rotationEffect(.degrees(45))
roundRect()
.foregroundColor(.yellow)
.rotationEffect(.degrees(-135))
roundRect()
.foregroundColor(.red)
.rotationEffect(.degrees(135))
}.scaleEffect(2.8)
}
}struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}struct roundrect:View {
var body:some View{
Capsule()
.offset(y:38 )
.frame(width:50,height:70)
.opacity(0.6)
}
}struct roundRect:View {
var body:some View{
Capsule()
.offset(y:38 )
.frame(width:50,height:70)
.opacity(0.6)
}
}}