原文:https://iosdevcenters.blogspot.com/2019/09/swiftui-circular-image-example.html
import SwiftUI
struct ContentView: View {
@State var scale: CGFloat = 1.0
var body: some View {
Image("swiftui")
.resizable()
.frame(width: 200, height: 200)
.clipShape(Circle())
.overlay(Circle().stroke(Color.white, lineWidth: 4))
.shadow(radius: 10)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
图片资源:
效果如图: