Skip to main content

All Questions

Tagged with
0 votes
0 answers
20 views

Maintaining a stable scroll position when inserting items above in a ScrollView

As the title says, I am not sure how to properly build an inverted ScrollView where I can safely insert items above my data ("prepend") without everything jumping around. My current code is ...
mrousavy's user avatar
  • 1,147
1 vote
0 answers
11 views

SwiftUI List scrolls down unexpectedly when switching keyboard from default to decimalPad

In a SwiftUI List, when switching from a default keyboard to decimalPad keyboard, the List scrolls down unnecessarily and the focused textfield is hidden by keyboard. struct ListTextField: View { @...
arterzz's user avatar
  • 31
0 votes
2 answers
57 views

SwiftUI Menu in List only the Text is tappable

Problem: Adding Menu inside List but only the text(black area) is tappable not the entire row. The source code and resulting image are shown below. struct testMenuInList: View { var body: some ...
Kesu's user avatar
  • 1
0 votes
1 answer
221 views

Chatbot UI Like ChatGPT in iOS SwiftUI

I am working on a chatbot app and want to implement a chat interface similar to ChatGPT's UI. When a user sends a message: The previous messages should move out of view at the top. The user's latest ...
Maaz Siddiqui's user avatar
0 votes
1 answer
114 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
0 votes
1 answer
87 views

(SwiftUI) Segmented Picker in a pinned SectionHeader does not Update ScrollView ContentHeight as expected

Within a Scrollview, i am trying to have a pinned SectionHeader with a simple segmented PickerView, that can switch to two different item Stacks. One very long and one very short. This works fine, as ...
mlalty's user avatar
  • 43
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
0 votes
1 answer
101 views

onDelete Removing Wrong Entry

I have an array of transaction entries that are sorted by date. Adding and viewing entries works fine, but when deleting an entry, the wrong entry is removed. (No error messages are generated.) I ...
Galen Smith'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,231
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
0 votes
1 answer
121 views

SwiftUI list row view/view model not deinitialized when row is deleted

I'm having trouble to understand how SwiftUI manages List row views (and their associated view model) when a row is added and deleted from a list. In the little example below, the view model deinit() ...
swat's user avatar
  • 3
1 vote
1 answer
387 views

Dynamic List with textfield binding and focus state causes infinite loop on iOS 18

I have a perfectly working List, which contains dynamic data and a text field with a binding and focus state in one of the row. Since iOS 18, loading this list will cause an infinite loop at the first ...
Nonouf's user avatar
  • 398
0 votes
2 answers
600 views

SwiftUI edit mode is applicable if when EditButton is not called

I have the following situation: in SwiftUI you can use List's onMove and onDelete to reorder and delete items of an array. Swift even provides an EditButton which will force the environment editMode ...
Boyan Pavlov's user avatar

15 30 50 per page
1
2 3 4 5
23