-
Notifications
You must be signed in to change notification settings - Fork 499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support adjustable font text size (Dynamic Type) #4444
Comments
An example of implementation is #4445 |
(the non-goal-based version of this issue is #496) |
Has there been any movement here? There's many inconsistencies with text sizing, having this addressed would be great - some screenshots with a large text size (I don't tend to use text this large, but I do have it a bit smaller, and it's still noticeable - this just makes it clearer): Would be great to have everything functioning. |
@YourOrdinaryCat This is unlikely to happen on Element iOS any more. We're focussed on Element X (which has supported Dynamic Type from the get go) and a lot of the code that would need to be updated is very old and fragile. Sorry I can't be more helpful here, but I would recommend you try out our early TestFlight of Element X to see if it suits your needs. |
Got it, that is a bit sad though. Element X doesn't support iOS 15, are there any plans for an iOS 15 target or are we stuck with Element (and the web version)? |
Sadly no, Element X's navigation is all based upon APIs from iOS 16, so it won't be possible to support 15 I'm afraid. |
Goal
The goal is to support as much as possible device text size change aka Dynamic Type.
This issue is focused on development side and has been made to handle #496
Prerequisite
To support Dynamic Type we should use Text Styles. In Element we are now using following Text Styles: https://www.figma.com/file/X4XTH9iS2KGJ2wFKDqkyed/Compound?node-id=1362%3A0
Update automatically views on device font size change
UILabel
,UITextField
andUITextView
conform toUIContentSizeCategoryAdjusting
protocol and have a property called adjustsFontForContentSizeCategory that enables to automatically updates its font when the device's content size category changes.To automatically update views when text size change in system:
UILabel
,UITextField
andUITextView
:Automatically Adjusts Font
checkbox in the Attribute inspector.adjustsFontForContentSizeCategory = true
UIButton
a variable called@IBInspectable var vc_adjustsFontForContentSizeCategory: Bool
has been added inUIButton
extension:vc_adjustsFontForContentSizeCategory
to on.vc_adjustsFontForContentSizeCategory = true
Listen to device font size change
If you want to update your layout in real time according to the device font changes and
adjustsFontForContentSizeCategory
is not enough. You can react to the change inUIView
orUIViewController
this way:It's also possible to listen to changes with
UIContentSizeCategory.didChangeNotification
notification. More information here.Source: https://useyourloaf.com/blog/auto-adjusting-fonts-for-dynamic-type/
Debug font size change
In Xcode with the
Environment Overrides
: https://sarunw.com/posts/scaling-custom-fonts-automatically-with-dynamic-type/#debugging-font-sizeWith the Accessibility Inspector: https://fluffy.es/introduction-to-dynamic-type/#inspector
The text was updated successfully, but these errors were encountered: