1

I have a VStack nested inside of an HStack that I want to take up 35% of the safe area width. So far through beta 3 I've been able to do the by:

HStack {
    VStack {
        .
        .
        .
    }.relativeWidth(0.70)
}

But I now have a warning that:

'relativeWidth' is deprecated

That's it. Nothing about what to use as a replacement. In fact, the documentation hasn't yet marked it as deprecated.

Any ideas on what I can use as an alternative? GeometryReader? It seems that that is overkill. (I know, relativeWidth still works, but I prefer removing all warnings if possible.)

1 Answers1

1

Yes, it is deprecated. The release notes say:

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

Your only alternative seems to be GeometryReader :-(

kontiki
  • 37,663
  • 13
  • 111
  • 125
  • Yes, I do not understand why they put that there. But in beta 3, they did the same with many other notes. I don't get it. – kontiki Jul 18 '19 at 14:25