Post

Replies

Boosts

Views

Activity

Reply to Swift UI on iOS 14 not assigning new object to @State property
Unfortunately the bug still there, I am working in Xcode 13.1 (13A1030d) and a @State property reminds being nil in this code: struct ContentView: View {   @State private var showDetailView = false   @State private var selectedArticle: Article?      var body: some View {     NavigationView {       List(articles) { article in         ArticleRow(article: article)           .onTapGesture {             self.showDetailView = true             self.selectedArticle = article           }       }       .sheet(isPresented: self.$showDetailView) { // The self.selectedArticle property is nil         if let selectedArticle = self.selectedArticle {           ArticleDetailView(article: selectedArticle)         }       }       .navigationBarTitle("Your Reading")     }   } } I could use the .sheet(item...) but I can storage a @State property and I don't know what is happening.
Nov ’21