The view whose alpha the rendering system applies to the specified view.
Instance Method
インスタンスメソッド
mask(_:)
Masks this view using the alpha channel of the given view.
このビューをこの与えられたビューのアルファチャンネルを使って隠します。
Availability 有効性
- iOS 13.0–15.4 Deprecated
- iPadOS 13.0–15.4 Deprecated
- macOS 10.15–12.3 Deprecated
- Mac Catalyst 13.0–15.4 Deprecated
- tvOS 13.0–15.4 Deprecated
- watchOS 6.0–8.5 Deprecated
Technology
- Swift
UI
Declaration 宣言
Parameters パラメータ
mask
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))