-1

I have a RootContainer view in my SwiftUI app that takes in content as a view builder, adds it to a ScrollView then adds padding to the content. Some views need to go edge to edge and so I was going to use negative padding on these views to negate the padding applied by the RootContainer. Are there any known issues with using negative values for padding?

1
  • Your question is probably too general. Is negative padding legal? Yes. Can it have unexpected consequences? Maybe. You might want to avoid using negative padding if a "cleaner" solution is possible. But it can sometimes be useful for working around issues where you don't have more control, such as in this example. If you can provide an actual reproducible example of where you think it is needed then it might be possible to suggest alternative solutions. In particular, the usual way to extend into the safe areas is to apply .ignoresSafeArea.
    – Benzy Neez
    Commented 16 hours ago

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.