Questions tagged [vstack]

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

103 questions
2
votes
1 answer

VStack Lower Than Expected SwiftUI

Even though in preview VStack looks promising when I run the app on the simulator or on the phone it appears lower than expected. You can see there is a big gap at the leading of the view from comparing the two images. I have also added layer's…
Mert Köksal
  • 359
  • 1
  • 9
2
votes
1 answer

SwiftUI VStack with flexible Spacer

I have a simple VStack with a view on top and a multiline Text in the bottom. The text can update its content, so it resizes depending on how many lines it has. When that happens, the view on top adjusts its position as well - moving up or down. I…
hoshy
  • 351
  • 2
  • 11
2
votes
1 answer

Dynamically add elements to VStack in SwiftUI

(Swift 5, SwiftUI) If I have the following code for a VStack: struct ContentView: View { var body: some View { ScrollView { VStack(alignment: .leading) { //Inside of VStack }.padding() …
aryanm
  • 374
  • 3
  • 14
2
votes
1 answer

How to limit size of GeometryReader inside a VStack

I would like to stop GeometryReader from interfering with my layout in a VStack but I'm not sure what the correct approach is. Given the example of a simple graph with a title and caption: struct Graph: View { var body: some View { …
Craigt
  • 2,778
  • 4
  • 34
  • 46
2
votes
3 answers

SwiftUI - VStack make child Text span full width

I'm trying to build a view that has Text within a VStack. I'd like the VStack to fill the full width of the screen and I'd like the Text within it to do the same. As far as I can tell the code for that would be as follows: import SwiftUI struct…
Steve
  • 871
  • 1
  • 7
  • 17
2
votes
1 answer

SwiftUI: Distribute equally multiple VStacks in a VStack with Spacers

I am trying to build a VStack (container) containing multiple VStacks (element) with each a title and a text. The element VStacks should be distributed equally and have a spacer in between. For some reason it only works up to 4 element VStack and if…
FrankZp
  • 1,996
  • 3
  • 21
  • 36
2
votes
1 answer

Using swiftUI how can i add datePicker only while textField is in editing mode?

I have added datePicker for now inside HStack. I want to show datePicker only when textField is in editing mode. struct EditProfile: View { @Binding var profile: Profile var body: some View { List { HStack { …
PinkeshGjr
  • 7,088
  • 5
  • 35
  • 52
1
vote
1 answer

SwiftUI List in PageTabViewStyle()

I have a PageTabView with multiple Tabs. In each of these Tabs is a VStack with ForEach. This obviously gets "compressed" if there are too much elements. struct SwiftUIView: View { var body: some View { NavigationView { …
X Æ A-12
  • 19
  • 2
1
vote
1 answer

Remove spacing between HStacks embedded in Stack

I am trying to stack two HStacks filled with circles, however, no matter what I do, I cannot get rid of the spacing between the two. VStack { VStack(spacing: 0) { HStack { ForEach(viewModel.lights) {…
Thomas Braun
  • 677
  • 6
  • 19
1
vote
2 answers

How to convert vstack code to for-loop (Python)?

I currently have a list (list_arr) containing 8 numpy arrays with the following sizes: 0. (6300, 6675, 3) 1. (5560, 6675, 3) 2. (5560, 6675, 3) 3. (5560, 6675, 3) 4. (6300, 6675, 3) 5. (5560, 6675, 3) 6. (5560, 6675, 3) 7. (5560, 6675, 3) I want to…
Noah Vento
  • 23
  • 2
1
vote
1 answer

VStack .leading alignment

I can't get rid of this "leading" padding inside one of my VStacks. I set alignment to "leading" for its parent VStack but it still shows some spacing on the left (for the text and red rounded rectangle). They were supposed to be placed on the left…
eugene_prg
  • 468
  • 2
  • 11
1
vote
1 answer

Vstack chiled Hstack elements do not distribute equally

I have two Hstack inside Vstack but Elements of Hstack are not distributed equally due to text length. Due to Current task and Completed Task Text length my Hstack do not equally distribute. How can I achieved equally distribution? I have to use…
1
vote
1 answer

SwiftUI: Overlay is on the whole VStack instead of the textfield after wrapping TextFields with VStack

Here's the simplified code: var body: some View { Section(header: Text("Personal Data").position(x:45, y: 17)) { Form { VStack { TextField("Title", text: self.$title) .disabled(true) …
user12919782
1
vote
1 answer

UIView Top Point is Lower Then Expected

I have a format problem. How I want is the 2nd picture but for some reason, my view starts a little bit lower. You can see the gap between the pictures. I want to solve this problem without offset. Might be because of .navigationBarHidden(true)…
Mert Köksal
  • 359
  • 1
  • 9
1
vote
1 answer

SwiftUI Zstack – Make element ignore safe area and another one don't

I have a Zstack like this: ZStack { Image("beach") .resizable() .edgesIgnoringSafeArea(.all) .scaledToFill() VStack { // with a lot of stuff } } I want the image to ignore the safe area, but the Vstack must respect the safe…
Duck
  • 32,792
  • 46
  • 221
  • 426