80 questions
0
votes
1
answer
88
views
How to make a specific subtext of Text view tappable and open a popover
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!&...
0
votes
1
answer
65
views
Is it possible to have a list style input TextField stay frozen at the top while a list of data below it is able to scroll?
The following is a simplified version of a screen that is in my app:
From the following code:
import SwiftUI
struct HomeView: View
{
@State private var textFieldUserInput: String = ""
...
0
votes
1
answer
82
views
Controlling @State value from inside a function
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 ...
0
votes
1
answer
71
views
In SwiftUI how to refer to a "subclass -like" View struct as a variable, in View setup code?
I have a number of cute premade structs,
///Cute green flag icon
struct YahIcon: View {
var body: some View {
Image(systemName: "flag.checkered")
.symbolRenderingMode(...
0
votes
1
answer
188
views
Translucent background for fullScreenCover custom menu
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 ...
1
vote
0
answers
80
views
Overwrite Transition from outside in SwiftUI
I have a badge component with a built-in transition:
public struct BadgeView: View {
...
public var body: some View {
Text(stringValue)
.background(.red)
....
0
votes
1
answer
62
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 ...
1
vote
2
answers
350
views
Avoid Init with ViewBuilder
In my SwiftUI project, I have a view that includes some ViewBuilder code:
struct MyView<Content: View>: View {
var tag: Int
var label: String
var image: String
var disableReset: ...
1
vote
1
answer
94
views
Don't redraw some of the view structure
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: ...
0
votes
1
answer
2k
views
SwiftUI How to implement a custom dropdown menu like a Picker
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 ...
-2
votes
1
answer
311
views
Passing data through Navigationlink with custom views - SwiftUI
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 ...
1
vote
1
answer
825
views
Accessing values from a dictionary via a List selection in SwiftUI
I am thinking that this is probably quite simple to fix but I’ve not been able to find a solution so far.
I am trying to display a dictionary and allow the user to select an item so that I then have ...
1
vote
1
answer
434
views
What is the explanation of observing a constant data change in SwiftUI View
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:...
0
votes
1
answer
336
views
Dismissable popover in SwiftUI
I'm trying to make a list where each row can be clicked to show a popover, and from the popover, there is another button to open whatever url in default web browser.
Everything seems to work as is, ...
0
votes
1
answer
396
views
How do we constrain the layout of two Views to have the same position and size in SwiftUI?
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 ...