user6539552
user6539552

Reputation: 1451

navigationTitle too long in swiftui

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.

Upvotes: 3

Views: 2131

Answers (1)

Kevin Angga Wijaya
Kevin Angga Wijaya

Reputation: 41

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

Upvotes: 4

Related Questions