Questions tagged [swiftui-layout]

For questions about how to lay out Swift UI elements on screen as intended. When using this tag also include the more generic [swiftui] tag where possible.

12 questions
5
votes
1 answer

How could I use a SwiftUI LazyVGrid to create a staggered grid?

I'm trying to implement a view that contains a LazyVGrid of staggered images in a grid- as seen in the below Pinterest feed: I am aware of the WaterfallGird library but I was wondering if there would be a way to implement this functionality with a…
mstv2020
  • 63
  • 2
2
votes
0 answers

How to remove bottom default padding from List view in SwiftUI

I'm trying to remove the bottom padding on a List view when another view is being defined after it so that the List view is sitting on top of the other one. Not overlaying. There seems to be some extra space created from the List and I'm not sure…
Petesta
  • 1,089
  • 3
  • 12
  • 24
2
votes
3 answers

How to have 2x2 made of squares fit screen in SwiftUI

I'm trying to create a 2x2 grid through either VStacks/HStacks or LazyVGrid to have the squares on each row fit the screen. For example, the first and second squares each take up half the width of the screen and based on that length, that'll…
Petesta
  • 1,089
  • 3
  • 12
  • 24
2
votes
1 answer

SwiftUI grid with column that fits content?

Is this layout possible with SwiftUI? I want the first column to wrap the size of the labels, so in this case it will be just big enough to show "Bigger Label:". Then give the rest of the space to the second column. This layout is pretty simple…
Rob N
  • 11,371
  • 11
  • 72
  • 126
1
vote
2 answers

SwiftUI content gets cut off on smaller iPhone screens

I'm new to SwiftUI, so I'm following a tutorial to get familiar with it. However, my app's content is getting cut off on smaller screens (both vertically and horizontally). How can I prevent this from happening? Here's my code: EDIT: I have added…
1
vote
1 answer

SwiftUI place around center object

Say the blue rectangle is in the center of the red rectangle, and the green needed to be on top and the yellow on the left. How would one do this in SwiftUI with alignment guides? None of the sizes are known, but the yellow and blue height match,…
magnuskahr
  • 830
  • 7
  • 14
1
vote
1 answer

SwifUI LandScape NavigationTopBar won't hide

I wanted only one landscape View between all Views so I added code bellow to the AppDelegate func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask { return…
1
vote
1 answer

How do I change the fixed size of a Lazy Grid GridItem in response to Dynamic Text size changes?

The code below is using a LazyVGrid to implement layout of my controls such that everything lines up like this: Particularly, the sliders' ends all align and the symbols are centre-aligned to each other. I have worked out how to size the GridItems…
zkarj
  • 617
  • 9
  • 18
1
vote
1 answer

SwiftUI: Prevent view being inside VStack to expand

I have such VStack with list inside it VStack(alignment: .leading, spacing: 16) { Text("Contacts") .font(.custom("AvenirNext-DemiBold", size: 20)) …
Michał Ziobro
  • 7,390
  • 6
  • 50
  • 99
0
votes
1 answer

Is there support for something like TimePicker (Hours, Mins, Secs) in SwiftUI?

I'm trying to achieve something like iOS Timer App time picker control: I've investigated the DatePicker, but it doesnt have seconds view.
devfreak
  • 1,031
  • 2
  • 13
  • 25
0
votes
1 answer

SwiftUI: Why isn't my view being shown off-screen as its frame suggests it should?

I have an interface where I want to be able to toggle a Side Menu and also a toolbar. The Side Menu slides in/out from the right and the Toolbar from the bottom. I'm making it generic so it's reusable to whatever content one wants to use. The code…
horseshoe7
  • 2,629
  • 2
  • 29
  • 43
-1
votes
1 answer

Curves and Paths in SwiftUI

I am trying to create a curved path wrapped in a shape in order to attach to a tab bar but I’m having trouble get the desired look. Here’s the look I am going for. Any ideas on how to create this shape?
Liam
  • 41
  • 3