Questions tagged [hstack]

A Swift UI view that arranges its children in a vertical line.

This document contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

HStack - SwiftUI | Apple Developer Documentation

153 questions
2
votes
1 answer

SwiftUI layers in HStack

When I drag the rectangle to the left, the symbol is under the rectangle but on the right the symbol is over the rectangle, when I drag it to the right. I know, that the hierarchy of the HStack decides the layer but if I would do the right symbol…
beab
  • 23
  • 6
2
votes
1 answer

how to make subview shadow bleeding out from parent view in SwiftUI?

As the title explained, I need make the shadow of subview bleeding out from parent bounds. We can see the shadow is clipped by the container (parent view). How to ignore it? ScrollView(axis, showsIndicators: false) { HStack{ …
iaomw
  • 720
  • 6
  • 21
2
votes
2 answers

SwiftUI horizontal alignment from center to the right

I am trying to align a dynamic collection (ie of varying count) of views to the right of a centered view, without moving the center view from its original, center position. For example, the center view is Text("12") and the views to the right are…
andrewz
  • 4,729
  • 5
  • 49
  • 67
2
votes
1 answer

Have 0th item in SwiftUI auto selected

I have data loaded into an HStack that is in a Scroll View in SwiftUI. Right now I have it coded where a user can tap on one of those items and have it selected. I'd like for the 0th item to already be selected upon load. import SwiftUI import…
Luke Irvin
  • 1,179
  • 1
  • 20
  • 39
2
votes
0 answers

List cell load animation one after another in SwiftUI

I need to animate the load of the List rows. When the list reloads the data I need the rows get in from the left one after another. How can I achieve this?
Ravindra_Bhati
  • 1,071
  • 13
  • 28
1
vote
1 answer

Get perfect alignment and content measurements of HStack and VStack

I'm trying to insert 3 rectangles inside my scrollView precisely 2 horizontally and 1 vertically. I need all three rectangles to respect the same width. Horizontally everything works fine and adapts to all devices instead of the single rectangle…
kAiN
  • 2,559
  • 1
  • 26
  • 54
1
vote
0 answers

Re-ordering items in a HStack

Is it possible to re-order buttons inside a Hstack? i want to be able to click and drag any of the buttons from right to left, vice versa but not sure how to do it. This is for a macOS app. struct ContentView: View { var body: some View { …
swiftnoob
  • 303
  • 1
  • 5
  • 21
1
vote
1 answer

Trouble With Constraints for a Navigation Link

Here is my code: import SwiftUI struct ContentView: View { var link: some View { NavigationLink(destination: OtherView()) { Text("NLTitle") } .foregroundColor(.blue) } var body: some…
1
vote
1 answer

Aligning toggles in a SwiftUI View

I have this code that contains the labels and toggles shown in the screenshot below VStack(alignment: .leading) { HStack() { Text("Autostart:") .font(.custom("SFProText-Medium", size: 12)) …
narner
  • 2,908
  • 3
  • 26
  • 63
1
vote
2 answers

How to scroll through items in scroll view using keyboard arrows in SwiftUI?

I've built a view that has scroll view of horizontal type with HStack for macOS app. Is there a way to circle those items using keyboard arrows? (I see that ListView has a default behavior but for other custom view types there are none) click here…
user4150758
  • 384
  • 4
  • 17
1
vote
2 answers

Make two buttons equal height and width in HStack

I have one VStack and another HStack with buttons inside. I faced problem with shrinking buttons based on their content even though I tried to set fixed width and height of Buttons. Here is the main screen: import Foundation import SwiftUI import…
1
vote
1 answer

SwiftUI Centering Image between Views

I have an HStack that I am using as a tool bar. The HStack contains a button on the left, image in the middle, and then another HStack containing 2 buttons. Everything looks fine except for the image in the middle, it's slightly to the left. How can…
Noah Iarrobino
  • 1,435
  • 1
  • 10
  • 31
1
vote
0 answers

SwiftUI - grid with irregular rows

I'm trying to create the following grid format in SwiftUI: For context, this is a row in a basket. I'm trying to use a LazyVGrid and so far have the following column layout defined: let columns = [ GridItem(.flexible()), …
DevB1
  • 1,235
  • 3
  • 17
  • 43
1
vote
0 answers

HStack expand to entire Width & Equal Spacing

I'm trying a lot of different ways, using padding(), spacer(), frame() modifiers but can't get what I want. Essentially, I would like for the Stack to have a uniform Look w/ the same font sizes across all labels/values. As can see from the pic, the…
app4g
  • 670
  • 4
  • 24
1
vote
2 answers

Align Top In SwiftUI HStack

I am trying to align an image in the top of an HStack, but when the text is multiple lines the image gets centered. How can I align the second image with the top of the text? var infoView: some View { VStack(alignment: .leading, spacing: 16) { …
tHatpart
  • 1,302
  • 3
  • 12
  • 27
1 2
3
10 11