Adds a grayscale effect to the view.
SDKs
- iOS 13.0+
- macOS 10.15+
- Mac Catalyst 13.0+
- tvOS 13.0+
- Xcode 11.0+
Framework
- Swift
UI
Declaration
Parameters
amount
The intensity of grayscale to apply. Values closer to 0.0 are more colorful, and values closer to 1.0 are less colorful.
Return Value
A view that adds a grayscale effect to this view.
Discussion
A grayscale effect reduces the intensity of colors in this 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 the grayscale(_:)
modifier’s amount
parameter set to 0.75:
