Closed tedLHMstr closed 1 year ago
Hello, @tedLHMstr!
Yes, you can change the style of your TabItem
with the respect to the selection, there is a isSelected: Bool
parameter that is passed to your implementation of TabItemStyle
protocol.
Hope it helps :)
Thank you for your answer @onl1ner!
Do you propose something like this:
Image(systemName: isSelected ? "\(icon).fill" : icon)
What I was referring to was to control it in the "Item"-enum, which would be suitable since you sometimes want to display a totally different icon :)
I see, that's a good idea to add another function to the TabItemStyle
protocol where you will be able to obtain an Item
-type parameter.
Will give it a look in my free time, but if you can implement it, PR would be appreciated :)
Leaving this issue opened till the feature is implemented
Hello, @tedLHMstr!
You can now provide a selected icon name using selectedIcon
parameter in the entity that conforms to Tabbable
protocol, then you could use this parameter in the function tabItem(icon:selectedIcon:title:isSelected:)
of TabItemStyle
protocol.
Make sure that you have updated library to 1.3.0 version. If you will have a problem feel free to reopen this issue
Is there a way of changing the icon name with respect to the selection state variable? Example: When "Home" tab is selected, I want to use SF-icon "house.fill", otherwise "house".