|
My canvas preview doesn't show space around the rows when Form is added. The rows extend all the way to the left and right edges of the screen. What's up? |
|
Mace asks:
Help us to help you! Without seeing any code, you want us to guess? Ok, not very helpful, but I'm guessing you have view modifiers out of order. The order matters. Here's an example. Paste this into Playgrounds:
Show us real code if you'd like real help. Also, no need to paste ALL your code, just the parts giving you trouble. |
|
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th. Sponsor Hacking with Swift and reach the world's largest Swift community! |
|
Sorry, I was referring to the code that Paul wrote. His canvas looks different from mine. When I copy and paste this code from the "Creating a form" lecture into XCode: I don't get the grey border around the textbox that Paul shows in the video. |
|
You're missing the .padding() under Text("Hello, world!")
|
|
Thanks, @vtabmow, but that's not it. Paul removes the padding and the border is still there. Here's his screen: Adding the padding on my machine changes the placement, but does not add the grey border. |
|
Copy these four elements to a ContentView(). Build the code, and look at the screen in
Your preview is linked to your code. Next, add a modifier to one of the elements. For example, add Now, to answer your question above, in your code listing, click on the Next add |
|
What do I see? When I have the .frame() enabled, the rows of the form pull in and I see a grey border around my rows. Now they look like Paul's did in the video. But I'm back to the original intent of my question. Why does Paul's video have a grey area around his rows without requiring him to add a .frame() to the Form, but I was required to use a .frame() to achieve the same visual effect? |
|
|
|
That looks like it. I was indeed on an iPod Touch (7th g) -- I'm not sure why or how. Interestingly -- when I select Form in the editor, the boundary of the Form extends to the edge of the display. The grey border is contained within the frame. |
|
iPod Touch (7th Gen) appears to be the default selected simulator when you create a new project. |
SPONSORED Join a FREE crash course for mid/senior iOS devs who want to achieve an expert level of technical and practical skills – it’s the fast track to being a complete senior developer! Hurry up because it'll be available only until April 28th.
Sponsor Hacking with Swift and reach the world's largest Swift community!
This topic has been closed due to inactivity, so you can't reply. Please create a new topic if you need to.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.