5

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!

danqing
  • 3,348
  • 2
  • 27
  • 43
  • To which version does if fall back to? Since there are much more blur styles now I imagine the warning wants to tell you "it's ambiguous what happens in iOS 12, you should probably do it in code"... – Frank Rupprecht Sep 23 '19 at 05:33

1 Answers1

6

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)
   }
BilalReffas
  • 8,132
  • 4
  • 50
  • 71
  • 1
    Although I accepted the answer, I'm not sure if I should since it doesn't really add much to what I already stated in the question (that I know how to do it in code and don't know how to do it in SB)... – danqing Oct 13 '19 at 08:47