I am trying to implement a UITableView with the following structure :
struct DataArray {
var mainsection : String
var titlecontent : String
var contentsection : [(question : String, answer : String)] = [(String, String)]()
}
var dataArray = [DataArrayArray]()
dataArray = [DataArray(mainsection : "Section 1","Section Title 1",[("question1","answer1"),("question2","answer2")]),
DataArray(mainsection : "Section 2","Section Title 2",[("question1","answer1"),("question2","answer2")])]
The TableView should look like this and when the user clicks Section 1 ->expand the subsection (SectionTitle1 & SectionTitle2); when user clicks SectionTitle1 -> expand the subsection(Question1 & Question 2); When the user again clicks Question1 -> show the answer :
Section 1
Section Title 1
Question 1
- Answer 1
Question 2
- Answer 2
Section 2
Section Title 1
Question 1
- Answer 1
Question 2
- Answer 2
Can anyone help me with this or any other solution to solve this?