3

I'd like to remove separate lines between rows. How to implement my custom style to do it?

struct CustomListStyle: ListStyle {
    static func _makeView<SelectionValue>(value: _GraphValue<_ListValue<CustomListStyle, SelectionValue>>, inputs: _ViewInputs) -> _ViewOutputs where SelectionValue : Hashable {
        // ???
    }

    static func _makeViewList<SelectionValue>(value: _GraphValue<_ListValue<CustomListStyle, SelectionValue>>, inputs: _ViewListInputs) -> _ViewListOutputs where SelectionValue : Hashable {
        // ???
    }
}

struct ListDemo: View {
    @State var list = ["Row 1", "Row 2"]

    var body: some View {
        List {
            ForEach(list, id: \.self) {
                Text($0)
            }
        }.listStyle(CustomListStyle())
    }
}

I know how to achieve this by calling UITableView.appearance().separatorStyle = .none but I'd like to know more about ListStyle protocol. What are _GraphValue or `_ViewInputs, _ViewOutputs?

Victor Kushnerov
  • 3,706
  • 27
  • 56

0 Answers0