WWDC22 SALE: Save 50% on all my Swift books and bundles! >>

"Unable to simultaneously satisfy constraints." warning when adding a Navigation title.

Forums > 100 Days of SwiftUI

Hello !

I am currently in day 48, i was following this video that explained fetching data from an API. Later I added a navigation view and a title just so that it looks a little bit better.

this is the code :

 var body: some View {
    NavigationView {
       List(results, id: \.trackId) { item in
          VStack (alignment: .leading) {
             Text(item.trackName)
                .font(.headline)
             Text(item.collectionName)
          }
       }
        .navigationTitle("Taylor Swift Songs")

       .task {
          await loadData()
       }

    }
 }

Then this thing started appearing :

"[LayoutConstraints] Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. ( "<NSLayoutConstraint:0x600003f7c2d0 'BIB_Trailing_CB_Leading' H:[_UIModernBarButton:0x7fc8859139b0]-(6)-[_UIModernBarButton:0x7fc885a0de10'Taylor Swift Songs'] (active)>", .. "

and it goes on...

I noticed that i always have this warning whenever i add a navigation title. commenting the navigation title stops this warning. (Noticed the warning in previous projects but didn't know the exact reason for it.)

Tried Ipod touch & Iphone 11 simulators.

What is the reason for this warning / error in the log area and how to fix it ? And should i be worried in the first place?

   

Reard this message regarding On Log Noise

1      

I had the same problem when working on Project 5 on day 30. I fixed it by adding the following modifier on the Navigation view itself

.navigationViewStyle(.stack)

2      

Save 50% in my Black Friday sale.

SAVE 50% To celebrate WWDC22, all our books and bundles are half price, so you can take your Swift knowledge further without spending big! Get the Swift Power Pack to build your iOS career faster, get the Swift Platform Pack to builds apps for macOS, watchOS, and beyond, or get the Swift Plus Pack to learn advanced design patterns, testing skills, and more.

Save 50% on all our books and bundles!

Sponsor Hacking with Swift and reach the world's largest Swift community!

Reply to this topic…

You need to create an account or log in to reply.

All interactions here are governed by our code of conduct.

 
Unknown user

You are not logged in

Log in or create account
 

Link copied to your pasteboard.