iosstoryboarduivisualeffectviewios-darkmode

System blur style before iOS 13.0 warning when using material style in storyboard


I'm trying to adapt my app to iOS 13 dark mode, and when I set a UIVisualEffectView's blur to any of the new modes (like material) in Storyboard I get the warning:

System blur style before iOS 13.0

I understand that, as well as I can use version checks in code to support both iOS 13 and previous versions. However, I'm not sure how to do it in Storyboard (which I prefer), and when I run the app in an iOS 12 device, it actually renders fine (falls back correctly).

How can I get rid of the warning?

Thank you!


Solution

  • Afaik there is not a solution in storyboard. You have to do this in code.

        if #available(iOS 13.0, *) {
            return UIBlurEffect(style: .systemUltraThinMaterial)
        } else {
            return UIBlurEffect(style: .regular)
       }