Skip to content

Instantly share code, notes, and snippets.

@laevandus
Last active Dec 2, 2021
Embed
What would you like to do?
Text("Hello, world!")
.font(.system(size: 60))
.myForegroundStyle(
LinearGradient(
colors: gradientColors,
startPoint: .leading,
endPoint: .trailing
)
)
.padding()
.background(.black)
extension View {
func myForegroundStyle<Content: View>(_ content: Content) -> some View {
self.overlay(content).mask(self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment