Ramotion/animated-tab-bar

App Crashes on setSelectedIndex Method call programmatically to select an index.

amit2908 opened this issue · 1 comments

In file RAMAnimatedTabBarController+BottomLine.swift

   `func setBottomLinePosition(index: Int, animated: Bool = true) {
         guard let itemsCount = tabBar.items?.count, itemsCount > index,
         let currentItem = (containers.filter { $0.value.tag == index}).first?.value else { return }
         lineLeadingConstraint?.isActive = false
    
         lineLeadingConstraint = bottomLine?.leadingAnchor.constraint(equalTo: currentItem.leadingAnchor)
         lineLeadingConstraint?.isActive = true
    
    if animated {
        UIView.animate(withDuration: bottomLineMoveDuration) { self.bottomLine?.superview?.layoutIfNeeded()  
                 // **App crashed on this line with EXC_BAD_ACCCESS(code=2, address=)** 
             }   
                   } else {
                self.bottomLine?.superview?.layoutIfNeeded()
             }
            }`