Leading alignment in HFlow with only one item #27
-
|
First, thanks for making this library! I appreciate the effort. I'm trying to create an HFlow that is leading aligned, but I'm having trouble getting that result I want. It seems to default to center aligning the cells when there's only one row. However, when the HFlow has multiple lines the HFlow properly renders the cells as leading aligned. Does anyone have any guidance here? Screen shots and code below. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Hi @asalinasfetch, thanks for opening the discussion! I think the best way to align dynamically sized views in SwiftUI is to use the frame modifier. This will make sure to left-align the content if it's shorter than the container view. HFlow {
ForEach(...)
}
.frame(maxWidth: .infinity, alignment: .leading)There was a similar question in #5, hope this helps. |
Beta Was this translation helpful? Give feedback.


Hi @asalinasfetch, thanks for opening the discussion! I think the best way to align dynamically sized views in SwiftUI is to use the frame modifier. This will make sure to left-align the content if it's shorter than the container view.
There was a similar question in #5, hope this helps.