"Pin it to the leading and trailing margins."

After I add the Stack View, I set the top and bottom edges to 8 points from the top and bottom of the safe area, but I set the left and right to 0 and keep Constrain to Margins checked.

However, the stack view reaches the left and right edges of my View Controller. And my labels are on its left edge as a result?

I returned to Chapter 7 to try to sort out the left and right margins, but to no avail.

Where’s the proper setting?

Have you gotten to the end of the chapter yet? If not, keep going - the spacing issues will eventually get worked out. I realize that Figure 11.3 doesn’t match what you see in XCode, but keep going anyway.

I did – didn’t seem to change the appearance.

Sorry. When I went back & looked at my final code for Chapter 11 there was an 8 point offset on the leading & trailing edge constraints on the vertical stack view, matching the 8 point offset on the top & bottom edge constraints. I thought the book must have told us to add those at some point, but I guess I did it on my own.

FWIW, the solutions code has a 20 point leading & trailing edge offset; I can only assume the authors meant to put that in the book & missed it.

The best way to accomplish what the book is wanting is described in Chapter 7 and in Chapter 17. Obviously you will not have reached Chapter 17 at this point, but since there is another discussion of it in that chapter, I figured it might help to point out.

(The solution for Chapter 11 is incorrect. Thanks @JonAult for catching that; we’ll get that fixed on our end and update the online solutions.)

Take a look at Figure 7.9 or Figure 17.8 as well as the paragraph immediately preceding each figure. That’ll describe the how best to constrain to the margins. You’ll need to change “Safe Area” to “Superview” and then select the “Relative to margin” option, but please refer to those paragraphs for a more thorough walk-through.

If you still have issues, or if I missed something, please let me know! And I’ll be happy to help.

Thanks for pointing that out.

XCode doesn’t make it easy to see the effect of those constraint options; every time you select one it updates the offset to keep the margin in the same place, so at first glance they don’t appear to do anything.

Thanks for your reply, Christian.

I still have issues, from an overall perspective: How to read Apple Developer Documentation

(you can disregard my top 2 points in direct reply to the previous post on this thread).

Overall, I still struggle with completing the challenges. Could you please provide further advice on approaching them?

Due to the fiddly nature of Xcode’s interface builder, I feel the book should have explicitly given all the steps to take here like it did in previous chapters. I’ve pieced together my understanding of what the values for these steps should actually be (see the screenshots below). Feel free to reply here if you think this is wrong.

Screen Shot 2021-05-20 at 2.30.25 AM

Screen Shot 2021-05-20 at 2.30.37 AM

Screen Shot 2021-05-20 at 2.31.01 AM

Screen Shot 2021-05-20 at 2.31.22 AM