Questions tagged [swiftui]

SwiftUI is a way to build user interfaces across all Apple platforms. Build user interfaces for any Apple device using one set of tools and APIs. With a declarative Swift syntax that’s easy to read and natural to write, SwiftUI works seamlessly with Xcode design tools to keep your code and design perfectly in sync. Automatic support for Dynamic Type, Dark Mode, localization, and accessibility. Use this tag for questions about SwiftUI on any platform.

0 votes
0 answers
5 views

How can I handle an empty response through Alamofire .responseDecodable?

I am trying to handle a response made through Alamofire and I am trying to decode an empty response. The documentation states that for .responseDecodable "no empty responses unless allowed by the ...
user avatar
0 votes
0 answers
11 views

Enable Undo CoreData SwiftUI

Does anyone know how to have the Undo command in the menu bar enable when CoreData UndoManager has items to undo? Here’s what I’ve done: At app init I’m setting the Core Data PersistanceController ...
user avatar
  • 205
0 votes
0 answers
17 views

Mutable Binding.constant()?

I'm using a secondary init to pass a different set of values into my struct. The issue with this is that values is a generic binding but I need to format the Binding values before setting it. public ...
user avatar
  • 9,722
1 vote
0 answers
10 views

How to change the background behind the stack of sheets in SwiftUI?

How can I change the background here (black) to another color? I was playing around with an app called Honk, and they've set different backgrounds in some of their sections. I saw something on SO that ...
user avatar
-1 votes
1 answer
16 views

How do I create a certain number of TextFields based on User Input?

I want to create a certain amount of TextFields on a view based on the number the user inputs. For Example, if the user inputs 5 I would like to display 5 TextFields on the view. I was thinking about ...
user avatar
-1 votes
1 answer
45 views

How to compare array before removing its items in SwiftUI?

How can i compare original items of an array before i remove them? I have an array of items that get removed every time they are showed and get added into the empty array... to avoid index out of ...
user avatar
0 votes
1 answer
26 views

How to call data from firebase synchronously

I have a function that calls data from my Firebase Database, but it is an async function, and messing up the other functions of my app. I have looked all around tutorials but they only show asyncronus ...
user avatar
  • 1
1 vote
1 answer
19 views

View shifts downward upon navigation link in Swift

I am having a weird issue when I try to navigate back and forth between different views. On WelcomePage, when the user clicks sign in, they are directed to HomePage. HomePage has a navigation bar. ...
user avatar
  • 13
-1 votes
1 answer
19 views

How to make the space between views grow when given a large frame, but be as small as possible otherwise?

I would like to create a SwiftUI layout with two horizontal views that are next to each other like follows. // MyView() | [A B] | If the consumer of my View gives it a large frame, I'd ...
user avatar
  • 1,597
0 votes
0 answers
11 views

Picker in Menu with Section and Label doesn't work

The following code shows different Pickers. I want to achieve: MenuPickerStyle with Sections and custom Label When doing it with the Menu container as recommended in the internet the rows are grayed ...
user avatar
  • 127
0 votes
0 answers
36 views

How do I filter an nested array of objects in SwiftUI?

The following model shows a nested struct. The struct subject has an array of units, which in turn each units has an array of outcomes. The idea is that some outcomes belong to specific unit. When I ...
user avatar
  • 43
0 votes
0 answers
17 views

Open URL Scheme through Widget Tap (iOS 16 Widget Kit)

Here is the code I currently have however, it does not seem to be working. This example says I want to open the calc app. My goal is to open an app once a widget is clicked. @main App Code: var body: ...
user avatar
-1 votes
1 answer
31 views

How to make a toggle that triggers a alert in swift?

I tried to fix it and I looked at the other questions but I couldn’t find any good answers. import SwiftUI struct ContentView: View { @State private var showGreeting = true @State private var ...
user avatar
0 votes
0 answers
19 views

SwiftUI Mismatching Types When Returning View

Why is it in SwiftUI that the following if-else check works as expected but the ?: syntax give errors: // THIS WORKS if value == true { Text("2") } else { ...
user avatar
  • 865
0 votes
0 answers
20 views

how can i click twice on the icon of tabview (home ) to get me to the to the parent view

i have a lot of navigation link inside the homeview when i click to other icon of tabview and go back to homeview it show me the last view that i leave so i want to add something like click two times ...
user avatar

15 30 50 per page
1
2 3 4 5
1851