Text+Ex.swift 492 B

123456789101112131415161718192021
  1. //
  2. // Text+Ex.swift
  3. // Pods
  4. //
  5. // Created by 100Years on 2025/3/13.
  6. //
  7. import SwiftUI
  8. public extension Text {
  9. func gradientForeground(colors: [Color], startPoint: UnitPoint, endPoint: UnitPoint) -> some View {
  10. self
  11. .overlay(
  12. LinearGradient(
  13. gradient: Gradient(colors: colors),
  14. startPoint: startPoint,
  15. endPoint: endPoint
  16. )
  17. .mask(self)
  18. )
  19. }
  20. }