22 questions
1
vote
2
answers
177
views
How to create a sortable and editable SwiftUI Table?
I want to create a sortable Table where each table cell is a TextField so that the cell contents can be edited.
Let's start with this unsortable Table that has only one column. In the real code, this ...
1
vote
2
answers
106
views
Determine the clicked column in a SwiftUI Table context menu?
NB: This question is about macOS, not iOS.
I have a multi-column SwiftUI Table. (Let's use Apple's official example, below.) In the ContextMenu modifier, I need to know which column was right-clicked ...
0
votes
1
answer
366
views
How do you set SwiftUI's Table column resizing behavior so that other columns are not affected on resize?
NB: This question concerns only macOS, not iOS
I have a large, 30-column Table that scrolls both vertically and horizontally on macOS.
When a user changes the width of a column in SwiftUI's Table by ...
0
votes
0
answers
29
views
SwiftUI Table memory consumption using Observable objects
I'm trying to implement a SwiftUI Table and users would be able to add/define items (rows) and properties (columns). I expect there to be large amounts of items. For persistence, I'm hoping to use ...
1
vote
1
answer
98
views
Trying to get a chart to appear as a row in a table is chosen
I have a table to display player stats on iPads (I have a makeshift grid view for iPhones). I really like the table, being sortable by different columns, and generally looking more elegant. I can also ...
2
votes
1
answer
674
views
How to Make a Paginated Grid with Vertical and Horizontal Dividers in SwiftUI
I was hoping to make a paginated grid view in SwiftUI with continues dividers both horizontal and vertical but have been having trouble doing so. This is what I want:
This is the best that I came up ...
0
votes
0
answers
38
views
SwiftUI table view not updated on selection change [duplicate]
I have implemented a tree view representing different types of objects. Details for these objects should be displayed in a tabbed table view. If I do select an object in the tree, the details of this ...
0
votes
0
answers
44
views
Poor performance of SWiftUI table animation when changing the number of elements in the source object
In my app, the sidebar contains data "filters" for the table. DetailView contains the table itself. When selecting items in the sidebar, there is a noticeable delay before the table is ...
1
vote
1
answer
330
views
How SwiftUI Table sorting work with multiple KeyPathComparator?
I am new to the Swift and the SwiftUI. Trying to understand how sorting works on SwiftUI Table view.
The following code does what I intend to do, but I am not able to understand how does it actually ...
0
votes
0
answers
56
views
Issues Using SwiftUI Table on iOS 16: "Argument type '[Person]' does not conform to expected type 'Decoder'"
I'm trying to use the new Table view in SwiftUI for iOS 16 to display a list of people with columns for their given name, family name, and email address. According to Apple's documentation, Table ...
1
vote
1
answer
274
views
text style/color in swiftui table
Table(studentRecords, selection: $selectedStudentID) {
TableColumn("First Name", value: \.firstName)
TableColumn("Last Name", value: \.lastName)
}
...
0
votes
1
answer
64
views
swiftui table view, No exact matches in call to initializer
I'm trying to set up selection in a swiftui table so that I can use the selection to navigate to a form view.
If I add selection to the table, I get the 'No exact matches in call to initializer' error....
0
votes
1
answer
121
views
Error in List or Table with Children only on MAC OS
I can see all the Items in the list that don’t have a parent, as expected, and I can display all those that have children. However, I encounter an error when attempting to compact anyone with children....
0
votes
1
answer
130
views
How to sort children items in Table?
Sorting of items in a hierarchical table does not work!
Model
struct File: Decodable {
/*File name (including relative path)*/
let name: String
/*File size (bytes)*/
let size: Int64 ...
2
votes
1
answer
796
views
In Table view, how do I customize the background color of a selected row?
I'm making a macOS app using SwiftUI. I have a Table view. I have selection enabled but I can't find any way to customize the selection color - it's always blue.
My table looks something like this:
...
3
votes
2
answers
356
views
How to remove insets and row separator from Table?
I am looking for a way to remove insets (and ideally row separators) in SwiftUI's Table.
Lists have:
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
and
.listRowSeparator(.hidden)
...
1
vote
0
answers
98
views
Why SwiftUI Table doesn‘t track changes in @Observable object?
I try to build Table with Observation framework but Table doesn't track changes in data. However, the List keeps track.
@Observable
final class Item: Identifiable {
var id: UUID
var value: Int
...
0
votes
3
answers
296
views
How to toggle Image on click within Table?
I want to display a table with a text and an image on each row. Clicking on the image should toggle the picture. The table is associated with an array of instances of a class, which has a boolean ...
0
votes
0
answers
207
views
How to create data tables with all columns displayed?
I just recently started learning SwiftUI and found that my table had only 1 column and not the remaining columns from my JSON data. Can anyone please suggest how to display all the columns for a data ...
4
votes
1
answer
1k
views
Sort SwiftData Query shown in SwiftUI Table on macOS
I have a mini macOS app, presenting some data persisted in SwiftData on a Table.
I want to sort the data by clicking on Table's column headers so I have a KeyPathComparator on the table.
But since the ...
0
votes
2
answers
634
views
How to display a List or Table without empty rows at bottom?
I'm looking for a way to display a SwiftUI Table or List at its "intrinsic size" without including empty rows or empty space below the rows, as it does in the following example, in which the ...
2
votes
1
answer
2k
views
Hide and show SwiftUI `Table` columns
I am using SwiftUI's Table to generate a table for a macOS app. I would like to be able to hide columns based on AppStorage entries. TableColumnBuilder doesn't appear to support conditional statements:...