2025-08-26

Masking in SwiftUI


LinearGradient(
    gradient: Gradient(colors: [.pink, .indigo]),
    startPoint: .leading,
    endPoint: .trailing
)
.frame(width: 70, height: 70)
.mask {
    Image(systemName: "circle.hexagonpath")
    .resizable()
    .frame(width: 70, height: 70)
}

Result:Link icon

masking