I'm looking for the equivalent of a html inline-block in swiftui. I basically want it to work exactly like list - but just wrap if it's going to exceed the line - eg
WrappingList( items ) {
Text( "item.name")
}
but I'm finding it way harder than I thought. I really want the things list brings to the table - ie incremental updates and scrolling, but I can't find a way of mapping it into the swift declarative style. In languages where you added controls procedurally, it's trivial:
current_x = 0
current_y = 0
foreach (var item in items )
{
control = create_control_for( item )
biggest_y = max( current_y + control.height, biggest_y)
if (control.width + current_x > width)
{
current_x=0;
current_y = biggest_y;
}
control.position = (current_x, current_y)
}
but swift seems to want to do things in hstacks or vstacks and I don't really know how do that and still keep the properties of a list - particularly without knowing the size of things in advance - ie I don't want a fixed grid.
Does such functionality already exist? If not, is there a way of mapping the above code line into SwiftUI?