Post

Replies

Boosts

Views

Activity

Reply to Crash with List using Observable Object
Hi,I'm answering a little bit late but at least people with the same problem will have an answer.I had the same problem today. This is generated by the fact that you are not giving your list a default content when tour files array is empty.Try doing this:List { if filesArray.files.isEmpty { emptySection } else { filesSection } }Then, outside of your body:var emptySection: some View { Section { Text("No files found") } } var filesSection: some View { Section { ForEach(filesArray.files) { file in NavigationLink(destination: MyDetailView(file: file) , label: { Text(file.filename ?? "") }) } } }You don't have to use the Section if you don't want to. Just remove it and leave the content.Hope this helps!
Dec ’19