NilCoalescing/SwiftUI-Code-Examples

BuildAndStyleAChartWithSwiftChartsFramework: Value of type 'some ChartContent' has no member 'blendMode'

Closed this issue · 2 comments

I was trying to follow the article that includes the below line of code.
Seems that it doesn’t compile with Xcode 14b5 :(

I get:

Value of type 'some ChartContent' has no member 'blendMode'

I couldn’t find anything in the Xcode or iOS release notes about a change in this API.

@Brett-Best thank you for spotting this. Looks like the api changed in the recent beta release, this can be resolved by moving the .bendMode modifier up inside the foregroundStyle so that it is now applied directly to the LinearGradient.

.foregroundStyle(
    LinearGradient(
       gradient: Gradient (
           colors: [
               .indigo.opacity(0.05),
               .purple.opacity(0.5)
            ]
       ),
       startPoint: .top,
       endPoint: .bottom
    ).blendMode(.darken)
)

Ah nice, wasn’t sure if that was producing the same result, thanks! 😊