|
Hello, I'm working on a SwiftUI project with cards that contain text. However, swiftUI will sometimes cutoff the text mid-word and put a single (or a few) letters on a new line. I want to prevent words from being cutoff mid-line, but can't figure out how to do so. I would appreciate any thoughts on how to prevent the text from wrapping when I don't want it to.
|
|
I know it's not much help, but if it makes you feel any better at all I can tell you that I, too, have been unsuccessfully dealing with this problem for a year now. I can't seem to stop Springsteen or Millenium from displaying as Springste / en or Milleni / um on two lines, regardless of how I change the modifiers. It's awful. |
|
|
|
My problem is reverse. On a macOS application SwiftUI.Text insists on wrapping by word instead of char, and it does not use the available width properly. Really frustrating. SwiftUI on the mac feels like beta software. |
|
You could use UIKit's UILabel for that:
|
|
Hi micartu, yeah cool but what about a little more context. Maybe you got a usage tip too? I already take the code and put it in a swift-File with the UI-imports (SwiftUI and UIKit) ontop thank you and kindly Regards |
|
Here is what I got so far...
I think I found how to use it with cmd + "klick-klack" on the appropriate system-Library components. But now I'm struggling with the Binding-Parameter (down there). I don't know what to do there. |
SPONSORED Alex is the iOS & Mac developer’s ultimate AI assistant. It integrates with Xcode, offering a best-in-class Swift coding agent. Generate modern SwiftUI from images. Fast-apply suggestions from Claude 3.5 Sonnet, o3-mini, and DeepSeek R1. Autofix Swift 6 errors and warnings. And so much more. Start your 7-day free trial today!
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.