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
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

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
3 answers

How to image setup in hstack under Swiftui

I followed the @swiftPunk answer it's working fine. But at the last point I stuck on my first image is not showing properly. Please check attached screenshot. Updated Code:- struct ImageStackRoundUpr: View { var friendRiders = ["DTR-CentrImg.jpeg",…
Sham Dhiman
  • 544
  • 6
  • 26
1
vote
1 answer

SwiftUI How to align child views inside HStack

I have a similar problem to this question (no answer yet): SwiftUI HStack with GeometryReader and paddings In difference my goal is to align two views inside an HStack and where the left view gets 1/3 of the available width and the right view gets…
Ali
  • 475
  • 1
  • 4
  • 16
1
vote
1 answer

Show color on full screen in SwiftUI

I'm trying to show red color in full screen. If I use edgesIgnoringSafeArea(.all) the screen automatically becomes scrolling enabled, which I don't want. Can you please advise me how to show red color on full screen without scrolling and without…
Sham Dhiman
  • 544
  • 6
  • 26
1
vote
2 answers

Result of 'HStack' initializer is unused / HStack Not Appearing in View

I'm trying to get an HStack of stars for rating (1-5) to appear in a view that I've created, but I'm getting this warning Result of 'HStack' initializer is unused and the stars aren't appearing on the view. AddMeal View Code: import…
ERACED
  • 9
  • 4
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

How to alternate centerX auto layout constraint in SwiftUI

I want to adjust my view like this to make an element align horizontally center of its parent and lead another view to that. I implement this view with auto layout simply like this. consumeLabel.centerXAnchor.constraint(equalTo:…
1
vote
1 answer

array numpy regression linear

I have an numpy array that has 3 rows and 3 columns .Like this: 100 200 300 233 699 999 566 655 895 and I want to create a numpy array like this for my linear regression: 100 200 300 1 233 699 999 1 566 655 895 1 This my…
1
vote
1 answer

Drag & drop to reorder for Text without using List/Form

I have used the .gesture for dragging the piece of text. What I want to happen is the remaining letters to move to the right such that 'g' takes the first position and the remaining letters move towards the right. But I am unable to figure out how…
ItsZiaW
  • 110
  • 10
1
vote
1 answer

SwiftUI Pan gesture

I'm new to SwiftUI. I'm showing a series of items in an HStack. They don't need to move, but I'd like to highlight them as the user drags their finger over them, and change a separate view somewhere else to give more information about the…
CompC
  • 321
  • 2
  • 16
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
  • 2,718
  • 1
  • 27
  • 68
1
vote
1 answer

In SwiftUI Picker expands to occupy entire space inside a HStack

I have a Text and Picker in HStack separated by Spacer. What I want is that the Spacer should should occupy maximum space between picker and text so that the Text and Picker are not the extreme ends of the HStack but, the picker expands to occupy…
Rakesh.P
  • 173
  • 1
  • 2
  • 10
1
vote
1 answer

how to make subview shadow bleeding out from parent view in SwiftUI?

As the title explained, I need make the shadow of subview bleeding out from parent bounds. We can see the shadow is clipped by the container (parent view). How to ignore it? ScrollView(axis, showsIndicators: false) { HStack{ …
iaomw
  • 315
  • 3
  • 13
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
  • 403
  • 9
  • 26