Created a Feedback for this: FB13662883
Post
Replies
Boosts
Views
Activity
From what I can see of your code, when you pop back from a navigation link, your ContentView gets rebuilt. The first thing done in ContentView is to create new list data. So, you are creating a new List and since it is new, it has no "remembered" scroll position, so it seems to scroll to the top. The truth is, it has nothing else to display except from the top. In addition, none of your NavigationLink (item views) has an .id so the list has no way of tracking where you are, even if it was smart enough to track.
The new .scrollPosition($savedPosition) could help, but for some reason, it only seems to work with a ScrollView directly, and not within a container with an embedded ScrollView (i.e., `List).
So, some suggestions:
Do not create the data for your List inside your ContentView. Create it onAppear on within the init() and save it in a @State. The List should pick up where it left off (I haven't tried this with your example, but I think that's the standard behavior I've seen). Even if this doesn't work, the following suggestions should help (iOS 17+)...
Add .id(item) to your ``NavigationLink`. Let it be trackable!
Add a @State variable for savedPosition (of type String?) , change your List to a ScrollView { LazyVStack { ForEach { .... } } } and attach a .savedPosition to the ScrollView (iOS 17+):
ScrollView {
LazyVStack {
ForEach($items, id: \.self) {
NavigationLink {
Text(item)
} label: {
Text(item)
}
.id(item)
}
}
.scrollTargetLayout()
}
.scrollPosition($savedPosition)
I have finally figured this out!
It appears that submodule synchronization isn't always logical with git, and the two projects were not using the same build of Amber3Utils...
The most recent git commit used by the project that was getting the error had a change to the project file that may have had a hiccup during a (rather large) merge. The only changes to the project files were additions/removals of files. There were also other file modifications. There was nothing in the build settings that was modified from what I can see.
I reverted my most recent commit and reattempted to build. This time, I still had errors (the reverted changes undid some methods that my main project required), but none of the Deserialized errors. I then reassembled the reverted change by hand, forcing a rebuild of Amber3Utils and the entire project each time before staging a change. This took a bit of time, but it was doable. When all the changes were rebuilt, I had a git repository with the Amber3Utils subproject that no longer generated the error. Once I was satisfied that the new commit was safe and complete, I pushed it up to the origin and then reconfirmed that the project was able to build successfully.
For my other project, I ensured that all submodules were pulled from the most recent develop branches, and rebuilt. I then had both repositories able to compile without the Deserialized error.
Of course, this does not indicate why I was getting the errors during the import of the framework. It would be nice if somebody from the compiler team could explain what the error means, and what to look for when trying to diagnose the root cause. However, it should be useful to keep this message in the forum so that web search engines may give a clue to somebody else who encounters this problem.
I figured out for my specific project (created pre-Xcode 15) that in the run scheme, there was an environmental variable set OS_ACTIVITY_MODE set to "disable." I changed it to "enable" and the messages started to appear.