     
  
     func tabBarController(_ tabBarController: UITabBarController, shouldSelect viewController: UIViewController) -> Bool {
-        if tabBarController.selectedIndex == 4 {
-            backImage = nil
-        }
-        else if tabBarController.viewControllers?.index(of: viewController) == 3 {
+        previousIndex = tabBarController.selectedIndex
+
+        if tabBarController.viewControllers?.index(of: viewController) == 3 {
+            //backImage = blurImage(targetImage: snapView(targetView: tabBarController.view))
             backImage = snapView(targetView: tabBarController.view)
         }
         

    
    func tabBarController(_ tabBarController: UITabBarController,
                          didSelect viewController: UIViewController){
        if tabBarController.viewControllers?.index(of: viewController) == 3 {
            if let backImage = backImage {
                viewController.view.backgroundColor = UIColor(patternImage: backImage)
            }
            else {
                viewController.view.backgroundColor = UIColor.white
            }
        }




class MainViewController: UITabBarController {
    var backImage: UIImage!
    var previousIndex: Int?
    

    override func viewDidLoad() {
