Is there any way to make the navigationTitle at the top to be a multiline one, or shrink when that is too long? Now, in my case, it shows "..." at the end because of not enough spaces to display. i have checked all other posts and none of the results are related to swiftui solution.
Asked
Active
Viewed 1,071 times
2
-
Can you show any code? Would it be sufficient if you just did `.navigationBarTitle(Text("An extremely long navbar title to showcase this"). .lineLimit(1).minimumScaleFactor(0.5))`? – Rickard Elimää Apr 01 '21 at 07:27
-
@RickardElimää your option does not work – Oleg991 May 14 '22 at 10:11
1 Answers
2
init() {
UILabel.appearance(whenContainedInInstancesOf: [UINavigationBar.self]).adjustsFontSizeToFitWidth = true
}
you can add this into your view struct
Reference to this SwiftUI Size to fit or word-wrap navigation title

Kevin Angga Wijaya
- 21
- 3