Questions tagged [vstack]

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

193 questions
2
votes
2 answers

Pin text to bottom of scroll view SwiftUI

How can I pin a view element to the bottom of a scrollview/VStack in SwiftUI? I've tried using spacers but that doesn't seem to be working. I need the 'Footer' text to be at the bottom of the scroll view/Vstack, how can I do that? struct…
tHatpart
  • 1,302
  • 3
  • 12
  • 27
2
votes
1 answer

SwiftUI: Spacers won't scale down because BG Image will not adjust to device size

I use a ZStack to display a fullscreen background image underneath the main UI. The main UI consists of a VStack with multiple views separated by flexible Spacers to scale down or up on different device sizes. Now I experience that the Spacers will…
FrankZp
  • 2,022
  • 3
  • 28
  • 41
2
votes
1 answer

SwiftUI: Resize spacers in VStack on smaller devices in a certain way

I am trying to optimize a UI with VStacks and spacers in between. The UI is ideally designed for the iPhone 13 Pro screen size (left). For smaller devices, the intention is that the spacers will shrink in a certain way that the UI still looks…
FrankZp
  • 2,022
  • 3
  • 28
  • 41
2
votes
0 answers

save many .npz files in a single big .npz file

i have many(nearly 10000000) .npz files(for example: file1.npz,file2.npz.....file10000000.npz) in a directory. Each of the .npz files contain two variables a and b where a and b contain array data.Now i want to arrange and save all .npz files into a…
user14239324
2
votes
2 answers

SwitUI - Two navigationLink in a list

I have two NavigationLink in a cell of my List I want to go to destination1 when I tap once,and go to destination2 when I tap twice. So I added two tap gesture to control the navigation. But when I tap,there are two questions: 1 The tap gesture…
BinaryBang
  • 73
  • 7
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
  • 481
  • 6
  • 15
2
votes
2 answers

SwiftUI Error - Type () cannot confirm to view: only struct/enum/class types can conform to protocols

I've got some simple code that creates an array (newFactoid) by calling a function (createSampleData) which it then holds as a State. A view displays record 1 of the array. So far so good. However, I'm trying to insert a button into the view which…
Webbo
  • 51
  • 1
  • 4
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
  • 3,418
  • 6
  • 40
  • 56
2
votes
2 answers

My TextField in Swift UI is Unresponsive to taps and clicks, text cannot be input, is there an issue with the code?

Hi I'm an intermediate level engineer with swift and swift UI. Currently, I am having problems with the TextField(), it is unresponsive to taps and clicks, and hence the keyboard does not show up, However, it does show up when it is one of two main…
MilesB
  • 21
  • 2
2
votes
2 answers

full screen background image with vstack

i want to have a full screen background image with a navigationview (must be on top because it is from the basis view and not in "this" view normally). In this view i want a VStack which is just inside the secure area, so between navigationbar and…
Chris
  • 7,579
  • 3
  • 18
  • 38
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
  • 921
  • 1
  • 7
  • 18
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
  • 2,022
  • 3
  • 28
  • 41
1
vote
0 answers

How to ignore keyboard safe area only for the last view in a VStack?

The keyboard lifts the last view in a VStack. Adding .ignoresSafeArea(.keyboard) only to BannerAd doesn't work. (Why?) import SwiftUI import RealmSwift struct ContentView: View { @FocusState var focusedId: ObjectId? var body:…
BPDev
  • 397
  • 1
  • 9
1
vote
1 answer

SwiftUI VStack alignment guide with other views

I'm struggling to achieve the following custom alignment in a SwiftUI VStack: I've created a custom alignment guide to use in the Event view, as follows: extension HorizontalAlignment { struct EventLeading: AlignmentID { static func…
AndrewC
  • 401
  • 4
  • 19
1
vote
0 answers

SwiftUI View Not Updating After Inserting Elements Into Array

I have a SwiftUI View that I am presenting in a UIViewController container. When a user creates a post I want the feed to fetch that new post from the service and insert it at the beginning of the array. All of that is working (the service fetches…
tHatpart
  • 1,302
  • 3
  • 12
  • 27
1 2
3
12 13