Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Michael McKenna
3,451 PointsHow would I go about creating collapsable/expandable cells in Swift? (Also referred to as an accordion)
This tutorial https://www.youtube.com/watch?v=VWgr_wNtGPM is probably the closest I've got to finding what I want. It looks like his only works if the items under the cells will be the same everytime, so what would I do if I have different items underneath the cells? For example, under cell 1 there's a couple text boxes, then under cell 2 there is an image.
1 Answer
Michael McKenna
3,451 PointsThanks Dylan, I went ahead and found something using the stack view that allows me to expand/collapse the cells. To have multiple cells I just made a custom cell for each one so I had four in total
Dylan Shine
17,565 PointsDylan Shine
17,565 PointsIf you're open to using a 3rd party module, check out my companies implementation https://github.com/fuzz-productions/FZAccordionTableView. It's open source so feel free to use!