TabBar icon indicating copy to clipboard operation
TabBar copied to clipboard

Option to give Image String instead of custom image String

Open vchaubey-ontic opened this issue 1 year ago • 6 comments

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

vchaubey-ontic avatar May 05 '23 11:05 vchaubey-ontic

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)

onl1ner avatar May 05 '23 19:05 onl1ner

@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.

vikaschaubey57 avatar May 08 '23 06:05 vikaschaubey57

@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

onl1ner avatar May 11 '23 18:05 onl1ner

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: @.***>

Benetos avatar May 25 '23 21:05 Benetos

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.

jedmund avatar Feb 23 '24 04:02 jedmund

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

onl1ner avatar Feb 23 '24 05:02 onl1ner