Skip to content

TabBar layout ignores vertical separators width #563

@stefanomondino

Description

@stefanomondino

New Issue Checklist

Issue Description

When using separators in TabBar (TMConstrainedHorizontalBarLayout), the inner stack view is applying a width constraint on both items and separators, ignoring the separator's width.

This results in button items and separators having the same width, which is not the intended behavior.

This can easily be reproduced by changing provided example with this snippet in TabViewController.swift instead of ButtonBar in viewDidLoad

 // Create a bar
        let bar = TMBarView.TabBar()
        
        // Customize bar properties including layout and other styling.
        bar.layout.contentInset = UIEdgeInsets(top: 0.0, left: 16.0, bottom: 4.0, right: 16.0)
//        bar.layout.interButtonSpacing = 24.0
//        bar.indicator.weight = .light
//        bar.indicator.cornerStyle = .eliptical
        bar.fadesContentEdges = true
        bar.spacing = 16.0
        
        bar.layout.separatorWidth = 1
        bar.layout.showSeparators = true

    bar.buttons.customize {
            $0.tintColor = UIColor.tabmanForeground.withAlphaComponent(0.4)
            $0.selectedTintColor = .tabmanForeground
            if #available(iOS 11, *) {
                $0.adjustsFontForContentSizeCategory = true
            }
        }
        bar.indicator.tintColor = .tabmanForeground
        
        // Add bar to the view - as a .systemBar() to add UIKit style system background views.
        addBar(bar.systemBar(), dataSource: self, at: .top)

Other useful things

simulator_screenshot_3EA81E10-D61E-49B0-9AA5-5DB70B4D7756

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions