This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4919757-your-first-ios-and-swiftui-app/lessons/45
This is a companion discussion topic for the original entry at https://www.raywenderlich.com/4919757-your-first-ios-and-swiftui-app/lessons/45
It seems that setting fixedSize
on the text will prevent the text from being cut off and the ellipsis being shown:
`Text("Hello World").fixedSize(horizontal: false, vertical: true)`
Correct me if I’m wrong
The bug seems to be fixed with 13.1
Using
.lineLimit(Int.max)
instead of
.lineLimit(nil)
did work for me.
With:
.multilineTextAlignment(.center)
You can center the text
And with:
.lineSpacing(CGFloat)
You can set your padding
Hi guys! I tested this with Xcode 11.1, and it looks like .lineLimit(nil)
once again works properly for the about page.
In addition, as @michielvg74 states, you’ll probably find it useful to center your text alignment so the second line in the text field looks nice.
I’ve added some author notes about this on the here for future reference: https://www.raywenderlich.com/4919757-your-first-ios-and-swiftui-app/lessons/45
In Xcode 11.2.1, the bug seems to be fixed without entering any extra code. But the alignment did change and makes it little bit strange.
I found Concatenating the first two Text into one long Text with ‘\n\n’ in between makes it looks better. There must be better way to deal with the alignment though.
Just as a note if someone gets stuck in study, in 11.2.1 .lineLimit(nil) or (Int.max) not working for me. But is seems like it works for some.
@lywang Do you still have issues with this?
@paulijr Does this work for you now?
Hello
I went back to that chapter, and it works fine now (Xcode version 11.3)
As of now, with XCode Version 11.2.1 the .lineLimit(nil) is not working for me. Also none of the other mentioned .lineLimit options worked either.
However, .multilineTextAlignment(.center) did the trick
@gyam28 Thank you for sharing this - much appreciated!
I’m using 11.7 and it works fine without any modifiers. It wraps on my screen.
Can we use Color Literals instead of going to google and searching for the hex code
Hi,
I’m using Xcode version 12.0.1 and there’s no need to add lineLimit(nil)
to wrap the text.
Any tips for changing the navigationBarTitle accent color, so when we see the “< Bullseye” link at the top of the about page we can change the color from blue to something else?
I tried this but it had no effect:
.navigationBarTitle(“Bullseye”).accentColor(.white)
Using Xcode 12.3 and I found by trial and error, that just adding the background image to the VStack, also gave the same result in the simulator (that is the removing of the white space that was not filled by the VStack’s text views). So at least in 12.3, there is no need for wrapping the VStack in a Group (and then applying the background (image) to that. Or, have I missed something ?
Also, confirming text lines are wrapping around ok as well (without need for line limits)
Please check out the updated version of the course when you get a chance:
https://www.raywenderlich.com/17493408-your-first-ios-and-swiftui-app-an-app-from-scratch
I hope it helps!