'Child view exceeds parent view borders in SwiftUI?

I have an issue with a parent view which hosts two children view inside it, one in the top half of the screen, the second on in the bottom half.

The preview of each child view stays within its own borders, but when I see the preview (and the emulator result) in the parent view both the child views exceed the borders of the parent view (as if they were .scaledToFill()).

I tried with .clipped() and to play a bit with .frame, but I still couldn't figure it out how to avoid exceeding the parent view borders.

Any suggestion? Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source