Swift/SwiftUI
[SwiftUI] 화면에 구멍 뚫기 - .mask (iOS 15 부터)
insub4067
2023. 5. 2. 23:13
struct ContentView: View {
let colors: [Color] = [.red, .blue]
var body: some View {
LinearGradient(colors: colors, startPoint: .leading, endPoint: .trailing)
.mask {
Image(systemName: "flag.checkered")
.font(.system(size: 128))
}
.background(Color.blue.opacity(0.2))
.ignoresSafeArea()
}
}