I faced issue that SwiftUI ScrollView doesn't update scrollPosition(id:) when the user taps on the status bar and the ScrollView scrolls to the top. Are there any potential native SwiftUI solutions available? Thanks.

ScrollViewReader { _ in
        ScrollView(.vertical) {
            LazyVStack(spacing: 0) {
                ForEach(viewModel.items) { item in
                    Row(viewModel: viewModel, item: item)
                        .equatable()
                        .frame(maxWidth: .infinity)
                        .frame(height: geometryProxy.size.height)
                        .id(item)
                }
            }
            .scrollTargetLayout()
        }
        .scrollIndicators(.hidden)
        .scrollTargetBehavior(.paging)
        .scrollPosition(id: $viewModel.currentItem) // It isn't updating. 
    }
0

There are 0 best solutions below