diff --git a/Demo/Demo/BookChange.swift b/Demo/Demo/BookChange.swift index 5f01680fa3..2d767621cc 100644 --- a/Demo/Demo/BookChange.swift +++ b/Demo/Demo/BookChange.swift @@ -11,7 +11,7 @@ struct BookChange: View, PreviewProvider { } private struct Content: View { - + @State var count = 0 var body: some View { @@ -27,6 +27,13 @@ struct BookChange: View, PreviewProvider { .onChangeWithPrevious(of: count, emitsInitial: true) { newValue, oldValue in print("\(newValue), \(oldValue)") } + .foregroundLinearGradient( + .linearGradient( + colors: [.orange, .blue], + startPoint: .bottom, + endPoint: .bottomTrailing + ) + ) } } } diff --git a/Sources/SwiftUISupport/Extensions/View+Gradient.swift b/Sources/SwiftUISupport/Extensions/View+Gradient.swift index 1c555c7b72..a31c147197 100644 --- a/Sources/SwiftUISupport/Extensions/View+Gradient.swift +++ b/Sources/SwiftUISupport/Extensions/View+Gradient.swift @@ -1,6 +1,6 @@ import SwiftUI -extension Text { +extension View { /** [Extension] @@ -8,6 +8,7 @@ extension Text { public func foregroundLinearGradient(_ gradient: LinearGradient) -> some View { self + .hidden() .overlay( gradient .aspectRatio(nil, contentMode: .fill)