onl1ner / TabBar

📱 TabBar – highly customizable tab bar (i.e. TabView) for your SwiftUI application.
MIT License
422 stars 45 forks source link

Option to give Image String instead of custom image String #16

Open vchaubey-ontic opened 1 year ago

vchaubey-ontic commented 1 year ago

How could we give the asset string name instead of giving custom image name?

onl1ner commented 1 year ago

Hello, @vchaubey-ontic!

You can provide string with image name in your enum with tab items and use this string to show your custom images in the implementation of custom tab items (see TabItemStyle)

vikaschaubey57 commented 1 year ago

@onl1ner as i checked the code everywhere you have used Image with SystemName Image(systemName: icon) but I want to use simple name like Image(icon), how to achieve it, could you give an example.

onl1ner commented 1 year ago

@vikaschaubey57, I see. So, in this case you could implement your own tab item style and use your own image name there. The default implementation is using systemName initializer, because it is supposed to replicate the behavior of default tab bar

Benetos commented 1 year ago

Traditional in SwiftUI you would just use Image(“ImageName”) where ImageName is the name you gave the image in the asset’s catalog.

On Mon, May 8, 2023 at 1:03 AM Vikash Kumar Chaubey < @.***> wrote:

@onl1ner https://github.com/onl1ner as i checked the code everywhere you have used Image with SystemName Image(systemName: icon) but I want to use simple name like Image(icon), how to achieve it, could you give an example.

— Reply to this email directly, view it on GitHub https://github.com/onl1ner/TabBar/issues/16#issuecomment-1537799451, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALQXYGPXOQ7RRXGJC7JEZWLXFCEEDANCNFSM6AAAAAAXW7UJOU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

jedmund commented 8 months ago

Resurrecting this to say it is counter-intuitive to require systemName, or the documentation should at least say so. It would be great if the library provided an easy way to use Asset Library images as well without jumping through hoops.

onl1ner commented 8 months ago

Well yeah, I see your point @jedmund. The systemName initializer is used only in the default implementation of style, but I will work on adding a way to easily use images from assets