Summary
Using Variablur in SwiftUI hierarchies that are flattened or snapshotted can log:
Unable to render flattened version of PlatformViewRepresentableAdaptor<VariablurView>.
This was observed when applying Variablur to a SwiftUI card that also participates in a context menu preview shape.
Reproduction
Image(uiImage: uiImage)
.resizable()
.aspectRatio(contentMode: .fill)
.blur(32, variation: .bottom())
A similar warning can occur when the Variablur-backed view is placed inside other SwiftUI flattening paths, such as ImageRenderer, drawingGroup(), or snapshot/export surfaces.
Expected Behavior
Variablur should either avoid this warning where possible or clearly document that the live UIKit-backed blur cannot be used in SwiftUI flattening/snapshot paths.
Actual Behavior
SwiftUI attempts to flatten a hierarchy containing VariablurView and logs:
Unable to render flattened version of PlatformViewRepresentableAdaptor<VariablurView>.
Likely Cause
VariablurView is a UIViewRepresentable backed by UIVisualEffectView and the runtime CAFilter("variableBlur") path. SwiftUI cannot flatten platform views into an offscreen render target for context menu previews, ImageRenderer, drawingGroup(), and similar APIs.
Workaround
For snapshot-sensitive card backgrounds, use a pure SwiftUI/image-renderable fallback: duplicate the image, apply native .blur(radius:), and mask the blurred copy with a LinearGradient or another snapshot-safe mask.
Acceptance Criteria
- Document that Variablur is not compatible with SwiftUI flattening/snapshot paths.
- Mention known triggers: context menu previews,
ImageRenderer, drawingGroup(), and similar effects that flatten input.
- Add README or DocC guidance with a snapshot-safe fallback example.
- Consider whether the public API should expose a static/image-renderable fallback for common card backgrounds.
Summary
Using Variablur in SwiftUI hierarchies that are flattened or snapshotted can log:
This was observed when applying Variablur to a SwiftUI card that also participates in a context menu preview shape.
Reproduction
A similar warning can occur when the Variablur-backed view is placed inside other SwiftUI flattening paths, such as
ImageRenderer,drawingGroup(), or snapshot/export surfaces.Expected Behavior
Variablur should either avoid this warning where possible or clearly document that the live UIKit-backed blur cannot be used in SwiftUI flattening/snapshot paths.
Actual Behavior
SwiftUI attempts to flatten a hierarchy containing
VariablurViewand logs:Likely Cause
VariablurViewis aUIViewRepresentablebacked byUIVisualEffectViewand the runtimeCAFilter("variableBlur")path. SwiftUI cannot flatten platform views into an offscreen render target for context menu previews,ImageRenderer,drawingGroup(), and similar APIs.Workaround
For snapshot-sensitive card backgrounds, use a pure SwiftUI/image-renderable fallback: duplicate the image, apply native
.blur(radius:), and mask the blurred copy with aLinearGradientor another snapshot-safe mask.Acceptance Criteria
ImageRenderer,drawingGroup(), and similar effects that flatten input.