diff --git a/Prose/ProseLib/Sources/ProseUI/CustomList.swift b/Prose/ProseLib/Sources/ProseUI/CustomList.swift index 83791532..b825c9e6 100644 --- a/Prose/ProseLib/Sources/ProseUI/CustomList.swift +++ b/Prose/ProseLib/Sources/ProseUI/CustomList.swift @@ -70,6 +70,41 @@ public struct CustomList: View { ) } + public init( + _ sections: IdentifiedArrayOf
, + elements: KeyPath>, + selection: Binding, + @ViewBuilder row: @escaping (Element) -> Row, + @ViewBuilder header: @escaping (Section) -> Header + ) where SelectionValue == Element.ID, + Content == ForEach< + IdentifiedArrayOf
, + Section.ID, + CustomListSection< + CustomListSectionHeader
, + SelectionValue, + BaseContent + > + > + { + self.init( + content: ForEach(sections, id: sections.id) { section in + CustomListSection( + header: CustomListSectionHeader { + header(section) + }, + content: CustomList>( + section[keyPath: elements], + selection: selection, + padding: 0, + row: row + ) + ) + }, + spacing: 16 + ) + } + public init( _ sections: IdentifiedArrayOf
, elements: KeyPath>,