All Questions
63 questions
0
votes
0
answers
57
views
Why I am getting an empty array?
I want to transfer all the data which is in Detail Page to the Cart Page which is tableView. My main question is that in the CartScreen page an array is still empty even if in Detail Screen I pressed ...
0
votes
2
answers
88
views
Create table view section from a data model from a JSON file
I have parsed a JSON file and now I am trying to create a table view with a section. The section is a dictionary inside the data model.
import Foundation
struct ActionResult: Codable {
let data: [...
2
votes
1
answer
402
views
How to append elements into an array from another View Controller in Swift
Hello guys I have a question about append a new element into an array everytime i pressed a button. I have two View Controllers, the first one "RegisterViewController", that contains a ...
0
votes
1
answer
163
views
changing the background image of first cell of the table
I created a score board using table view and I want to highlight the first row of the table. When I run the app, the first row is highlighted as expected but when I scroll the table, several cell is ...
2
votes
1
answer
75
views
Change values in dictionary based on which cell selected in TableView
When clicking a cell from the tableView, the cells data (fetched from an array) gets passed on to the 'Detail View Controller' to be displayed in labels. When pressing edit on the Detailview, data ...
1
vote
0
answers
39
views
How can I partition a [String] into a specified number of equal parts in Swift? [duplicate]
Edit: I am not looking for a way to split an array by giving its subarray size, I am looking for a way to split an array by giving the number of subarrays I want. I am saying this because the question ...
1
vote
1
answer
5k
views
Cannot convert value of type 'Int' to expected argument type 'Dictionary.Index'
i am getting the error "Cannot convert value of type 'Int' to expected argument type 'Dictionary.Index'" at lines 8 & 9 ("let k" & "for y in")
var namesDictionary ...
1
vote
1
answer
70
views
How to use a node under a user's node to create a list?
I am trying to create two tables with a segmented button that toggles between two. I currently have the code to toggle the visibility of the two tables. I am using firebase and want to be able to ...
0
votes
1
answer
286
views
Swift, fetch TableView from JSON and save it into array
i'm trying to do some simple things here, but i'm struggling a bit as i'm a beginner.
So basically i have a JSON file link to use to populate my tableview with 2 sections. Each cell have a "...
0
votes
1
answer
383
views
How to sort my array in my tableview by Date
I am trying to return the following cells sorted by date. I have searched many posts but I can't really understand where I specifically put the sort by:
let sortedArray = jogs.sorted { $0.jogDate <...
0
votes
2
answers
103
views
How can I have different rows in a fixed number of sections?
I am having trouble and can't figure out how I can have a different number of rows in each sections of a TableViewController. Moreover, could you show me how I can access them ?
I don't understand ...
0
votes
1
answer
110
views
SWIFT Array of HealthKt Samples divided up into Array groups by date then shown on UITableView
Could I please have some help making a table with section headers that are the days of the week, Starting with the current day, eg. If today is Saturday then Saturday is the first section head, and ...
0
votes
1
answer
324
views
how to move a table view cell from one table view to a new table view
Currently, I am trying to move a tableview cell from one table view to another. I can't seem to get the proper mechanics down and need help with this task.
Right now I have an array that is not ...
0
votes
1
answer
254
views
Remove item from array in UITableview
What I'm trying to accomplish is when user selects an element for UITableView this element gets append to servicioSeleccionadoarray. But I'm stuck in this because if user decides to deselect the cell ...
0
votes
0
answers
29
views
Trying to populate an array from a text file
I'm using xcode, swift 5.0.
I have a multidimensional array for a tableViewController to give a list with different sections.
I would like for the array to be taken from a text file which is stored ...