Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to assign dynamic text styles in Xcode 11?

Edit: Probable Bug. Seeking fix or workaround…

How can I get the system’s text styles to be available in the interface builder when using Xcode 11?

I just started using Xcode 11 this week. In the interface builder (storyboard mode), when I go to assign a dynamic type text style to a Label or Button, using the Font -> Style pop-up, all the text styles are missing from the popup menu.

screenshot of Font Style popup menu, missing text styles

I do have the Dynamic Type “Automatically Adjusts Font” checkbox checked, as well.

I’m not sure if this is a bug, an intentional change I can’t find documentation for, or something else.

The expected behaviour is described in Apple’s developer documentation “Scaling Fonts Automatically”. Specifically, in the “Configuring Text Styles Using Interface Builder” section.

Further exploration: I’ve tried it with new projects, old projects (from Xcode 10), projects targeting iOS 12.2 and 13.1. All had the same problem of no text styles in the popup menu.

like image 392
Grant Neufeld Avatar asked Oct 09 '19 20:10

Grant Neufeld


2 Answers

I experience the same problem when upgrading from Xcode 11.0 to Xcode 11.1 or 11.2 beta 2:

Xcode 11.0:

Text styles are available

Xcode 11.1:

enter image description here

I also filed a bug report (FB7415999) with Apple and also opened an issue with them.

**My curren solution at the moment is a downgrade to Xcode 11.0 for UI development and a parallel install of Xcode 11.2 beta for on device runs **

like image 115
Georg Avatar answered Oct 25 '22 00:10

Georg


This is probably a bug in Xcode 11.1. I ran into the same thing and filed a bug with Apple (FB7368959). A colleague running Xcode 11.1 on Catalina did not have the same problem, nor did another running Xcode 11.1 on Mojave.

Here is a workaround that got me back on track: I opened the problematic project in both Xcode 10.3 and 11.2 beta. In both, the dynamic type styles were available in IB. I didn't change anything, but reverted to Xcode 11.1, and now the styles are there, too. Hopefully this works for Grant and anyone else that runs into this annoyance.

Edit Mar. 17, 2020: This problem has reoccurred for me on Xcode 11.3.1. It seemed to happen with a specific project, and the problem spread to a second machine as soon as I opened that project. My workaround didn't help when I opened the project in 11.4 beta 3.

like image 37
Steve Madsen Avatar answered Oct 25 '22 00:10

Steve Madsen