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

76 questions
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
  • 5,656
  • 5
  • 41
  • 66
1
vote
1 answer

SwiftUI HStack won't move to the very top?

I have an Hstack with two components. One is a drop-down menu, and the other is a nav link to "forgot password" page. I can't figure out why it won't go all the way to the top of the page. I've tried inserting Spacer() on the very bottom (but…
1
vote
1 answer

Linear Color Gradient to items in HStack?

Is there a way in SwiftUI to add a gradient color to all items in an HStack. You can apply an individual Color to both the HStack .background and .foregroundColor But because LinearGradient is a struct that conforms to View you can't pass it to…
fuzzygoat
  • 25,797
  • 45
  • 159
  • 288
1
vote
2 answers

SwiftUI ScrollView horizontal RTL not working correctly

I'm trying to support RTL mode on my ios , which was built using swiftUI every is fine while doing this to change the layour direction : .environment(\.layoutDirection, .rightToLeft) Only with horizontal ScrollView , it's not work correctly when…
Ouail Bellal
  • 866
  • 7
  • 20
1
vote
1 answer

how to create a fit HStack with equal space between it's object

I wanna create an HStack with levitating space between objects, but equal between each one and also it must fit on horizontal, Some of like that I used Spacer() between objects, like that HStack { Text("Object1") Spacer() …
mohsen
  • 2,711
  • 1
  • 19
  • 41
1
vote
0 answers

TextField Error: Reference to property '$...' in closure requires explicit 'self.' to make capture semantics explicit

I want to get text from a textfield. My var is Entfernung: @State var entfernung = "" And here is my HStack where the TextField is in: HStack{ Text(LocalizedStringKey("entfernung")).font(.title).bold().padding(.leading,…
1
vote
4 answers

Center Item Inside Horizontal Stack

If I have 3 items inside a Horizontal Stack, I thought I could do something like this: HStack{ Text("test") Spacer() item2() Spacer() Text("test") } to center item2() in between the two Text views. However, the…
Evan
  • 1,156
  • 1
  • 8
  • 21
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
  • 7,088
  • 5
  • 35
  • 52
0
votes
0 answers

Using Buttons to add shapes in SwiftUI

I am just starting out with SwiftUI so excuse me for some silly mistakes. I am trying to make something that will add a shape when the button is pressed and remove it when pressed again. It works well with just one button but starts to act weird…
0
votes
1 answer

SwiftUI Wrapping HStack with Images

I am trying to make a HStack which contains x number of images and will display them in a wrapping HStack manner (i.e if only 4 of the 7 images fit on the line, then spill the 3 remaining over onto the next line). I am trying to use the library…
0
votes
1 answer

SwiftUI Shape Scale Size Such that HStack size does not increase

I'm trying to make the circles fit into the HStack such that the HStack size does not increase. How can I make the circles fit without specifying a fixed frame? struct ContentView: View { var body: some View { NavigationView { …
Isaak
  • 405
  • 3
  • 15
0
votes
1 answer

how to make a VStack span all space?

I'm trying to eliminate the space that the top stack covers, but as much as I need the image to cover the space where the time is shown and the battery is not successful, does anyone have any idea how to do it? I leave a photo of what I want to…
0
votes
0 answers

SwiftUI | When I use LazyHStack with ScrollView the elements disappear

My app supports two languages :English and Arabic. and I have horizontal scroll view with quotes(Not List), So when the language is English everything works well, but when Arabic everything disappears. struct QuotesView: View { @ObservedObject var…
0
votes
1 answer

Numpy - Replacing hstack/vstack if-loop with something faster (append?)

I want to combine several (say 15) long arrays of shape (3072,) into one np.array of shape (15,3072). If have found a solution but that's including a nested if-clause in a for-loop, which seems to be inefficient for me. Is there a more efficient…
0
votes
1 answer

SwiftUI How do I record the index of the grid item that is currently being displayed on CollectionView?

I am trying to have a scrolling horizontal list of items, where each item takes up almost the full screen width (UIScreen.main.bounds.width - 50). There should be just enough of the next item visible for the user to know there is something to…
Crystal
  • 26
  • 6