Sets the transparency of the view.
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- watchOS 6.0+
- Xcode 11.0+
A value between 0 (fully transparent) and 1 (fully opaque).
A view that sets the transparency of this view.
Apply opacity to reveal views that are behind another view or to de-emphasize a view. The following shows two versions of the same image side by side; at left is the original, and at right is a duplicate with its opacity set to 0.5:
When applying the
opacity(_:) modifier to a view that already has an opacity, the modifier supplements—rather than replaces—the view’s opacity.