Text rendering on iOS SwiftUI: Rendering text beyond container’s bounds?

Martin Wenzel
Posts: 57
Does anyone know if I can force iOS’s SwiftUI to render text beyond a container’s bounds, similar to what you would do in CSS using overflow: visible?
Tagged:
0
Answers
-
Hi Martin. Perhaps there aren't many iOS developers here, and something like StackOverflow will be a better place for asking this. Alternatively, if you ask the same question to ChatGPT or similar AI (if you're o'kay to using it), it will provide you ready made solutions right away. A quick guess is a parent container could cause the clipping.0
-
It's a common issue of UILabel. We ran into this with Font Awesome as well. There are a few workarounds though, this Stack Overflow is a good start for some of those: https://stackoverflow.com/questions/36176356/uilabel-subclass-text-cut-off-in-bottom-despite-label-being-correct-height0
-
Hey @Michael Rafailyk and @Roel Nieskens, thanks for the pointers!My issue is similar yet different: The “* i)” in my example (where I'm stacking glyph elements) defines the width of the visible container, this causes the “K” in “HRK” to be cut off in SwiftUI’s rendering. Like in any web browser (see screenshot) I would like to have it rendered in its entirety.I'll dig and report back.0
-
Michael Rafailyk said:Hi Martin. Perhaps there aren't many iOS developers here, and something like StackOverflow will be a better place for asking this. Alternatively, if you ask the same question to ChatGPT or similar AI (if you're o'kay to using it), it will provide you ready made solutions right away. A quick guess is a parent container could cause the clipping.0
-
So, you need to:
1. Prevent words (with spaces between them) from breaking the line.
2. Allow the text to overflow the container horizontally.
In CSS it iswhite-space: nowrap; overflow-x: visible;
I hope this helps to formulate the problem more precisely.0 -
In my case the “overflow-x” is the issue. It's this behaviour we can't reproduce in SwiftUI on iOS. The “nowrap” is not the problem here, that works as it should.
0
Categories
- All Categories
- 46 Introductions
- 3.9K Typeface Design
- 485 Type Design Critiques
- 560 Type Design Software
- 1.1K Type Design Technique & Theory
- 650 Type Business
- 848 Font Technology
- 29 Punchcutting
- 518 Typography
- 119 Type Education
- 322 Type History
- 77 Type Resources
- 110 Lettering and Calligraphy
- 31 Lettering Critiques
- 79 Lettering Technique & Theory
- 546 Announcements
- 88 Events
- 114 Job Postings
- 170 Type Releases
- 173 Miscellaneous News
- 275 About TypeDrawers
- 53 TypeDrawers Announcements
- 120 Suggestions and Bug Reports