TabSection always show sections actions.

I'm giving a go to the new TabSection with iOS 18 but I'm facing an issue with sections actions. I have the following section inside a TabView:

TabSection {                    
    ForEach(accounts) { account in
        Tab(account.name , systemImage: account.icon, value: SelectedTab.accounts(account: account)) {
            Text(account.name)
        }
    }
    
} header: {
    Text("Accounts")
}
.sectionActions {
    AccountsTabSectionAddAccount()
}

I'm showing a Tab for each account and an action to create new accounts. The issue I'm facing is that when there are no accounts the entire section doesn't appear in the side bar including the action to create new accounts. To make matters worse the action doesn't show at all in macOS even when there are already accounts and the section is present in side bar. Is there some way to make the section actions always visible?

Answered by DTS Engineer in 794161022

@alexortizl They're some options:

The issue I'm facing is that when there are no accounts the entire section doesn't appear in the side bar including the action to create new accounts.

An alternative would be to display AccountsTabSectionAddAccount in a toolbar if accounts collection is empty.

To make matters worse the action doesn't show at all in macOS even when there are already accounts and the section is present in side bar.

Depending on the tabViewStyle for example sidebarAdaptable, on macOS the section action displays when you hover over the TabSection header. However if that is not the case for you, please file a bug report, using Feedback Assistant.

Accepted Answer

@alexortizl They're some options:

The issue I'm facing is that when there are no accounts the entire section doesn't appear in the side bar including the action to create new accounts.

An alternative would be to display AccountsTabSectionAddAccount in a toolbar if accounts collection is empty.

To make matters worse the action doesn't show at all in macOS even when there are already accounts and the section is present in side bar.

Depending on the tabViewStyle for example sidebarAdaptable, on macOS the section action displays when you hover over the TabSection header. However if that is not the case for you, please file a bug report, using Feedback Assistant.

TabSection always show sections actions.
 
 
Q