@@ -98,15 +98,15 @@ extension View {
9898 UIKit Implementation for POS Shadows
9999 -----------------------------------
100100
101- Instead of stacking multiple SwiftUI `.shadow` modifiers (which each trigger a separate offscreen
102- render pass and can be very expensive in lists or scrolling views), this approach uses a custom UIView (`MultiShadowView`)
103- that adds multiple CALayer sublayers, each with its own shadow configuration.
101+ Instead of stacking multiple SwiftUI `.shadow` modifiers (which each require separate blur calculations
102+ and compositing operations, which can be costly in lists or scrolling views), this approach uses a
103+ custom `UIView` (`MultiShadowView`) that composes multiple ` CALayer` sublayers, each with its own shadow configuration.
104104
105105 Performance Benefits:
106- - All shadows are rasterized and composited in a single view hierarchy, reducing the number of offscreen passes .
107- - CALayer shadows are highly optimized in UIKit, especially when `shouldRasterize` is enabled .
108- - This approach is much more efficient for complex shadows in scrolling or frequently updated views .
109- - The shadow path is explicitly set, further improving rendering performance and avoiding unnecessary alpha blending .
106+ - All shadow operations are rasterized and composited using multiple `CALayer`s within a single view hierarchy.
107+ - Avoids SwiftUI’s per-shadow blur and composition cost, which can accumulate in scroll views or complex layouts .
108+ - `CALayer` shadows are GPU-accelerated and benefit from `shouldRasterize`, enabling efficient reuse of cached shadow bitmaps .
109+ - Explicit `shadowPath` avoids expensive runtime shape calculations and improves rendering performance .
110110*/
111111
112112private class MultiShadowView : UIView {
0 commit comments