iosswiftuitableviewuivisualeffectviewuiblureffect

Blur effect on tableview background does not work


I'm trying to replicate the frosted glass look in the tableview at the bottom.

enter image description here

I tried the methods described here and here but none of them seems to work now. Because this is the result I get.

enter image description here

Here is my code.

tableView.backgroundColor = .clear
let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .light))
tableView.backgroundView = blurView

I tested on both a simulator and a device running iOS 12.1 but the issue is present in both.

Demo project

What am I missing here?


Solution

  • It doesn't work, because the surfaceView of your FloatingPanelController isn't transparent. Do this, when creating the floating panel:

    floatingPanelController.surfaceView.backgroundColor = .clear