Commit c5d4e470 authored by Apptek Studios's avatar Apptek Studios
Browse files

Refine API

parent e230a9bb
Showing with 5 additions and 5 deletions
+5 -5
......@@ -21,7 +21,7 @@ struct TableViewDragAndDropScreen: View
id: 0,
data: groupA,
dataID: \.self,
dragDropConfig: ASDragDropConfig(dataBinding: $groupA).enableReordering(shouldMoveItem: nil),
dragDropConfig: ASDragDropConfig(dataBinding: $groupA).enableReordering(),
onSwipeToDelete: { index, _, callback in
self.groupA.remove(at: index)
callback(true)
......@@ -38,7 +38,7 @@ struct TableViewDragAndDropScreen: View
id: 1,
data: groupB,
dataID: \.self,
dragDropConfig: ASDragDropConfig(dataBinding: $groupB).enableReordering(shouldMoveItem: nil),
dragDropConfig: ASDragDropConfig(dataBinding: $groupB).enableReordering(),
onSwipeToDelete: { index, _, callback in
self.groupB.remove(at: index)
callback(true)
......@@ -57,7 +57,7 @@ struct TableViewDragAndDropScreen: View
id: 0,
data: groupC,
dataID: \.self,
dragDropConfig: ASDragDropConfig(dataBinding: $groupC).enableReordering(shouldMoveItem: nil),
dragDropConfig: ASDragDropConfig(dataBinding: $groupC).enableReordering(),
onSwipeToDelete: { index, _, callback in
self.groupC.remove(at: index)
callback(true)
......@@ -73,7 +73,7 @@ struct TableViewDragAndDropScreen: View
id: 1,
data: groupD,
dataID: \.self,
dragDropConfig: ASDragDropConfig(dataBinding: $groupD).enableReordering(shouldMoveItem: nil),
dragDropConfig: ASDragDropConfig(dataBinding: $groupD).enableReordering(),
onSwipeToDelete: { index, _, callback in
self.groupD.remove(at: index)
callback(true)
......
......@@ -37,7 +37,7 @@ public extension ASDragDropConfig
self.dataBinding = dataBinding
}
func enableReordering(shouldMoveItem: ((_ sourceIndexPath: IndexPath, _ destinationIndexPath: IndexPath) -> Bool)?) -> Self
func enableReordering(shouldMoveItem: ((_ sourceIndexPath: IndexPath, _ destinationIndexPath: IndexPath) -> Bool)? = nil) -> Self
{
var this = self
this.dragEnabled = true
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment