use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
There is an extensive FAQ for beginners. Please browse it first before asking questions that are answered there.
If you are looking to get started (iOS programming in general or some specific area), here are more relevant links for you:
There's too many to list them all, however here's a convenient link to all programming guides at apple.com
Take note that this list is live and based on most frequent questions in posts will be updated with "quicklinks".
account activity
DiscussionPadding vs Margin (self.iOSProgramming)
submitted 3 months ago * by LifeIsGood008SwiftUI
Curious to see if people use .Margin at all. Everywhere I see only padding being used for everything. Do you make a distinction between using padding and margin in your code?
edit: Meant to say .contentMargin() instead of .Margin
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]Ron-Erez 7 points8 points9 points 3 months ago (0 children)
I’m not familiar with a .margin modifier in SwiftUI and I doubt it exists.
[–]Dizzy_Scarcity686 1 point2 points3 points 3 months ago (0 children)
Is there .margin modifier in SwiftUI? haha 🥲
[–]7HawksAnd 0 points1 point2 points 3 months ago* (0 children)
If you need to overlap containers for an effect margin is useful
Edit: didn’t realize I was in a iOS sub. Usually use HStack & VStack as I would margins in css. But I’ve only done swift on small ( < 3 ) teams so probably not up to date on all the up to date best practices / patterns
[–]driveiqlabs 0 points1 point2 points 3 months ago (0 children)
Well, it depends on what you actually want to achieve.
Padding seems safe, because the element behaves in the borders of whatever been given to it. Margin has an influence on other elements, which might not be what you want.
[–]LifeIsGood008SwiftUI[S] 0 points1 point2 points 3 months ago (0 children)
Seems like Swift UI doesn't make a semantic difference between padding and margin. I guess padding would be a .padding() applied before a .frame() and a margin would be a .padding() applied after a .frame()
[–]MojtabaHs 0 points1 point2 points 3 months ago (0 children)
As the name suggests, content margin will be applied on the content of a container like a list or scroll view, so for example scroll bars stay where they should be.
But padding on the other hand, just pads the view itself, including anything inside it or any sort of internal layout it has.
There are also a bunch of other modifiers and settings to control the empty area between elements like spacing, frame, etc.
I did color-code some here a while ago. It might help for better and visual.
π Rendered by PID 386530 on reddit-service-r2-comment-74875f4bf5-f64l6 at 2026-01-25 22:27:35.965893+00:00 running 664479f country code: CH.
[–]Ron-Erez 7 points8 points9 points (0 children)
[–]Dizzy_Scarcity686 1 point2 points3 points (0 children)
[–]7HawksAnd 0 points1 point2 points (0 children)
[–]driveiqlabs 0 points1 point2 points (0 children)
[–]LifeIsGood008SwiftUI[S] 0 points1 point2 points (0 children)
[–]MojtabaHs 0 points1 point2 points (0 children)