![]() Nowadays, even inexpensive desktop-replacement laptops and some gaming behemoths can last for more than eight hours on a single charge. Luckily, modern laptops are much more efficient than their predecessors. Who wants to make an urgent dash to a power outlet to rescue their laptop battery? That's no fun, especially if your family is working and learning from home these days in various corners of the house that may not have a convenient socket nearby. How to Set Up Two-Factor Authentication.How to Record the Screen on Your Windows PC or Mac.How to Convert YouTube Videos to MP3 Files.How to Save Money on Your Cell Phone Bill.How to Free Up Space on Your iPhone or iPad.How to Block Robotexts and Spam Messages.Return selectedItems?.contains(rowItem) = true struct RowSelectable: View var selectedItems: Set? RowSelectable(selectedItems: $selectedItems, rowItem: item) (An aside, Apple recommends that you mark property wrappers as private so as to reinforce their intended use locally.) private var selectedItems: Set? You'll need to change your wrapper to a Set, because you confirmed that you'll need to select a group of items. In my sample code I use a checkmark to illustrate whether a row is selected, but you could change this to suit your needs. I refer to this answer to a SO post titled " Select Multiple Items in a SwiftUI List".įrom this answer I generated code to select multiple items in a list. List(rows, id: \.self, selection: $selectKeeper) Īny ideas on how single click deselect can be made possible without rebuilding the selection mechanism?įor the record: XCode 13.2.1, macOS BigSur 11.6.2 Minimum Example: struct RowsView: View var selectKeeper: String? The only option to deselect the Cell is to CMD Click which is not very intuitive. On macOS, Single Click Selection of Cells is possible, but deselecting an already selected Cell doing the same does nothing. I'm developing a macOS App with a List View with selectable rows. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |