In app development, you often have the requirement for some kind of collapsible view. With the release of iOS 14 and Xcode 12, we will have the luxury of DisclosureGroup view elements to achieve that for us. But until its release — and for apps that need some backward compatibility — you have to provide your own custom solution for that.

In this article, I want to show you a simple approach to creating your own custom collapsible view in SwiftUI. Let’s get started!

Note: XCode 11.x, Swift 5.x, and iOS 13.x are required. It’s assumed you already have some knowledge about programming in Swift and SwiftUI, how to build apps, and implement your own views in them. This is not a tutorial to teach you the basics.

#programming #swift #ios #swiftui #mobile-development

How to Write Collapsible/Expandable Views for Your SwiftUI App
21.35 GEEK