SwiftUI, How to create BlurEffect. Introducing 2 ways.
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
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
As complex as it might seem, I recommend you to use this approach because you can use various styles for your blur view.
You see!?
Conclusion
- Add blur effect with modifier .blur
- Add blur effect with UIViewRepresentable. This approach is recommended because you can have more options.