Open DigitalVanilla opened 1 year ago
Hi, have you tried using Multivalued Sections? There is an example in the example project and in the README. That is the case for which Eureka has reordering implemented.
If that doesn't suit your needs you could override these delegate functions in your FormViewController subclass:
open func tableView(_ tableView: UITableView, canMoveRowAt indexPath: IndexPath) -> Bool
open func tableView(_ tableView: UITableView, targetIndexPathForMoveFromRowAt sourceIndexPath: IndexPath, toProposedIndexPath proposedDestinationIndexPath: IndexPath) -> IndexPath
open func tableView(_ tableView: UITableView, moveRowAt sourceIndexPath: IndexPath, to destinationIndexPath: IndexPath)
They are implemented in Core.swift from line 873, if you need some guidance
Yeah, unfortunately I cannot use the Multivalued Sections because we need to move sections itself using a single row as "fake header" to rearrange; unfortunately Apple never gave us the ability to actually drag'n drop an entire section
Hello
I needed to rearrange sections and rows programmatically and with drag'/drop functionality, but I did hit a small problem when I want to cycle again the form to get the data in the order after operations like move(fromOffsets: [0], toOffset: 2), but Im getting the same initial order and not the updated one.
My code:
then I move the first section below the second like:
form.move(fromOffsets: [0], toOffset: 2)
then I wish to see the order of the section tags:
print(self.form.allSections.map({ section in return section.tag }))
but Im getting always ["anchor_1", "anchor_2"] where I was expecting ["anchor_2", "anchor_1"]; and this is the same for the rows that I try to move using the native drag delegate, where visually I see the change in the order after the drop but if I cycle the section rows with allRows I get the same initial order. What am I missing?
Thanks