SwiftUI Hierarchy List

New in iOS 14 is the ability to easily create hierarchical lists using SwiftUI's List view type. Given a recursive data model that contains optional children of the same type as the parent, a List will display a tree-like structure with expandable rows. In this post, Federico Zanetello shows us how to implement our version of a hierarchical list, creating a custom type that is compatible with iOS 13. I like the approach Federico takes in his posts. Implementing our version of existing types and APIs is a great way of learning more about how the original versions work.