I have a table view (picture attached) where I have a cell and its status(multiple).
When a user clicks the cell it expands show the status.
My question is what is the best approach to achieve this functionality, I don't feel like the one I have right is a good approach.
Right now when a user click I set a variable in didSelectRowAt and reload the cell. When I reload the cell I check the variable and add/remove subview.
I'm adding subview in a stackview like this:-
for _ in 1...4 {
let view = ActivityFeedStatusView()
let constraint = NSLayoutConstraint(item: view, attribute: .height, relatedBy: .equal,
toItem: nil, attribute: .height, multiplier: 1.0, constant: 70.0)
NSLayoutConstraint.activate([constraint])
stackview.addArrangedSubview(view)
}
As you can see it'll get added all the time cellForRowAt will be called plus It is also giving me constraint warning.
I'm open to any kind of feedback and suggestions, thank you for reading.
Note: This code is just a test code to generate and show view

