CPTabBarTemplate has issue for memory management?

I write a empty class for deinit test

class MyEmptyModel {
    deinit {
        print("MyEmptyModel deinit")
    }
}

Every tab in CPTabBarTemplate must be visited at least once, after which deinit is called.

so it can cause memory issue if user doesn't visit all tabs.

I think it's a bug.

here's a code I wrote for test. is there any code wrong?

// create first tab list template
let firstItem = CPListItem(text: "firstItem", detailText: "hoho")
        firstItem.handler = { _, completion in
            let firstInnerItem = CPListItem(text: "firstInnerItem", detailText: "haha")
            firstInnerItem.handler = { _, completion in
                print("firstInnerItem!!")
                completion()
            }
            firstInnerItem.userInfo = MyEmptyModel()
            let firstInnerSection = CPListSection(items: [firstInnerItem])
            let firstInnerList = CPListTemplate(title: "First Inner", sections: [firstInnerSection])
            firstInnerList.emptyViewTitleVariants = ["First Inner empty"]
            
            interfaceController.pushTemplate(firstInnerList, animated: true) { _, _ in
                completion()
            }
        }
        
        let firstSection = CPListSection(items: [firstItem])
        let firstList = CPListTemplate(title: "First", sections: [firstSection])
        
// create second tab list template
        let secondItem = CPListItem(text: "secondItem", detailText: "hoho2")
        secondItem.handler = { _, completion in
            let secondInnerItem = CPListItem(text: "secondInnerItem", detailText: "haha2")
            secondInnerItem.handler = { _, completion in
                print("secondInnerItem!!")
                completion()
            }
            secondInnerItem.userInfo = MyEmptyModel()
            let secondInnerSection = CPListSection(items: [secondInnerItem])
            let secondInnerList = CPListTemplate(title: "Second Inner", sections: [secondInnerSection])
            secondInnerList.emptyViewTitleVariants = ["Second Inner empty"]
            
            interfaceController.pushTemplate(secondInnerList, animated: true) { _, _ in
                completion()
            }
        }
        
        let secondSection = CPListSection(items: [secondItem])
        let secondList = CPListTemplate(title: "Second", sections: [secondSection])
        
// create third tab list template
        let thirdItem = CPListItem(text: "thirdItem", detailText: "hoho3")
        thirdItem.handler = { _, completion in
            let thrdInnerItem = CPListItem(text: "thirdInnerItem", detailText: "haha3")
            thrdInnerItem.handler = { _, completion in
                print("thirdInnerItem!!")
                completion()
            }
            thrdInnerItem.userInfo = MyEmptyModel()
            let thirdInnerSection = CPListSection(items: [thrdInnerItem])
            let thirdInnerList = CPListTemplate(title: "Third Inner", sections: [thirdInnerSection])
            thirdInnerList.emptyViewTitleVariants = ["Third Inner empty"]
            
            interfaceController.pushTemplate(thirdInnerList, animated: true) { _, _ in
                completion()
            }
        }
        
        let thirdSection = CPListSection(items: [thirdItem])
        let thirdList = CPListTemplate(title: "Third", sections: [thirdSection])
                
// create tabbar template and set to root template
        var tabBarTemplates = [CPTemplate]()
        tabBarTemplates.append(firstList)
        tabBarTemplates.append(secondList)
        tabBarTemplates.append(thirdList)
        
        let tabBarTemplate = CPTabBarTemplate(templates: tabBarTemplates)
        
        interfaceController.setRootTemplate(tabBarTemplate, animated: false) { _, _ in
        }
CPTabBarTemplate has issue for memory management?
 
 
Q