         button.titleFont = titleFont
         stackView.addArrangedSubview(button)
         buttons.append(button)
+        return button
     }
     
     func configureUnderlineWidth() {

    }
    
    func updateTabs() {
        if !(selectedIndex < buttons.count) {
            fatalError("Invalid index for buttons—selectedIndex: \(selectedIndex)")
        }
        for button in buttons {
            button.selected = button.index == selectedIndex
            button.titleFont = titleFont

        buttons.removeAll()
        
        for (index, dataObject) in dataObjects.enumerate() {
            let button = createButton(dataObject, atIndex: index)
            button.selected = button.index == selectedIndex
        }
        
        configureUnderlineWidth()
    }
    
    func createButton(dataObject: TabDataObject, atIndex index: Int) -> TabButton {
        let button = TabButton(index: index, dataObject: dataObject)
        button.delegate = self
        button.selectedColor = tintColor
