title: Why I cannot make my UITabBarController blurred?
body: <p>I have a <code>UITabBar</code> and I want to make it blurred. I wrote the following code:</p>
  
  <pre><code>import UIKit
  
  class TabBarController:UITabBarController {
  
      override func viewDidLoad() {
          super.viewDidLoad()
          let blur = UIBlurEffect(style: UIBlurEffectStyle.Light)
          let blurView = UIVisualEffectView(effect: blur)
          blurView.frame = self.view.bounds
          blurView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight]
          self.view.layer.insertSublayer(blurView, atIndex: 0)
      }
  
  }
  </code></pre>
  
  <p>but somehow the last line throws error:</p>
  
  <blockquote>
    <p>Cannot convert value of type 'UIVisualEffectView' to expected argument
    type 'CALayer'</p>
  </blockquote>
  
  <p>how can I fix that?</p>
  
  <p>I changed the last line to:</p>
  
  <pre><code>self.tabBar.addSubview(blurView)
  </code></pre>
  
  <p>but now the whole tabbar is blurred (even with icons and they are not visible). When I changed this line to:</p>
  
  <pre><code>self.tabBar.sendSubviewToBack(blurView)
  </code></pre>
  
  <p>then the tabbar is visible, but not blurred. I want to achieve effect from accepted answer from here <a href="https://stackoverflow.com/questions/33819852/black-background-on-transparent-uitabbar">Black background on transparent UITabBar</a> but here it is uitabbar and I'm using uitabbarcontroller... Can you help me with applying blur in my case?</p>