@@ -359,8 +359,23 @@ public class SurfaceView: UIView {
359359
360360 let spread = shadow. spread
361361 let shadowRect = containerView. frame. insetBy ( dx: - spread, dy: - spread)
362- let shadowPath = UIBezierPath . path ( roundedRect: shadowRect,
362+
363+ // Create shadow path based on corner configuration or corner radius
364+ let shadowPath : UIBezierPath
365+ #if compiler(>=6.2)
366+ if #available( iOS 26 . 0 , * ) , appearance. cornerConfiguration != nil {
367+ // Use UIView.effectiveRadius(corner:) API for iOS 26+
368+ // This properly queries the actual corner radius from UICornerConfiguration
369+ shadowPath = UIBezierPath . path ( roundedRect: shadowRect, view: containerView)
370+ } else {
371+ shadowPath = UIBezierPath . path ( roundedRect: shadowRect,
363372 appearance: appearance)
373+ }
374+ #else
375+ shadowPath = UIBezierPath . path ( roundedRect: shadowRect,
376+ appearance: appearance)
377+ #endif
378+
364379 shadowLayer. shadowPath = shadowPath. cgPath
365380 shadowLayer. shadowColor = shadow. color. cgColor
366381 shadowLayer. shadowOffset = shadow. offset
@@ -369,17 +384,43 @@ public class SurfaceView: UIView {
369384 shadowLayer. shadowOpacity = shadow. opacity
370385
371386 let mask = CAShapeLayer ( )
372- let path = UIBezierPath . path ( roundedRect: containerView. frame,
373- appearance: appearance)
387+
388+ // Create mask path based on corner configuration or corner radius
389+ let path : UIBezierPath
390+ #if compiler(>=6.2)
391+ if #available( iOS 26 . 0 , * ) , appearance. cornerConfiguration != nil {
392+ // Use UIView.effectiveRadius(corner:) API for iOS 26+
393+ // This properly queries the actual corner radius from UICornerConfiguration
394+ path = UIBezierPath . path ( roundedRect: containerView. frame, view: containerView)
395+ } else {
396+ path = UIBezierPath . path ( roundedRect: containerView. frame,
397+ appearance: appearance)
398+ }
399+ #else
400+ path = UIBezierPath . path ( roundedRect: containerView. frame,
401+ appearance: appearance)
402+ #endif
403+
374404 let size = window? . bounds. size ?? CGSize ( width: 1000.0 , height: 1000.0 )
375405 path. append ( UIBezierPath ( rect: layer. bounds. insetBy ( dx: - size. width,
376406 dy: - size. height) ) )
377407 mask. fillRule = . evenOdd
378408 mask. path = path. cgPath
409+
410+ #if compiler(>=6.2)
411+ if #available( iOS 26 . 0 , * ) , appearance. cornerConfiguration != nil {
412+ // Corner curve is handled by UICornerConfiguration
413+ } else if #available( iOS 13 . 0 , * ) {
414+ containerView. layer. cornerCurve = appearance. cornerCurve
415+ mask. cornerCurve = appearance. cornerCurve
416+ }
417+ #else
379418 if #available( iOS 13 . 0 , * ) {
380419 containerView. layer. cornerCurve = appearance. cornerCurve
381420 mask. cornerCurve = appearance. cornerCurve
382421 }
422+ #endif
423+
383424 shadowLayer. mask = mask
384425 }
385426 CATransaction . commit ( )
0 commit comments