How to hide a custom tabBar?

I use a custom tabBar in my app. I hides default bar view and create a new view with rounded corners. In some view controllers I want to hide my tabBar. I use this code to do it:

self.tabBarController!.tabBar.isHidden = true

And my tabBar is hidden, but the custom view called tabBarView inside the TabBarViewControler is not hidden. How to fix this?

code in TabBarViewControler class:

class TabBarViewController: UITabBarController {

    let tabBarView = UIView()
    let blurView = UIVisualEffectView(effect: UIBlurEffect(style: .systemChromeMaterialLight))
    
    override func viewDidLoad() {
        super.viewDidLoad()
        generateTabBar()
        setupView()
        setupTabBarAppearance()
    }
    
    func setupView() {
        view.addSubview(tabBarView)
        tabBarView.addSubview(blurView)
        view.bringSubviewToFront(tabBar)
        tabBarView.bringSubviewToFront(blurView)
    }
    
    override func tabBar(_ tabBar: UITabBar, didSelect item: UITabBarItem) {
            guard let barItemView = item.value(forKey: "view") as? UIView else { return }

            let timeInterval: TimeInterval = 0.38
            let propertyAnimator = UIViewPropertyAnimator(duration: timeInterval, dampingRatio: 0.9) {
                barItemView.transform = CGAffineTransform.identity.scaledBy(x: 0.9, y: 0.9)
            }
            propertyAnimator.addAnimations({ barItemView.transform = .identity }, delayFactor: CGFloat(timeInterval))
            propertyAnimator.startAnimation()
        }
    
    func generateTabBar() {
        
        let tableViewController = TableViewController()
        let favoritesController = FavoritesController()
        let searchViewController = SearchViewController()
        let settingsViewController = SettingsViewController()
        
        let vc1 = UINavigationController(rootViewController: tableViewController)
        vc1.tabBarItem.title = tableViewController.title
        vc1.tabBarItem.image = tableViewController.tabBarImage
        
        let vc2 = UINavigationController(rootViewController: favoritesController)
        vc2.tabBarItem.title = favoritesController.title
        vc2.tabBarItem.image = favoritesController.tabBarImage
        
        let vc3 = UINavigationController(rootViewController: searchViewController)
        vc3.tabBarItem.title = searchViewController.title
        vc3.tabBarItem.image = searchViewController.tabBarImage
        
        let vc4 = UINavigationController(rootViewController: settingsViewController)
        vc4.tabBarItem.title = settingsViewController.title
        vc4.tabBarItem.image = settingsViewController.tabBarImage
        
        viewControllers = [vc1, vc2, vc3, vc4]
    }
    
    private func setupTabBarAppearance(){
        
        tabBar.backgroundImage = UIImage()
        tabBar.backgroundColor = .clear
        tabBar.shadowImage = UIImage()
        tabBar.itemPositioning = .centered
        tabBar.tintColor = mainColor
        tabBar.itemSpacing = 5
        
        tabBarView.backgroundColor = .white
        tabBarView.translatesAutoresizingMaskIntoConstraints = false
        
        tabBarView.layer.shadowColor = UIColor.black.withAlphaComponent(1.0).cgColor
        tabBarView.layer.shadowOffset = CGSize(width: 0, height: 10)
        tabBarView.layer.shadowOpacity = 0.2
        tabBarView.layer.shadowRadius = 20
        tabBarView.layer.cornerRadius = (tabBar.frame.size.height+20)/2
        
        tabBarView.heightAnchor.constraint(equalToConstant: tabBar.frame.size.height+20).isActive = true
        tabBarView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -SafeArea().bottom()).isActive = true
        tabBarView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: SafeArea().left()+40).isActive = true
        tabBarView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -SafeArea().right()-40).isActive = true
        
        blurView.translatesAutoresizingMaskIntoConstraints = false
        blurView.clipsToBounds = true
        blurView.layer.cornerRadius = (tabBar.frame.size.height+20)/2
        
        blurView.topAnchor.constraint(equalTo: tabBarView.topAnchor, constant: 0).isActive = true
        blurView.bottomAnchor.constraint(equalTo: tabBarView.bottomAnchor, constant: 0).isActive = true
        blurView.leadingAnchor.constraint(equalTo: tabBarView.leadingAnchor, constant: 0).isActive = true
        blurView.trailingAnchor.constraint(equalTo: tabBarView.trailingAnchor, constant: 0).isActive = true
    }
    
    override func viewDidLayoutSubviews() {
        tabBar.invalidateIntrinsicContentSize()
        tabBar.frame.origin.y = tabBar.frame.origin.y - SafeArea().bottom() - 10
    }
}

1

What about if you create a function to hide inside of your TabBarViewController to hide the view where you are adding the subviews.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật