macOS 11.4
Xcode 12.5.1
1.新建工程,创建一个swiftui文件
![](https://upload-images.jianshu.io/upload_images/25522018-5b75dabb4b672c81.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
2.创建后有些画布是在下面显示的
![](https://upload-images.jianshu.io/upload_images/25522018-9b2bacdc35aa988b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/25522018-733b58e0eaba9c2b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
3.先来看下效果图
![](https://upload-images.jianshu.io/upload_images/25522018-10acdf9fb21ab490.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
4.
CardImageView.swift中
Image("Shan")
.resizable()
.aspectRatio(CGSize(width:1.5, height:1.0),contentMode: .fit)
.cornerRadius(10)
.padding(10)
.shadow(radius:5)
VideoView.swift中
HStack(alignment:.top) {
Image("Shu")
.resizable()
.frame(width:80, height:80)
VStack(alignment:.leading) {
Text("How to build an RPG")
Text("Placeholder")
.font(.subheadline)
.fontWeight(/*@START_MENU_TOKEN@*/.bold/*@END_MENU_TOKEN@*/)
.foregroundColor(Color.green)
.multilineTextAlignment(.leading)
}
Spacer()
}
ContentView.swift中
VStack {
CardImageView()
List{
VideoView()
VideoView()
}
}
![](https://upload-images.jianshu.io/upload_images/25522018-74db35d2f65a7d3d.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/25522018-87e10c0c42191f92.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![](https://upload-images.jianshu.io/upload_images/25522018-df5c1861ad9907b6.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)