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
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:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Oct ’25
Reply to Xcode 26.0.1 strange compile errors
Did you try a clean build folder. In my case, it cleared a lot of errors.
Replies
Boosts
Views
Activity
Oct ’25
Reply to [Beginner] Unsure if I need Foundation import, and how to auto-import it
Is there an easier way to get these imports to get automatically added when I select a type using Ctrl+Space? I don't think so; you probably have to add it at the right place. You can file a report asking for improvement.
Replies
Boosts
Views
Activity
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
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
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:
Replies
Boosts
Views
Activity
Oct ’25
Reply to openAppWhenRun = true is wrong
Could this help find out the solution ? https://www.createwithswift.com/integrating-app-intents-with-control-action/
Replies
Boosts
Views
Activity
Oct ’25
Reply to Help me
It is not possible to install iOS 17 on iPhone X.
Replies
Boosts
Views
Activity
Oct ’25
Reply to app to restriction student phone use in schools
If you ask for a user action, there may be some possibilities: https://support.apple.com/en-gb/guide/iphone/iph3ff83f3b1/ios But I do not see if white lists are possible or only black lists.
Replies
Boosts
Views
Activity
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.
Replies
Boosts
Views
Activity
Oct ’25
Reply to Beginner’s question on learning philosophy.
Welcome to the forum. I would advise you to learn and understand the basics, how it works and not look for already cooked solutions. A good way is to use pathways: https://developer.apple.com/pathways/
Replies
Boosts
Views
Activity
Oct ’25
Reply to ResignFirstResponder doesn't animate keyboard dismissal on iOS26
OK, noticed the difference in animation / no animation between the 2 OS versions. Is it a constraint due to liquid glass (would be bad news). Did you file a bug report, at least against documentation if that's on purpose ? Please note reference here.
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Oct ’25
Reply to ResignFirstResponder doesn't animate keyboard dismissal on iOS26
Which resign ? Line 34 or 38 ? On device or in simulator ? Could you add a log in both cases to check which is called ? I tested on simulators for iOS 18 and 26.0. In both cases, dismiss is called and hides keyboard shouldReturn is called in both cases when typing Return on keyboard
Topic: UI Frameworks SubTopic: UIKit
Replies
Boosts
Views
Activity
Oct ’25
Reply to Long hang in SwiftUI Dev
in SwiftUI Development? So is it in Preview ? In simulator ? On device ?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Replies
Boosts
Views
Activity
Oct ’25