SwiftUI, How to create BlurEffect. Introducing 2 ways.

KD Knowledge Diet
2 min readJul 19, 2022

Swift’s Blur Effect is somehow special. It makes you feel incredibly professional. It was really hard to make something similar when developing for Android. When pursuing AdvancedUI, there are many cases of adding a blur effect. In particular, it is common to use blur effect when opening a dialog. Today, you will learn two ways to create blur effect in SwiftUI.

Add blur with modifier

Nice Cat Behind :)
Blur Effect

If you don’t need to control blur effect, just by adding .blur, you can add blur effect. But with this approach, you are limited to only one blur style.

Add Blur with UIViewRepresentable

Nice cat behind :)
UIViewRepresentable

As complex as it might seem, I recommend you to use this approach because you can use various styles for your blur view.

Blur style you can choose from

You see!?

Conclusion

  1. Add blur effect with modifier .blur
  2. Add blur effect with UIViewRepresentable. This approach is recommended because you can have more options.

--

--

KD Knowledge Diet

Software Engineer, Mobile Developer living in Seoul. I hate people using difficult words. Why not using simple words? Keep It Simple Stupid!