Skip to main content
Filter by
Sorted by
Tagged with
0 votes
2 answers
95 views

I’m trying to build an image carousel similar to the one in the App Store, but I'm a facing a lay-out issue. The carousel should: Automatically adjust its height based on its content Automatically ...
Hozen's user avatar
  • 89
1 vote
1 answer
78 views

I'm building an iOS Widget (WidgetKit) with a 2×2 button grid using GeometryReader to calculate row heights. The buttons should fill their containers completely and have equal heights, like Apple's ...
LevelOne2k's user avatar
1 vote
2 answers
124 views

I'm newish to SwiftUI and trying to understand how I can keep one view horizontally centered on the device screen, while anchoring an additional view to its trailing edge (without uncentering the ...
Kpmurphy91's user avatar
0 votes
1 answer
91 views

I have the following example view with no zIndex modifications. Currently, when selecting a grid item, it will animate to the center of the screen. However, this does not change zIndex and items will ...
Flynn 's user avatar
  • 213
0 votes
0 answers
52 views

I'm working with SwiftUI and I have a rectangle inside a ZStack that I want to rotate. However, the rotation is happening around the center of the entire ZStack, not the center of the rectangle itself....
user29193503's user avatar
1 vote
2 answers
524 views

Simplest Way to Set Specific Width Ratios for Child Elements in an HStack in SwiftUI Hello, I am working with SwiftUI and wondering if there's a straightforward method to set the widths of child ...
Kngw Kngw's user avatar
  • 123
0 votes
1 answer
335 views

I'm curious, has anyone run into this before? I have a situation where long Text that is inside a width-limited view is being unnecessarily truncated so that it fits vertically within the parent. Is ...
Curious Jorge's user avatar
0 votes
1 answer
225 views

I have a UIView wrapped around a SwiftUI View. I later change the UIView size but somehow it always get back to the original size. I have SwiftUI View wrapping around an UIView like this. This is one ...
DevNoob's user avatar
0 votes
1 answer
118 views

I am trying to recreate Whatsapp's message reply functionality in SwiftUI. Basically I have a view that represents a message and the max width of the message is 300. So when a message has an older ...
Nate's user avatar
  • 41
0 votes
1 answer
87 views

I've defined a custom layout container by having a struct conform to Layout and implementing the appropriate methods, and it works as expected. The problem comes when trying to display Image, as they ...
Thecafremo's user avatar
8 votes
0 answers
178 views

This is a bug I have been trying to identify and fix for more than 3 weeks. This bug mostly happens in production. The stack trace doesn't help that much, because it looks like the app is crashing due ...
Perjan Duro's user avatar
0 votes
1 answer
532 views

I'm writing custom SwiftUI layout and calculate container height based on child sizes. To get height of a subview I use .sizeThatFits(.unspecified) in next method: public func sizeThatFits( ...
Igor Ševtšenko's user avatar
0 votes
0 answers
553 views

I am using SwiftUI Charts framework at this moment to display the last 30 days of data. As you see in code, the x axis each line is new day. The chart and animation is working fine. But the ...
Ivars's user avatar
  • 113
1 vote
2 answers
540 views

I would like to add vertical scrolling to my custom layout. I don't know how to do it. I have added my code below for reference. Thanks in Advance. struct TokenData { let email: String } let ...
Vandijk's user avatar
  • 25
0 votes
1 answer
2k views

I have been brainstorming ideas for implementing a button dropdown view similar to what you see in a default Picker. I have been experimenting with this in general to find a way to overlay a view on ...
Matt Braniff's user avatar
1 vote
1 answer
818 views

Ultimately, I am trying to replicate the layout used in Apple's Tips app: The app appears to have a NavigationStack that contains non-list items but that fit the overall list style. When I try to ...
cchana's user avatar
  • 5,012
2 votes
3 answers
2k views

EDIT: The dash size of 10 in the code sample is arbitrary. The dash size is whatever looks good. Let's say in SwiftUI, you want to have a custom list item that has a dotted outline -- to serve as a &...
Nerdy Bunz's user avatar
  • 7,743
2 votes
1 answer
575 views

I am trying to implement a FlowLayout similar to what you would have in a UICollectionView. I followed the guide from objc.io but modified it slightly to support custom spacing. Even prior to my ...
Xaxxus's user avatar
  • 2,029
1 vote
1 answer
238 views

HStack and Vstack usually base their layout on the maximum size of the subviews. Here is an example: HStack { Color.orange .frame(idealWidth: 200, maxWidth: .infinity) Color.purple ...
Benzy Neez's user avatar
  • 29.6k
0 votes
1 answer
146 views

I'm working on a layout for a push-up counter app. That is my code and the result so far: struct ContentView: View { let sets = [1,3,6,8,12,16,23,43,56,76,100,101,125] var body: some View { ...
Gene Bogdanovich's user avatar
1 vote
0 answers
270 views

I want to create a custom Shape and give it the same height as its stroke width. struct HorizontalLine: Shape { func path(in rect: CGRect) -> Path { let verticalCenter = rect....
Mischa's user avatar
  • 17.5k
1 vote
2 answers
2k views

I want to use alignmentGuide to align center a Text view in ZStack to implement view as bellow, blue block is align traling, Text "abc" and "123" is align center of view. My code ...
mars's user avatar
  • 497
0 votes
1 answer
362 views

I'm curious, does anyone understand what .position(x:y:) is doing to the layout process for a containing ZStack? I've looked at Apple's documentation on "Making fine adjustments to a view’s ...
Curious Jorge's user avatar
1 vote
1 answer
324 views

Why does adding a frame() to an image add padding in between the image and it's sibling? E.g. why is there padding underneath the A, but not the B, in this example? Thank you! struct ContentView: ...
John Cashew's user avatar
  • 1,154
1 vote
1 answer
115 views

My code is as bellow: struct Clock10View: View { let light: Bool var body: some View { ZStack() { Rectangle() .frame(width: 6, height: 6) ....
mars's user avatar
  • 497
1 vote
0 answers
519 views

I'm currently working on an app for watchOS, but this problem is the same on iOS. When I use ignoring the bottom edge of the safe area for a view that is slightly larger than the safe area, the layout ...
Nikaaner's user avatar
  • 1,350
0 votes
1 answer
125 views

I am trying to create a UI component where we have a horizontal cell containing a title / subtitle on the leading side. Then at the trailing end of the component, there's an optional text (actionText),...
Shawn Morrison's user avatar
0 votes
0 answers
81 views

When I run this code, the list is visible behind the tab bar created by the TabView. If I comment out the Image, everything is ok. How do I make sure the list is not visible behind the tab bar? struct ...
Zonker.in.Geneva's user avatar
1 vote
0 answers
105 views

I have a swiftui app. I want to remove the space that is automatically created on the top of the list, but without using the .listStyle(PlainListStyle()). var body: some View { VStack{ ...
dhaval123's user avatar
1 vote
1 answer
5k views

I have a VStack with multiple child views (the one with blue background). The VStack has horizontal padding. I want to have this padding set for each child, but sometimes I have exception where I want ...
PigeonPO's user avatar
  • 108
2 votes
1 answer
2k views

Let's consider a list of 100 posts. According to Apple, if I layout them inside a LazyVStack: the stack view doesn’t create items until it needs to render them onscreen. What if I embed that ...
Sotiris Kaniras's user avatar
1 vote
1 answer
41 views

I am looking to create a SwiftUI layout that has one icon to the far left, two icons to the far right, and a fixed-width scrollable area for any number of icons in between: The issue I'm running into ...
dohpaz42's user avatar
  • 530
1 vote
2 answers
667 views

I've implemented a left aligned flow layout using the new iOS 16 Layout protocol, and I'm using it to add two lists of items to a ScrollView as follows: let people = ["Albert", "Bernard&...
Ashley Mills's user avatar
  • 53.6k
1 vote
1 answer
545 views

I want to center a TextField, which is in a VStack, to the center of the main view / screen. I tried everything I could think of. But no matter what I do SwiftUI is centering the whole VStack and not ...
Nick Sorge's user avatar
2 votes
1 answer
3k views

In SwiftUI I currently have a VStack of views, and I'd like to put an overlay over the bottom two views, like this: VStack { Spacer() Group { centerView Spacer() } .overlay(...
wristbands's user avatar
  • 1,427
4 votes
1 answer
2k views

Items inside a SwiftUI LazyVGrid shrink to their minWidth (80 points in my example below) when the grid view expands enough to fit another column. This is visually expected when there are multiple ...
jeff-h's user avatar
  • 2,689
1 vote
0 answers
239 views

I've been working on a GridView with programmatical scroll support, I've been using ScrollViewReader to programmatically scroll to the top & bottom of the GridView, but I have a trouble, I added ...
Hirose Maverick's user avatar
1 vote
1 answer
478 views

I've set the spacing on the LazyHGrid and the GridItems to 0, yet there is still spacing in the vertical direction. Why is that? How do I eliminate that spacing? struct ContentView: View { ...
Rob N's user avatar
  • 16.7k
1 vote
0 answers
633 views

I was looking for some built in functionality in SwiftUI for building a table with named columns in iOS. There appears to be a Table Function but it only works for macOS. Would the best way be to use ...
Petesta's user avatar
  • 1,785
5 votes
1 answer
3k views

Basically what Im trying to achieve is this: To fade an image out from the top to bottom. I tried to do it with overlays but it simply does not look good
Just A Question's user avatar
2 votes
1 answer
2k views

What Im trying to achieve is to have a segmented picker inside the navigation bar, but below the title of the navigation bar while still having the collapse animation. For example instead of the ...
Just A Question's user avatar
0 votes
0 answers
1k views

If you have something like this. You'll see that the bottom views rectangle 1 and rectangle 2 are aligned with one another. HStack(spacing: 0) { Rectangle() .fill(...
Petesta's user avatar
  • 1,785
3 votes
1 answer
292 views

I have the following code which produces the following output. var body: some View { VStack(spacing: 0) { HStack(spacing: 0) { Rectangle() ....
Petesta's user avatar
  • 1,785
4 votes
0 answers
882 views

I have a LazyVGrid that displays search results, as I type characters in the search field, I perform CoreData fetch requests and update a @Published property. Problem: LazyVGrid updates results as ...
Kuringan's user avatar
  • 147
0 votes
1 answer
121 views

In the following code snippet, the red circles obviously don't fit onto the screen and therefore only the trailing part of the HStack is shown. Instead of that behavior, I want the leading text of the ...
Isaak's user avatar
  • 1,379
0 votes
1 answer
74 views

I have imported JSON for countries: Countries.json (sample) [ { display_name: "France", timezone: "placeholder", longitude: 13.33, ...
mitchellOcavoos's user avatar
3 votes
2 answers
8k views

I’m trying to position a circle to have its center sitting on top of a rectangle like this. The diameter of the circle doesn't have to be the same width as the rectangle. What I’m trying to ...
Petesta's user avatar
  • 1,785
3 votes
0 answers
2k views

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 ...
Petesta's user avatar
  • 1,785
2 votes
3 answers
2k views

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 ...
Petesta's user avatar
  • 1,785
2 votes
2 answers
2k views

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 ...
wristbands's user avatar
  • 1,427