A Swift UI view that arranges its children in a vertical line.
Questions tagged [vstack]
193 questions
1
vote
2 answers
Make Text inside VStack take the whole width of the VStack
I'm trying to make two Text that are inside a VStack to take the whole width of the parent (the VStack).
I'm completely out of ideas.
This is what I have:
var body: some View {
VStack(alignment: .center, spacing: 0) {
…

Andres
- 11,439
- 12
- 48
- 87
1
vote
1 answer
Double List in NavigationView [Swift]
I'm trying to fit two categories of an item on two different list, named 'Wide-Field' and 'Deep-Sky', however I want the second list to be below the first.
I was expecting it to look something like this:
However, instead it splits the screen in…

Alex Hammond
- 35
- 6
1
vote
1 answer
SwiftUI: positioning a Button below a List
One of my views has a grouped List, and I like to place a button below the final row. Here's the code:
var body: some View {
VStack() {
List {
Text("Hello World")
Text("Hello World")
Text("Hello World")
…

koen
- 5,383
- 7
- 50
- 89
1
vote
3 answers
View centered in superview with view on top of it in SwiftUI
I'm trying to achieve something that is quite easy in UIKit - one view that is always in in the center (image) and the second view (text) is on top of it with some spacing between two views. I tried many different approaches (mainly using…

mikro098
- 2,173
- 2
- 32
- 48
1
vote
1 answer
SwiftUI - Xcode - Inferring type not possible for VStack
I am trying to create a simple master/detail app in Xcode.
I want that the detail view is
struct EditingView: View
{
var body: some View {
var mainVertical: VStack = VStack() //error here
{
var previewArea:…

P5music
- 3,197
- 2
- 32
- 81
1
vote
1 answer
An apropriate way to create a Table in SwiftUI
From what I understand there is no dedicated table view class for use in SwiftUI. What is the best way to create such a table yourself?
In fact, I am looking for something a bit different for a weekly schedule view. I am trying to build a view such…

RT.
- 423
- 3
- 12
1
vote
2 answers
SwiftUI Grid Layout
I'm trying to achieve the following grid layout with SwiftUI but not quite sure on the best approach.
My code is below and it's not quite getting what I want and also seems hacky to have many nested stacks
VStack {
VStack…

CIB
- 535
- 1
- 12
- 35
1
vote
1 answer
Stopping Navigation Controller? from Appearing When Scrolling to the Bottom
I have four horizontal stacks (HStack) inside ScrollView and VStack. And I have a pair of ZStack things inside each horizontal stack (HStack). The following is my code.
import SwiftUI
struct ContentView: View {
var body: some View {
…

El Tomato
- 6,479
- 6
- 46
- 75
1
vote
1 answer
SwiftUI ForEach vertical divider layout strange
I'm beginner in SwiftUI and faced strange behaviour of ForEach layout when adding some VStack with divider inside.
Here is example:
struct TestUserView: View {
@State var users: [String] = ["John Doe",
"Jane…

sergiy batsevych
- 365
- 3
- 9
1
vote
2 answers
Rolling windows for ndarrays
I have a ndimensional array with shape (30,2,2) and 2000 elements. So my final array is of shape (2000, 30, 2, 2). I now want to stack rolling 200 elements in a new array. So I assume my final array will look something like (1801, 200, 30, 2, 2)…

SecretAgent
- 97
- 10
1
vote
1 answer
SWIFTUI How to capture VStack height with geometry (after the VStack was displayed)?
I'd like to ask you some help. I'm trying to capture VStack height using geometry and then based on that VStack height value, calculate its child element's height (inside VStack).
Image of my current view of VStack
I used .frame outside of VStack to…

Linas
- 65
- 1
- 7
1
vote
2 answers
How to make VStack fill the width of screen in SwiftUI
I'm trying to make VStack Sample app which visualize VStack Properties
but my VStack couldn't fill the width of screen
I tried many solutions on internet (frame modifier, HStack with Spacer, GeometryReader) but they were not work
This is my…

PrepareFor
- 2,448
- 6
- 22
- 36
1
vote
1 answer
SwiftUI HStack slider does not appear
I want to make a horizontal stack of images.
Unfortunately I am not able to slide to see full images.
struct ContentView: View {
var body: some View {
NavigationView {
List {
ScrollView {
…

Marcin Frankowski
- 35
- 5
1
vote
0 answers
Migrate UITableView's and UICollectionView's Xib in SwiftUI
I have converted my existing Xib UI in SwiftUI.
Is it possible to use SwiftUI in existing UITableView and UICollectionView?
Here is the code i have done in SwiftUI
struct LandmarkList: View {
@EnvironmentObject var userData: UserData
var…

PinkeshGjr
- 8,460
- 5
- 41
- 56
0
votes
1 answer
VStack inside ScrollView swiftUI
I have view, where inside ScrollView stackView, with content what expand after tap on button, and then I should scroll this page. in the bottom I have HStack with buttons, up there "RatingViews".
I need to make the buttons from the last HStack…

imjohnnotsina
- 1
- 1