I am updating the icons in my app. After I heard Apple released an icon font named SF Symbols with iOS 13, I was wondering if I can only use them in iOS 13 or if it is possible to use them in lower versions of iOS too.
If I want to use them, do I have to implement a fallback for older versions?
You can not use SFSymbols natively in iOS versions older than iOS 13 (see Apple's Human Interface Guidelines for SF Symbols).
However, if you are interested in using the graphics you can use the SF Symbols app to export SVG versions of the icon. Then use some graphics tool to convert them to PNG icons you can import into your asset catalog.
You can open .svg use Figma. Then select the Regular-M and export as PDF or PNG.
Update for more details:
You can use the PDF vector assets in Xcode. So that the icon should fit any size you want. Please check this blog: https://useyourloaf.com/blog/xcode-9-vector-images/
The new Xcode has a different UI but basically the same. In the Assets Catalog:
Drag your PDF vector file in.
Check "Preserve Vector Data"
Choose "Single Scale"
Work around in progress
I did not manage to find the solution, I gave up, but actually I went pretty far in investigating. Maybe someone luckier than me will be able to figure out hpw to continue the work I started:
In Apple documentation, it is said that, in order to easily browse all the new iOS 13 SF Symbols, you can dowmload the SF Symbols app : https://developer.apple.com/design/human-interface-guidelines/sf-symbols/overview/
Once instaled you can go in Application > SF Symbols > showPackage content
From there, under content > Resources we can find an interesting file named SFSymbolsFallback.ttf
And if you try to open this file on https://fontdrop.info/ you can see that it contains all the font glyphs that are released in iOS 13 as SF Font, with associated unicodes
Bingo? not so fast...
From there I tried to import this .ttf into my project in iOS 12, on XCode 10.2.1, but it seems that it is never properly imported. It is not retrievable in the list of available fonts when calling UIFont.familyNames
More interesting, if I try to import this font in Font Book app, I receive a warning that says that it contains duplication, some kind of conflict with an existing font
From there?
My guess is that there is another font that prevent SF Symbols to be installed, in Font Book and on Xcode.
One of the solution could be to find the one that is in conflict in XCode package and delete it ( this may be Symbols font or San Francisco that are causing problems idk)
I also tried to open the font file with a font editor and change its Name and family Name without success.
If anyone want to continue investigating..
Hope this can help someone !
This icon set is based on SF Symbols https://framework7.io/icons/
You can upload the new ios 13 sf-pro-rounded font to your project. Then enable that font in your label.
Open sf symbols, click on the smbol you want, cmd+c, go to your project, click on a label cmd+v. Run the project, and there should be the icon
cheers,
In SF Symbols 3.1, Edit > Copy Image as...
You can choose PNG/point size/pixel scale and paste into Preview etc.
SF Symbols is a system only supported on iOS 13 or later - it's not possible to use them on iOS 12 or below. You'll need to use fallbacks for those older operating systems.
See Human Interface Guidelines
1. Import the font:
Open the Fonts app, search for the SF Pro Rounded font, right-click on the variant you want (e.g. Light) and click Show in Finder. Drag that file (e.g. SF-Pro-Rounded-Light.otf) into your XCode project and tick "Copy if necessary".
2. Select the font:
Select your UILabel or UIButton, set the Title to Attributed (this is important) and select the font you just copied (e.g. SF Pro Rounded Light).
3. Set the symbol:
Find the icon you want in SF Symbols, select it, press CMD+C to copy, switch back to XCode and click in the text part of the UILabel or UIButton Title and press CMD+V to paste.
A huge thank you to Dave van Wijk for the solution!
Related
I'm trying to add the custom font to my application. I've already tried to follow all standard recommendations from the documentation and the rest of articles related to the problem.
What I've done:
installed the font to the Font Book
copied ttf files to application directory
added font files to the "Fonts provided by application" in Info.plist
checked app in "Target Membership"
checked font files in "Copy Bundle Resources"
As a result font is visible in Attribute Inspector and successfully changed in the LaunchScreen storyboard. But when I run app in simulator only size and colour are applied but not font-face.
I'm using XCode 12.2 (12B45b) in Big Sur.
What else should I try? Thank you in advance.
In the case that the problem is only for LaunchScreen, you can't use custom fonts on the LaunchScreen. System will automatically replace your custom font to system font during runtime.
A quick workaround is to use an UIImageView and have your text as UIImage on it, literally a picture of your text as .png / .jpeg or similar.
Note: It may take some time before you can see the image, sometimes you had to clean the Build Folder and reinstall the app a couple of times in order to see the image.
I have some nice fonts that I like to use in my iOS applications. However, it is slightly annoying to add the font to Xcode every time. Is there a way I can keep add a font permanently to a project so it will stay in there forever? Please let me know if I am not being specific enough. Thanks!
Unfortunately only standard iOS fonts are "permanently" in Xcode. Other fonts have to be added in manually when you want to use it in a specific project.
This is because when you add the font it is included in your bundle when uploaded to the app store vs. the system fonts already being on the iOS system.
I have downloaded Open Sans font and added all the .tff files into my Xcode project, and have checked the checkbox in "Target Membership" pane for each file. I have added the UIAppFonts key and values in Info.plist, and I am sure that the values are typo-free. Plus, the .tff files are added to "Copy Bundle Resources", and the custom font is showing up in Interface Builder. And then I changed the font of all the labels to Open Sans in the Interface Builder (no code).
But when I run the app in the simulator, all the labels and buttons are showing the system font in ultra small sizes, like this:
One thing to note is that I am using Xcode 7 beta 5, and the app's Base SDK is iOS 9.
But why is there this problem? Is it a bug? Thanks!
Check That fonts inside the proyect are part of the target.
Select fonts, verify the property Target Membership for your app is checked at the right in File Inspector.
That solved the problem for me:
Blip, here's a photo of what I did in an empty "Single View" project. And, I could see the font on sim and IB editor. Anything look different for your project? Maybe recreate the basics in a new project, just to double check? All of my notes on the image were associated with my original thoughts...just use them for reference as you double check things.
I recently encountered this problem too. But it only happened for one font-style of a font-family, the others worked fine.
I could only solve it by using this font in a button, then the font was also available for other controls such as labels or the large title.
I was reading the iOS 8 series from RayWenderlich.com website.
I came to the localization and internationalization. Read every single bit of it but I could not succeed on localizing images. (I did localized strings with no errors :) )
Here is what I have done:
1- Created a project of Single View Application
2- Placed an UIImageView on the Sotryboard by drag and drop.
3- Added my image to my project (back.png).
4- Assigned my UIImageView to that image (back.png).
Now is the steps for localization:
1- Go to project navigator and select the project.
2- Under localization, "Use Base Internationalization" us checked by default.
3- I added Arabic language.
4- Localized Storyboard files and its .strings and my image (back.png)
I have two image files English and Arabic versions. Each file on its respective folder. See screenshot.
When I run my app on the simulator which has Arabic language installed and selected. My imageView still displays the English version of the image.
I tried to use ar_SA (Arabic, Saudi Arabia) but still same issue. My image is displayed in English.
I have my simulator reset, and I have deleted derived files form library/dev.../xcode... But my app does not care about the Arabic version of the image.
if you want to localize app according to system language it is not happen in iOS 8 because it is a bug.
you can be sure from this point by trying to run the code in the following link.
https://github.com/EmanRezk/Localize.git
change simulator language to arabic in
iphone5s (7.0) then run app you will see the arabic image.
iphone5s (8.1) then run app you will see the english image.
I advice you to localize app according to app language not the system language.
I've been using XCode 6 and from what I know, it has the "Live rendering" feature which display custom fonts right on the storyboards.
I want to use Museo Sans, and I have 8 variations (see image). I dragged them into XCode but the weird thing is that it only shows two of them in the style panel (see second image, 100 and Regular).
I've also tried adding them to the "Fonts provided by application" index.
Any guesses why the other ones are not appearing?
Thanks.
EDITED:
I got the same fonts with OTF extension, and they all seemed to work OK. I think it's a TTF bug.