Closed carson-katri closed 1 month ago
Here's one example of what this fixes:
Without a valid context, a Chart
with a modifier that embeds a View (such as this Image
rendering for each PointMark
) would crash. Now we can render these templates properly:
<Chart style="aspectRatio(1.5, contentMode: .fit); foregroundStyle(.orange); padding();">
<PointMark
:for={i <- 1..10}
x:label="X"
x:value={i}
y:label="Y"
y:value={:rand.uniform()}
style="symbol(symbol: :symbol);"
>
<Image systemName="bolt" template="symbol" style={[
"font(.title3)",
"symbolVariant(.circle.fill)",
"symbolRenderingMode(.hierarchical)"
]} />
</PointMark>
</Chart>
This fixes instances in addon libraries where a blank (unusable)
LiveContext<R>()
had to be passed to resolve a stylesheet value.https://github.com/liveview-native/liveview-native-swiftui-charts/blob/c612c5ac085fc61a33a4c3d097d09b0db9a2be7f/Sources/LiveViewNativeCharts/Modifiers/SymbolModifier.swift#L44
Instead, a valid
LiveContext
can be accessed from theContentBuilder
context, viacontext.context
.Addon libraries will need to be updated to make use of this new API.