Post

Replies

Boosts

Views

Activity

Reply to SwiftUI state is maddening
Great feedback. One question: _dismiss is changed - for some reason - in ItemsListView, which causes the view to redraw, causing the List to redraw, causing every ItemRow to redraw, causing the confirmation dialog to disappear because the row it was attached to no longer exists. changed from what to what ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’25
Reply to SwiftUI state is maddening
I sympathise with you. 🥲 SwiftUI may be great in some aspects, but I often find that fine tuning to achieve a precise UI behaviour is a nightmare. When it is impossible to understand why SwiftUI reacts in a certain way, you end up spending enormous time just to turn around SwiftUI to mimic UIKit behaviour. Big sigh.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’25
Reply to List jumps back to the top
Why does SwiftUI think the data is different? Maybe it's not that it evaluates data has changed but just that it needs redraw (even only for dark mode switch). But I'm not expert enough in SwiftUI to be sure. That's an issue I find with SwiftUI, understanding and possibly controlling what it is doing in the back or find a workaround. I'm still much more comfortable with UIKit.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’25
Reply to List jumps back to the top
If that may help, I found this, but did not test, using ScrollViewReader, but you've probably found as well: Get the scroll position: https://stackoverflow.com/questions/62588015/get-the-current-scroll-position-of-a-swiftui-scrollview Set the scroll position (in .onAppear ?): https://www.hackingwithswift.com/quick-start/swiftui/how-to-scroll-to-a-specific-row-in-a-list Or would it be enough to set the selection when it exists ? https://stackoverflow.com/questions/74365665/force-deselection-of-row-in-swiftui-list-view/74368833#74368833
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Oct ’25
Reply to [Beginner] Unsure if I need Foundation import, and how to auto-import it
What happens if you ignore the warning ? What happens if you import Foundation at top of the file ? import Foundation not needed if for instance you already import UIKit Which version of Xcode ? If you use Xcode 26 (with Swift 6.1), you should check in your build settings the MemberImportVisibility flag. See details here: https://www.hackingwithswift.com/articles/276/whats-new-in-swift-6-1, reading Member import visibility
Oct ’25
Reply to App sometimes crashes when inserting String into Set with assertion ELEMENT_TYPE_OF_SET_VIOLATES_HASHABLE_REQUIREMENTS
I notice the exception is on: NativeSet.insertNew(_:at:isUnique:) + 376 (/:0) Looking at this thread: https://forums.swift.org/t/substring-violates-hashables-requirements-stdlib-compiler-bug/58046/7 I wonder if the compiler is not confused and considering you try to insert a substring. To make sure, could you try: let sub = self[index...] // a substring let theStr = String(sub) return if index == endIndex || basePath == "/" { theStr // String(self[index...]) // for sure, a String } else if let index = self[index...].range(of: "/", options: .anchored)?.upperBound { theStr // String(self[index...]) } else { nil } If that works, you should file a bug report.
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’25