Skip to main content
1 vote
2 answers
57 views

In SwiftUI, what's the best way to anchor one view to the containers center, while anchoring an additional view to its edge?

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

HStack Move Only One Item in Scroll SwiftUI

I am trying to create a horizontal scroll view in SwiftUI where I can move only one item at a time, and I want to maintain the proportions of the peeking view (i.e., the portion of the item that ...
Moran's user avatar
  • 15
0 votes
0 answers
70 views

How to change apps color via ContentView() and @MainView using ZStack inside TabView()?

this is my ContentView() struct ContentView: View { @State private var selectedTab: Tab = .view1 var body: some View { NavigationView{ ZStack{ Color(.green) ...
kislay p's user avatar
0 votes
0 answers
21 views

SwiftUI Create the infinite scrolling using ZStack [duplicate]

I have implemented the scrolling ZStack and handling the offset modifier to place the content as such, so that each element shows in linear way. Please check the below code for more information. ...
Ramkrishna Sharma's user avatar
1 vote
1 answer
73 views

Why does LinearGradient() fail to work in a ZStack > NavigationStack?

I am new to SwiftUI and hoping to understand why LinearGradient() is not working when applied to a ZStack, followed by a NavigationStack. Any guidance would be appreciated! var body: some View { ...
FightingWombat's user avatar
0 votes
1 answer
59 views

SwiftUI: Dynamic Label and Image adjust

We have vertically aligned multiple labels and top tight Image is align to first label. If first label has not enough content then second label will be move up and vice versa. image height will be ...
Vishal Desai's user avatar
0 votes
1 answer
503 views

Conditionally show text on top of an image

I want to display a list of images. Each image have an associated text, and I want to display that text like a "popover" in style (but how it is achieved is not important - it doesn't have ...
Per Lindgren's user avatar
0 votes
1 answer
1k views

Content in a full-screen ZStack not centering as expected

Consider the following (in a landscape-only app): struct ContentView: View { var body: some View { ZStack { Rectangle() .foregroundColor(.blue) .frame(width: UIScreen....
soleil's user avatar
  • 13.2k
2 votes
2 answers
1k views

How to position a button in lower right of screen in SwiftUI

Consider the following view: var body: some View { GeometryReader { geo in ZStack { HStack(spacing: 0) { VStack { Text("...
soleil's user avatar
  • 13.2k
0 votes
1 answer
299 views

Applying ClipShape in SwiftUI Modifies Frame Of Clipped View

Lets say in SwiftUI we have a problem where we want a View that consists of: An overall frame of reference in the form of an aspect ratio (the View will always have this aspect ratio) A basic (or ...
Nerdy Bunz's user avatar
  • 7,556
3 votes
3 answers
491 views

Moving an image over a sheet SwiftUI

In a screen design, I am showing a sheet from the bottom, and in this section I want to move an image above the sheet part. In this part, when I move it up with offset, it only remains in the sheet, ...
Tayfun Sağdıç's user avatar
0 votes
1 answer
86 views

ScrollView affecting the Views inside Geometry Reader

Main Content View: struct ContentView: View { @State var editing: Bool = false @State var inputText: String = "" @State var vOffset: CGFloat = 0 @State var hOffset: ...
Ios Dev's user avatar
1 vote
2 answers
106 views

Understanding Reference Frame of View Composed of Rotated Objects in SwiftUI

I'm following this SwiftUI tutorial and encountered an issue with the positioning of badgeSymbols in Badge.swift. Here's the relevant code: Badge.swift: (where the repositioning is applied) import ...
Nerdy Bunz's user avatar
  • 7,556
1 vote
2 answers
1k views

Layout a view's vertical position inside Zstack in SwiftUI

I'm facing some challenges to layout this prototype in SwiftUI. I used ZStack to layout the views. But my main problem is to position the profile image view's first half on the top the red background ...
Poles's user avatar
  • 3,682
0 votes
0 answers
40 views

Take over TabView's view but keep the tabs visible

When someone clicks on Notification, I want to show a view. However, I still want tabs visible at the bottom of the screen so they can go back to whatever tab they want. I tried adding invisible ...
Student's user avatar
  • 89

15 30 50 per page