All Questions
97 questions
0
votes
1
answer
67
views
SwiftUI DragGesture stops responding when removing the last item in a row of a 2D array mid-gesture
I’m building a SwiftUI view with draggable items organized in a 2D array (array of arrays). I want to allow items to be moved between rows while dragging, specifically moving the item mid-gesture once ...
-5
votes
2
answers
179
views
Array showing incorrect data in SwiftUI sheet
Here's the code
import SwiftUI
struct MyView: View {
@State private var Items = ["Apple", "Microsoft", "Google"]
@State private var presentSheet = Bool()
var body: ...
3
votes
1
answer
788
views
VStack inside ForEach inside Array[Views]
Getting Array size = 1 but i am adding 4 objects in it which is showing.
In SwiftUI i am putting VStack inside ForEach loop in an Array containing views. which using above data creating only 1 step ...
-2
votes
1
answer
93
views
How to group Environmental object (Array of Dictionaries) in SwiftUI
I am trying to display a group of sections in List SwiftUI.
Below is my code
ContentView.Swift file
struct ContentView: View {
@EnvironmentObject var appData: FoodItemData
@State private var ...
0
votes
1
answer
36
views
How to get a checkmark for one element
struct TimeZoneView: View {
@State private var favorite = false
@State private var timezone: String = ""
private var timeZoneIdentifiers = TimeZone.knownTimeZoneIdentifiers
...
1
vote
0
answers
362
views
SwiftUI: @State doesn't trigger onChange when removing last item from variable
I'm running into what I think is weird behaviour, would appreciate some help.
In the code below (shortened with ... for readability), you will see that when .append() or .remove() is called, the ...
0
votes
0
answers
121
views
SwiftUI adding animations to dynamic List
I have the groundwork laid for an orderable nested list in SwiftUI. I am trying to add animations to the disclosure group lookalike items, however I can only get them to fade in and out with the ...
0
votes
2
answers
324
views
Swift/SwiftUI Trying to pass array from one view to another, which is falsely flagged as being nil
I can't understand why my array (which I checked to ensure it isn't empty) is not being passed through to a view correctly.
ContentView receives the set of questions from MenuView, and once assigned ...
3
votes
0
answers
561
views
SwiftUI unusual crash: 'Invalid parameter not satisfying: !CGSizeEqualToSize(size, CGSizeZero)'
I have this unusual crash which happens completely randomly (like 1/10 times).
I have a View which contains various sections of products (list of products divided by sections), and sometimes if I try ...
0
votes
0
answers
63
views
SwiftUI problem with appended array in class where stocksData isn't showing custom stock in cartManager
My program works as follows, I add stock to stocksData and I add custom products to another array, when the pay function is called the stock.amount minuses the product depreciated amount.
My pay ...
1
vote
2
answers
473
views
Toggling from Picker to Image view causes an index out of range error in SwiftUI
I have a view that uses a button to toggle between a Picker and an Image that is a result of the Picker selection. When quickly toggling from the image to the Picker and immediately back, I get a ...
-1
votes
1
answer
216
views
SwiftUI : How can I change the index from a view and show the correct Text in another view?
I don't understand why my DetailView is showing the same Text. (gif below)
Indeed I implemented a method selectTheme in ContentView that should change the selectedIndex according to the index of the ...
0
votes
1
answer
92
views
Add rows from button press (nested array)
I am trying to add rows to a view as the user presses the add button. There are two buttons. One which adds a card and one which adds an expense inside the card. Im confident I have the code working ...
0
votes
1
answer
410
views
turn other toggles off in Swiftui
I'm new to swift and swiftUI, so probably done something obvious wrong, but I display a list of toggles. When one of these is turned on, I want the others to be turned off, so only one of the items ...
0
votes
1
answer
660
views
How to pass ForEach parameters to a SwiftUI views?
I am try to show three pages in SwiftUI, let's name them as:
TopGroup.swift (first level pages, here includes some main group of books)
SubGroup.swift (second level pages, here include some sub ...