import SwiftUI
struct ContentView: View {
var body: some View {
Image("l")
.resizable()
.aspectRatio(contentMode: .fit)
.overlay(
Color.black
.opacity(0.4)
.overlay(
Text("This is a italian food")
.font(.system(.largeTitle, design: .rounded))
.fontWeight(.black)
.foregroundColor(.white)
)
)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Overlay를 사용하면 View에 다른 View를 겹칠 수 있습니다