struct FaqView: View {
let faq: Faq
let navigationBarCtaType: SettingsNavigationCTAType
private let style = AppStyles.Settings()
@State private var expandedIds: Set<String> = Set()
func expanded(id: String) -> Binding<Bool> {
Binding(get: { expandedIds.contains(id) },
set: {
if $0 {
expandedIds.insert(id)
} else {
expandedIds.remove(id)
}
})
}
var body: some View {
List {
ForEach(faq.content) { section in
DisclosureGroup(isExpanded: expanded(id: section.id)) {
ForEach(section.questions) { question in
DisclosureGroup(isExpanded: expanded(id: question.id)) {
VStack { // Hoped this would help but it doesn't
Markdown(question.answer)
}
} label: {
Text(question.title)
}
}
} label: {
Text(section.title)
}
}
}
.listStyle(.plain)
}
}
By default, all disclosure groups are not expanded.
Mardown:
# Alors
## Dites
### moi
**Bold me**
*Ça geht's mol ?*
> Quote me [Link me](https://google.com) ![George]
(https://framapiaf.s3.framasoft.org/framapiaf/accounts/avatars/000/056/593/original/3dc8059101ae9d9e.jpg)
Long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long line.
Scenario
navigate to this view
expand first level (section)
expand second level (question)
Result
Expected
Comments
When closing then expanding again, the display is correct.
Setup
SwiftUI view:
By default, all disclosure groups are not expanded.
Mardown:
Scenario
Result
Expected
Comments
When closing then expanding again, the display is correct.