Skip to main content
Filter by
Sorted by
Tagged with
0 votes
1 answer
91 views

I have a long label that I want to make into a Text view. For example: "This is a really long text that is guaranteed to wrap around into 2 lines. There might be a solution. Click me to find out!&...
Raxa Vaxa's user avatar
0 votes
1 answer
83 views

Within a View, I'm calling a function that references some external objects and updates a chart. For the time when function is processing I would like to hide the chart and replace it with a ...
Konrad's user avatar
  • 18.8k
0 votes
1 answer
190 views

I need to make a transparent background when a menu opens. I press the button menu and I need to see a centre screen component with three menu items to choose and transparent background. This is my ...
SerjBets's user avatar
0 votes
1 answer
62 views

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
1 vote
1 answer
95 views

Consider the following code that draws a grid of randomly colored rectangles on the screen, with a Circle that moves to right by responding to a timer: struct ContentView: View { let width: ...
soleil's user avatar
  • 13.3k
-2 votes
1 answer
320 views

Im trying to pass two kinds of different JSON data in an app with two different views in two navigationlinks, what works One custom view which with the name LaundryList that gets passed in the ...
Jeria93's user avatar
1 vote
1 answer
436 views

When I study the SwiftUI Apprentice book of Kodeco, I come across the below code snippet. struct CountdownView: View { let date: Date @Binding var timeRemaining: Int let size: Double var body:...
ceylanburak's user avatar
0 votes
1 answer
403 views

I am a mildly experienced UIKit/AppKit developer, but I am just getting started using SwiftUI. In UIKit it is straight forward to constrain two UIView's to have the same size and position using ...
wcochran's user avatar
  • 11k
0 votes
0 answers
226 views

I'm new to Swift, trying to do a personal project and I currently am stuck at a thing for which I cannot find a resolution anywhere for the past week. This is the code: import SwiftUI struct ...
Ovidiu Manea's user avatar
0 votes
1 answer
726 views

I have a custom modifier on a SwiftUI View to pan and zoom an Image. I need to get the location where the user long presses. The modifier uses an UIView (UIViewRepresentable) under the hood where the ...
DeveloperSammy's user avatar
6 votes
3 answers
2k views

I have a NavigationView and the following view structure ViewA -> ViewB -> ViewC and I'm trying to figure out how to detect when ViewB goes back to ViewAViewB -> ViewA. Here is my Code: ...
user2924482's user avatar
  • 9,240
0 votes
1 answer
136 views

I have an animated background view which is a struct (the view) that instantiates a class. It represents stars animating and moving from right to left on the screen. The view (StarsView) is given a ...
DeveloperSammy's user avatar
2 votes
1 answer
133 views

Suppose I have the following protocol which conforms to View: protocol Foo: View { init(field: Binding<Bool>) } I then have two structs which conform to this protocol: struct BarView: Foo { ...
Pearse Moloney's user avatar
0 votes
1 answer
147 views

I have the following that I'm using for an input field where the user can enter an API token. By default it's presented as a SecureField, but the user can click the "eye" icon and change to ...
chasepeeler's user avatar
0 votes
1 answer
96 views

I have a VStack of views which serve to act as a list of expanding rows. As you tap on any row, it expands to show further details. So long as I only have one row "expanded" at a time, ...
RealCasually's user avatar
  • 3,613
1 vote
2 answers
385 views

I have got a piece of code below but the issue is the text field is positioned in the middle of the view and when I add spacers below to push the textfield to the top of the view, it doesn't get ...
Emere 's user avatar
  • 45
11 votes
0 answers
863 views

I came across a weird behaviour of SwiftUI's ForEach view. I've noticed that ForEach always initialize its child view twice as much as it should according to its repetition. Normally, when you render ...
Hollycene's user avatar
  • 627
2 votes
4 answers
2k views

I'm trying to get the navigation title vertically aligned with the back button in a NavigationDetail view in SwiftUI. Here's what this looks like currently: Below's my code for adding the Navigation ...
narner's user avatar
  • 3,221
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
1 vote
2 answers
2k views

I want to place an image either on top of, or between lines, depending on the position variable: struct ContentView: View { @State var position = 5 var body: some View { VStack(spacing: ...
Arvid's user avatar
  • 53
-2 votes
1 answer
447 views

I have SwiftUI view1, with its viewModel1. view1 has a child view view2 with viewModel2. How can I pass a data for viewModel2 to viewModel1? Thanks!
Tatiana Cooper's user avatar
1 vote
1 answer
2k views

The code works in that it brings up 5 random consonants and 2 vowels just like I want, but it is showing a warning message that "Modifying state during view update, this will cause undefined ...
Eric Putkonen's user avatar
1 vote
2 answers
6k views

I'm trying to align an image to the center of the screen in Swift/SwiftUI. GeometryReader { geometry in HStack { Spacer() Color.white ....
nai hamdan's user avatar
0 votes
1 answer
1k views

Im trying to show another view with SwiftUI, when a button is pressed. Here is what I am trying: import SwiftUI struct Home: View { var body: some View { VStack { Text(/*@...
WilliApple's user avatar
1 vote
1 answer
2k views

I'd like to display a number of values as a continuous value from 0 to 1. I'd like them to grow from the bottom up, from 0 displaying no value, to 1 displaying a full height. However, I'm unable to ...
Hoopes's user avatar
  • 4,245