shaffex

LinearGradient in SwiftUI is a view that creates a linear gradient color transition over a specified direction or angle. It’s used to fill or overlay views with a gradient that shifts between two or more colors. The gradient can be customized to start and end at specific points, and you can control the direction of the color transition by specifying the start and end points.

Parameters:

gradient Observe the example to learn specifying colors, along with startPoint and endPoint for gradients. startPoint and endPoint utilize UnitPoint for positioning.

Examples

<body>
    <lineargradient gradient="colors:[red,green,blue];startPoint:0.0,0.5;endPoint:1.0,0.5" ignoresSafeArea="">
    </lineargradient>
</body>

Screenshot