Skip to main content

All Questions

Tagged with
-1 votes
1 answer
80 views

Issues updating an element inside a struct within an array using a toggle in swiftui

Hi I'm a beginner coder in Swift and SwiftUI so I'm pretty sure this problem is due to a fundamental misunderstanding of what I'm doing. I'm trying to use a toggle to update a bool element of a struct ...
Ange McAuslan's user avatar
0 votes
1 answer
58 views

Unable to add object to array

I'm trying to copy an object from an array, into another array. I've attempted using append, but the array size remains at 0. I've also tried using insert, but that also is not working for me. I ...
CocaCola's user avatar
  • 773
0 votes
0 answers
21 views

How to force a view to only be landscape orientation?

I would like to lock this view to landscape orientation. I mean that I want my view to be just in landscape. I will use this view as navigation link. struct ContentView: View { private let timer = ...
Khalid Samim's user avatar
1 vote
1 answer
113 views

Why is ForEach/List working only for some Arrays?

I have a SwiftData Model and recently added a new Array which is holding "Sections" as Strings. No matter what I try I can't make Swift to go trough this Array in any way using ForEach, For ...
Sphere's user avatar
  • 27
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 ...
lokredi's user avatar
  • 15
0 votes
1 answer
44 views

When I select a button its position changes, why?

Code: I just want tick on selected button view and need that selected button schoolCode but my code i got check mark also and selected button code also but if i select button its position changes.. if ...
Swift's user avatar
  • 1,180
1 vote
1 answer
39 views

How Can I Show Other Screen After The 5th Content Of ForEach

first of all I have a premium subscription, what I want to archive is that in the first 3 content of foreach I want user the see content without any problems but when they click on the 4th content I ...
AlTheBeast's user avatar
0 votes
1 answer
262 views

SwiftUI Mapkit: How to reference values from an array for markers?

I am a beginner, and I have a programming-related question: I have an array mit values for markers, which I want to present an a map. The market is shown, so no problem. But: I don't arrive in using ...
Champagne777's user avatar
-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: ...
Victor Vaknin Otte Hansen's user avatar
0 votes
1 answer
171 views

SwiftData not refreshing with Array

I have a SwiftUI + SwiftData project where I'm displaying a list of pet allergies in my HealthInformationView. From this View, I can open another one to add new allergies, as well as delete some. Here'...
Jintae's user avatar
  • 53
-1 votes
1 answer
95 views

Boolean inside ObservableObject Array does not trigger re-render

In my current project, i am having a hard time getting SwiftUI to recognize a change in a nested ObservableObject, here a demo / debug code import SwiftUI import SwiftData class Collection: ...
blendstylez's user avatar
0 votes
2 answers
42 views

Problem with the way the .suffix works with SwiftData

Ok, I have a subview, which should just show 2 last readings... I understand, that I can actually do .last and or just do $0 and $1, but I wanted to do it in an elegant way, so my code is: import ...
Roman R's user avatar
  • 45
1 vote
1 answer
36 views

Value of type '[ListB]' has no member 'books' error

I'm getting an error "Value of type '[ListB]' has no member 'books'" from func below on line "books = hardfictList.books" below func fetchAPIDataTop100FHC() { let ...
user1233894's user avatar
  • 1,776
-1 votes
1 answer
62 views

Unable to show all array items in out put in swiftui

Code: here i am getting correct number in filteredModuel array but it showing only arrays last item in contentView why? where am i wrong? how to fix. struct SearchView: View { @State private var ...
Swift's user avatar
  • 1,180
0 votes
1 answer
42 views

Unable to get filter data in hierarchal way while searching a word in SwiftUI

This is my API response structure in postman { "errorCode": 0, "status": "ok", "message": "App Layout", "menus": [ { "menuID&...
Swift's user avatar
  • 1,180

15 30 50 per page
1
2 3 4 5
38