Reputation: 113
I'm creating a backdrop layer.
layer.render(in: context)
.CADisplayLink
in real-time.Imagine I have a ScrollView
, when user scrolls the view, the rendered content is one-frame behind the underlying view. Making the experience terrible.
TimelineView(.animation) { timeline in
Canvas { context, size in
let _ = timeline.date // Update content with DisplayLink.
context.withCGContext { cgContext in
for layer in renderer.backdropLayers {
layer.render(in: cgContext)
}
}
}
}
How can I improve the rendering process?
I know there is a private class called
CABackdropLayer
available to use. But I'm doing a SwiftUI App. Ideally, I can create a backdrop effect view and apply custom Shader to it.
You can check out my post on Twitter (or X) for what I'm building now.
Upvotes: 0
Views: 162