Skip to main content

All Questions

0 votes
0 answers
92 views

Change the selected item highlighted background color inside the ListView

How do I change the neon selected background color to something like red? I tried .tint and .listRowBackground but they aren't working. The only working solution is to change the accent color in ...
Donat Kabashi's user avatar
1 vote
1 answer
67 views

List cannot scroll vertically If hovered a List subview that needs to support horizontal scrolling

I have a List that contains some views, some of which need horizontal scrolling. It is important to note that none of the views require vertical scrolling. When my mouse hovers over the views that do ...
Binglei Ma's user avatar
1 vote
1 answer
54 views

How do I validate and modify a proposed selection in a list?

Context In a Mac (nb: NOT iOS) app, I have a complex OutlineView that is powered by SwiftUI's List and various embedded DisclosureGroups. Here's what it looks like: Question I need control over which ...
Bryan's user avatar
  • 5,847
0 votes
1 answer
115 views

SwiftUI .onMove modifier and .moveDisabled

I have a list in my view, which contains plenty of fruits. I want to move the fruit inside the list, except I don't want to move Banana. Here's my code: struct FruitsView: View { @State private ...
Harry CHOI's user avatar
0 votes
1 answer
63 views

Popover is not opening from a list of items in SwiftUI [duplicate]

I have a list of items and when user click on it, I need to show some content in .popover(). Model: struct Item: Identifiable { var id: String { UUID().uuidString } var name: String? var ...
Mahendra's user avatar
  • 8,934
1 vote
1 answer
44 views

Why do I get inconsistent animations in this list view?

I'm digging into the weeds of SwiftUI and learning about view Identity for the first time. When playing around with some code and following along with WWDC talks I'm hitting some confusing animations. ...
Charles Fiedler's user avatar
0 votes
1 answer
58 views

SwiftUI List Rendering More Cells than Necessary When Using a Custom Cell View

I am experimenting with SwiftUI and noticed unexpected behavior when using a custom view inside a List. Here’s the simplified code: import SwiftUI struct ContentView: View { var body: some View { ...
de.'s user avatar
  • 8,637
2 votes
2 answers
44 views

Using a single member of an array in both a bound and unbound way in ForEach in SwiftUI without using indices

Apologies because I'm new to SwiftUI - I have a class (Meal) that contains an array of objects of another class (Food). What I'm trying to achieve here is to be able to add foods and have that update ...
Moses Harding's user avatar
0 votes
1 answer
68 views

SwiftUI List/ScrollView x MapKit - Map adds gradient/material toolbar (navigation bar) and overrides its design

I'm working on iOS 17+ app in SwiftUI, which uses MapKit. MapKit's Map view adds a gradient/material view on Toolbar, which is presented on second and every next navigation. I would like to get the ...
GPH4PPY's user avatar
  • 107
3 votes
2 answers
203 views

SwiftUI: How to create different background colors for List sections?

I'm trying to achieve a specific UI design in SwiftUI where the bottom section of my List has a different background color than the top section. For example, the "Your Medications" Section ...
anol1258's user avatar
1 vote
0 answers
44 views

Quick scroll view: cannot stop scroll action from drag gesture

I have a scrollable list with a quick scroll view in an overlay allowing to rapidly move down the list (simplified here to be concise). It works as expected, and you can tap or drag on the quick ...
cheersmate's user avatar
  • 2,666
1 vote
1 answer
72 views

Cursor jumps to end when editing SwiftUI TextField on Binding

I have an editable list defined as: @Binding var ingredients: [Ingredient] ... NavigationView { VStack { List { ForEach($ingredients) { $ingredient in if ...
Adam Bowker's user avatar
0 votes
1 answer
72 views

impossible to add element into a list in swift

I am trying to build a list of View based on a list of Strings but xcode still complain about: No exact matches in reference to static method 'buildexpression' I wrote the code below into my view so I ...
Seb's user avatar
  • 3,225
0 votes
0 answers
85 views

How can I make a SwiftUI List load struct/view data lazily?

In WWDC 2020, Apple was very explicit that Lists always load content lazily. https://developer.apple.com/videos/play/wwdc2020/10031/?time=468 However, with a very simple example, we can clearly ...
John's user avatar
  • 1
0 votes
0 answers
129 views

SwiftUI: Problems creating a confirmation view for deleting from a List

I have a view with a List. When an item is deleted from the list I want to show a sheet to confirm that the user really wants to delete the item. In the view with the List, when the user deletes a row,...
perfopt's user avatar
  • 87

15 30 50 per page
1
2 3 4 5
40