SwiftUI-Image

原文: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()
    }
}

图片资源:


SwiftUI-Image_第1张图片
image.png

效果如图:


SwiftUI-Image_第2张图片
屏幕快照 2019-11-19 下午3.49.46.png

你可能感兴趣的:(SwiftUI-Image)