relativeWidht(), relativeHeight() deprecation

The relativeWidth(:), relativeHeight(:), and relativeSize(width:height:) modifiers are deprecated. Use other modifiers like frame(minWidth:idealWidth:maxWidth:minHeight:idealHeight:maxHeight:alignment:) instead.


Can anybody help with some real example???


The frame parameters takes absolute values, how do I achive the same effect as with

relativeWidth(0.5) setting the half of width of parent using the frame method?


Thank you

Replies

You could wrap them in a geometry reader, then set the width to percentages of the reader’s values. I’d offer the requested example, but I’m on the road and typing with a phone.