Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Xcode/Swift, how can I use an SF Symbol as a tab bar icon in assets? The asset field won't accept the .svg file

I can't use an SF Symbol as an asset for a tab bar icon.

I tried using the GUI to drag and drop the file. I'm unsure of how to add it programatically.

I expected to be able to drag/drop but it won't accept the .svg file. I add a new symbol set but that doesn't work as the tab bar icon asset.

like image 228
Paul Drees Avatar asked Jun 09 '19 02:06

Paul Drees


People also ask

How do I make a tab bar on top in Swift?

To add a Tab Bar Controller to the Storyboard, select the 4 placeholders that we just created and the View Controller. Then, go to Editor, select Embed in and Tab Bar Controller. This will envelop all those scenes in a single Tab Bar Controller. Put the new Tab Bar Controller on top of the other controllers.


1 Answers

If you are using the new Xcode 11 beta, the new SF Symbols are already included and you do not need to import the .svg files.

Open your Storyboard file, click on the tab bar icon (not the one in the tab bar controller).

Now open the attributes inspector on the right hand side and open the combo box at "Bar Item" -> "Image". Now there will be the SF Symbols in this list as in the screenshot below.

Screenshot Steps 1-3 Screenshots Step 4

like image 166
tomaculum Avatar answered Sep 30 '22 14:09

tomaculum