Conversation
Add _ShadowEffect as an EnvironmentalModifier with a _Resolved inner type conforming to RendererEffect. Includes View.shadow(color:radius:x:y:) convenience modifier.
🤖 Augment PR SummarySummary: This PR adds view-level shadow support to OpenSwiftUI by introducing a dedicated shadow renderer effect and exposing a SwiftUI-compatible Changes:
Technical Notes: Shadow styling is resolved via 🤖 Was this summary useful? React with 👍 or 👎 |
| } | ||
|
|
||
| @available(OpenSwiftUI_v4_0, *) | ||
| public static var _requiresMainThread: Bool { |
There was a problem hiding this comment.
EnvironmentalModifier._requiresMainThread is available starting OpenSwiftUI_v3_0, but this override is only available from OpenSwiftUI_v4_0, so on v3 the default true may still apply and prevent async updates. Also, the instance _requiresMainThread property doesn’t appear to be referenced elsewhere, so it might be dead/unintentional.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| public struct _Resolved: RendererEffect { | ||
| package var style: ResolvedShadowStyle | ||
|
|
||
| public typealias AnimatableData = AnimatablePair<AnimatablePair<Float, AnimatablePair<Float, AnimatablePair<Float, Float>>>, AnimatablePair<CGFloat, CGSize.AnimatableData>> |
There was a problem hiding this comment.
_Resolved.AnimatableData is spelled out explicitly rather than using ResolvedShadowStyle.AnimatableData, which tightly couples this effect to the current internal shape of Color.Resolved.AnimatableData. If that underlying type changes, animations could break or this could stop compiling even though ResolvedShadowStyle still conforms to Animatable.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| @inlinable | ||
| nonisolated public func shadow( | ||
| color: Color = Color(.sRGBLinear, white: 0, opacity: 0.33), | ||
| radius: CGFloat, |
There was a problem hiding this comment.
The public shadow(... radius:) API forwards radius directly into ResolvedShadowStyle, but ResolvedShadowStyle.insets assumes radius is non-negative (it multiplies by -2.8). If callers pass a negative radius, this can produce unexpected insets/rendering, so it may be worth guarding or documenting the valid range.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #779 +/- ##
===========================================
+ Coverage 13.14% 26.20% +13.06%
===========================================
Files 619 650 +31
Lines 36745 40232 +3487
===========================================
+ Hits 4829 10542 +5713
+ Misses 31916 29690 -2226 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
_ShadowEffectas anEnvironmentalModifierwith_Resolvedinner type conforming toRendererEffectView.shadow(color:radius:x:y:)view modifier