Yesterday I managed to create a SwiftUI navigation that was deselecting List row when returning from the subview. Today I updated Xcode to 12.5 and my row deselection code is not is not working any more.
So here is in it's simplest form, code that yesterday was deselecting row in the List after I returned back from the subview. When MostPopularView is disappearing it updates selectedArticle @State property to nil and that's all.
Any ideas why it's broken now? I couldn't find any updates in release notes regarding this.
So here is in it's simplest form, code that yesterday was deselecting row in the List after I returned back from the subview. When MostPopularView is disappearing it updates selectedArticle @State property to nil and that's all.
Any ideas why it's broken now? I couldn't find any updates in release notes regarding this.
Code Block swift struct MostPopularView: View { @State private var selectedArticle: MostPopularArticle? var body: some View { List(mostPopularViewModel.articles, id: \.self, selection: $selectedArticle) { article in NavigationLink( destination: ArticleView(article: article), label: { ArticleListItem(article: article) }) } .onDisappear(perform: deselectRow) } private func deselectRow() { self.selectedArticle = nil } }