daprice / Variablur

Variable blur effects for SwiftUI, powered by Metal

Home Page:https://swiftpackageindex.com/daprice/Variablur

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VariableBlurView() by itself?

Saim-Khan1 opened this issue · comments

Hey @daprice! Love this repo, been waiting for a Metal based progressive blur for a while now so thanks a lot for putting this together! Was just wondering whether it'd be possible to have a VariableBlurView() as a view itself, so it can be, for example, put on top of content in a ZStack or as an overlay instead of being applied to a view as a modifier? A bit like UIKit's UIVisualEffectView I suppose. That'd be awesome, thanks a lot :)

I’d love that too, but I don’t think SwiftUI currently provides a documented way for shaders to sample from layers behind a view, only from the view’s own layer.

The closest thing I can find is the ability to use a Shader as a ShapeStyle, which in theory could work similar to Apple’s built in Materials, but the shader function signature they give doesn’t pass a layer to sample from.

I hope future versions of SwiftUI expand shader functionality to allow this. 🤞

Leaving this issue open in case someone else knows of a way.

Ahh I see, that's a shame. Thanks a lot for looking into it anyway, and yep fingers crossed! 🤞