Post

Replies

Boosts

Views

Activity

Reply to How are you supposed to test on earlier iOS versions if Xcode is incompatible with them?
Thanks, but Xcode 15.2 was more than sufficient to target any version of iOS 15. Per Apple: Xcode 15.2 includes SDKs for iOS 17.2, iPadOS 17.2, tvOS 17.2, watchOS 10.2, macOS Sonoma 14.2, and visionOS. The Xcode 15.2 release supports on-device debugging in iOS 12 and later I've since upped my target to iOS 17 so the problem is moot.
Mar ’25
Reply to popToRootViewController in SwiftUI
I ended up going with a combo: your enum idea, with an enum for the first view of each stack a user can invoke from the root view. So the path consists of one entry, tied to the bottom view of the stack I want to dismiss. I still use my NavPathController object to pass the path through all the views, so the last child can clear the path and collapse the whole stack back to the root.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to popToRootViewController in SwiftUI
I thought your enum idea was a clever workaround... but then I realized that I would have to add an enum for every child view of every child view to which the user needs to navigate. A maintenance hassle, to say the least. So yes, I will probably do something like what you suggest above. Feedback filed: FB16858715
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to popToRootViewController in SwiftUI
Thanks for the extensive response! My situation is #2. I don't use NavigationDestination, because most of my NavigationLinks are single-use ones invoked with a button, which go to a specific view to handle a certain task. In my application, the user is preparing a message to send to another user or contact. From the root view (where the NavigationStack is declared), the user goes through a series of screens to pick a message recipient and a communication method. Because each child view needs access to the NavigationPath, I enclose it in an object I can pass through the hierarchy (because I think environment variables are hokey): @Observable class NavPathController { var path: NavigationPath init() { path = NavigationPath() } func popOne() { path.removeLast() } func popAll() { path.removeLast(path.count) } } In my root view, I do: @State private var viewStack = NavPathController() var body: some View { NavigationStack(path: $viewStack.path) { NavigationLink(destination: UserFindingView(withMessage: theMessage, viewPathController: viewStack), label: { Text("Pick a recipient") }) ... } } and then each child view looks something like struct UserFindingView: View { private var theMessage: Message private var pathControl: NavPathController? init(withMessage: Message, viewPathController: NavPathController? = nil) { theMessage = withMessage self.pathControl = viewPathController } var body: some View { NavigationLink(destination: ContactsStartView(withMessage: theMessage, viewPathController: pathControl), label: { Text("Use your contacts...") }) } But as the user follows the NavigationLinks, nothing appears to be added to the path. At the end of the hierarchy (the topmost overlaid view), the path has zero elements. So... how does one address that?
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to popToRootViewController in SwiftUI
But this (like every example I can find) relies on a highly unlikely scenario: a stack of views that all take the same datatype. All the NavigationLinks go to a common NavigationDestination. Far more common than that are applications that involve completing something step-by-step. For example, filling out an order. The root view might be the order summary. Then the user proceeds through the customer-search view, the customer-detail view, an address-selection view... and now he's done with that part of the order and needs to dismiss that entire stack and return to the root. For that kind of situation, you don't use NavigationDestination. Your NavigationLinks invoke each view directly, passing each one whatever unique data that view needs. Nowhere (including in Apple's doc) have I seen an explanation of how NavigationPath gets populated in a realistic progression of disparate views. When do you add a path element? How is each element associated with a view? Nobody ever says.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Mar ’25
Reply to Generic parameter 'V' could not be inferred Xcode error Please help
In every case I've seen, this is a spurious error message caused by some syntax error buried within the view code. It can happen, for example, when you rename a function or member but still have a reference to the old name in SwiftUI code. In the code you posted, I'd suspect that some reference to something in LoginModel is wrong. You should file feedback with Apple on this, because it has been going on for years and wasting developers' time.
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Dec ’24
Reply to Private CA root certificate missing from trust settings
I just encountered this in iOS 18.0.1. I generated a CA and certs using mkcert, and I've been able to trust these on iOS in the past. Not on my new phone with 18.0.1. I can install the root CA on the phone (after AirDropping) without any apparent problem, but it's missing from Trust Settings. Since these worked on iPhones in the past, presumably it's not the "common name" bug. But how do we know if the CA has a "common name?"
Topic: Privacy & Security SubTopic: General Tags:
Oct ’24
Reply to log noise? : "NSPersistentUIDeleteItemAtFileURL blablabla"
I'm also having what may be a related problem: When building for "My Mac (designed for iPad)," Xcode does not overwrite previous builds. So you'll make a bunch of code changes and then re-run your app, only to see that your changes "didn't work." But that's because Xcode is still running the old code, wasting hours of your time. Right now you have to add a "clean build directory" step to every project if you want to run on Mac. I'm getting a bunch of error messages in the Xcode console, such as the one you mention here, along with: AX Safe category class 'SFUnifiedBarRegistrationAccessibility' was not found! CLIENT ERROR: TUINSRemoteViewController does not override -viewServiceDidTerminateWithError: and thus cannot react to catastrophic errors beyond logging them
May ’24