Post

Replies

Boosts

Views

Activity

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
Reply to App sometimes crashes when inserting String into Set with assertion ELEMENT_TYPE_OF_SET_VIOLATES_HASHABLE_REQUIREMENTS
I miss something: relativePath may return nil you force unwrap, which could cause a crash scanErrorPaths.insert(path.relativePath(from: basePath)!) Could you try replacing by: guard let index = range(of: basePath, options: .anchored)?.upperBound else { return "" } and have relativePath return a String, not optional ?
Topic: Programming Languages SubTopic: Swift Tags:
Oct ’25
Reply to app to restriction student phone use in schools
My understanding, AFAIK: if iPhone belongs to the student, that should not be possible, (it would mean any app can get control of your iPhone, with all privacy and security issues it would raise) but if the iPhone is supervised, that should be possible. But likely too heavy constraint on users (and school). Get first look here: https://support.apple.com/en-us/102291#:~:text=If%20your%20iPhone%20or%20iPad%20is%20supervised%2C%20the%20organization%20that,need%20to%20check%20your%20settings.
Oct ’25