---
title: "mask(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/mask(_:)"
---

# mask(_:)

Masks this view using the alpha channel of the given view.

## Declaration

```swift
nonisolated func mask<Mask>(_ mask: Mask) -> some View where Mask : View

```

## Parameters

- `mask`: The view whose alpha the rendering system applies to the specified view.

## Discussion

Discussion Use mask(_:) when you want to apply the alpha (opacity) value of another view to the current view. This example shows an image masked by rectangle with a 10% opacity: Image(systemName: "envelope.badge.fill")     .foregroundColor(Color.blue)     .font(.system(size: 128, weight: .regular))     .mask(Rectangle().opacity(0.1))

## See Also

### Graphics and rendering modifiers

- [accentColor(_:)](swiftui/view/accentcolor(_:).md)
- [animation(_:)](swiftui/view/animation(_:)-1hc0p.md)
- [cornerRadius(_:antialiased:)](swiftui/view/cornerradius(_:antialiased:).md)
