Questions tagged [vstack]

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

193 questions
0
votes
1 answer

How to vertically stack the results of a for loop to a 2D array?

I've trained the CNN model to classify the images of 35 persons. To test the trained CNN model, I have used 70 images (2 from each person). The following for loop was written to predict the probabilities of the 70 images. I need the predicted…
0
votes
0 answers

SwiftUI - How to achieve the equivalent of a switch/case within a VStack

I have a set of 6 dials, but want to update them differently. They are generated in sequence from a loop that starts with: ForEach(stats_Data){stat in VStack(spacing: 14){ HStack{ …
Edward Hasted
  • 3,201
  • 8
  • 30
  • 48
0
votes
1 answer

SwiftUI - Updating values in a VStack

Xcode 14.1, Ventura 13.1 I have a VStack with a load of graphical dials that I want to update. For testing they are prepopulated with data from an array as follows: struct Stats : Identifiable { var id : Int var title : String var…
Edward Hasted
  • 3,201
  • 8
  • 30
  • 48
0
votes
1 answer

ValueError using vstack: all the input array dimensions for the concatenation axis must match exactly

I have a matrix epoch in which epoch[i][0] is a m x 5 array, where m varies for each i. For example, epoch[0][0] = [[-5.50571416e-21, -5.92923063e-21, 4.23516474e-21, -2.54109884e-21, -5.08219768e-21], [-3.03901510e-06,…
S C
  • 284
  • 2
  • 9
0
votes
2 answers

applying fixedSize only if there is enough space

I want to build a VStack that is only as wide as the widest element is. If there is (horizontally) not enough space, e.g., the screen is too narrow, the content should shrink. Here is a simple example: VStack { HStack { …
0
votes
0 answers

SwiftUI - CardView with image Overlapping bottom banner

I'm trying to create a card view with cornerRadius of 10 using SwiftUI and the Image should overlay the bottom banner in blue. I'm sending the image of what I'm trying to achieve. I'm new to SwiftUI and tried many options, but it doesn't seem to get…
Tech UK
  • 37
  • 6
0
votes
1 answer

Scale View to Fit Superview (SwiftUI)

I have a CustomView and it's frame needs to be 2000w x 2000h. I want to put this view in a VStack along with other Views. The problem is that, obviously, my CustomView is 2000x2000 which of course does not correctly fit on iPhones. I want this view…
Jacob Cavin
  • 2,169
  • 3
  • 19
  • 47
0
votes
1 answer

Overlay views do not maintain itself within the Stack - SwiftUI

I am playing around with fading animation of Text like this struct ContentView: View { @State var lorem = "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever…
Steven-Carrot
  • 2,368
  • 2
  • 12
  • 37
0
votes
1 answer

Align multiple dynamic HStack in VStack inside navigation View

Need to align this : import SwiftUI struct MainAct: View { private let images = ["ImageSlide/first","ImageSlide/second","ImageSlide/third","ImageSlide/fourth","ImageSlide/five","ImageSlide/six","ImageSlide/seven"] @StateObject var imageList =…
0
votes
1 answer

Stack 1D numpy arrays by a for loop

I am reading 1D arrays from the .txt files in a folder and I want to put all of them in a 2D array. (each 1D array should be a row in the new 2D array). Each 1D array in this case has 30 elements. Before this, I was reading the txt files one by one…
Nasrin
  • 13
  • 5
0
votes
1 answer

SwiftUI - making view within VStack fill available space in ScrollView

I have a view where the basic structure is as follows (this is just a bare representation of my actual view obviously): var body: some View { NavigationView { VStack { // Logo and postcode search …
DevB1
  • 1,235
  • 3
  • 17
  • 43
0
votes
2 answers

SwiftUI Handle different frame alignments in Stack

I have several views in a VStack/ScrollView using SwiftUI, The text elements I want to be leading (not centered in the view) but the Image I want centered on the Y axis. I've tried using center alignment in the frame but not the image still aligned…
tHatpart
  • 1,302
  • 3
  • 12
  • 27
0
votes
1 answer

Why isn't text box expanding to fit text

I have a VStack that contains multiple lines of text, but for some reason the second line of text won't expand to fit the frame My code is shown below - it's actually pretty simple. VStack(alignment: .leading) { …
0
votes
2 answers

How to make a clear SwiftUI view block the scrollview underneath it

So I have a ZStack that contains a ScrollView on the bottom and an HStack that's aligned at the top. It looks something like this: ZStack { ScrollView { //Content } VStack { HStack { Spacer() Circle() .frame(width:…
nickcoding2
  • 142
  • 1
  • 8
  • 34
0
votes
1 answer

LazyVGrid inside a VStack inside a ScrollView among other elements causes a crash

Here's my view's code: ScrollView { VStack { someView LazyVGrid( columns: [ GridItem( .adaptive(minimum: metrics.size.width / 2), spacing: 0 ) …
Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223