Your Second iOS & SwiftUI App, Episode 12: Image Binding | raywenderlich.com

The reason the images you’re adding to your library are not showing up is Book Images currently only display symbols. Let’s fix that!


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/25836622-your-second-ios-swiftui-app/lessons/12

Hi Catie,

Not specific to this episode but I have a question. There appears to be a (known) Xcode bug dealing with TextFields in Preview mode so I ended up running on the simulator when I have to enter text – no big deal.

My question, though is console is now filled with conflicting constraints errors! Is this normal? One reason I am looking to move my apps from UIKit to SwiftUI is that I seemed to spend more time futzing with constraints/layout issue than writing code :slight_smile: So I was looking forward to no more constraint errors. I realize this doesn’t (hopefully) effect the running of the app, but it is disconcerting.

To be clear, it is not just this project, I’ve seen it on another project I working thru from another source.

1 Like

Hi! Totally reasonable question. At the moment, breaking constraint messages is just part of using SwiftUI. We aren’t working directly with constraints, that’s all in the UIKit underpinnings! So it’s more of a problem for Apple to address, and for us to find ways to hide the errors as we can.

One of those ways, if the constraints are navigation bar related, is to force the navigation view style to stack. So for this project, try adding this modifier to NavigationView in ContentView's body:

    NavigationView {
      ...
    }
    .navigationViewStyle(.stack)

Thanks! I knew it wasn’t a problem with you folks.

I started using Swift when it was first released and went thru lots of pain as it got tweaked (and improved). I held off on SwiftUI not wanting to go thru that again :slight_smile: So it looks like Apple still has some “improving” to do…