@@ -8,14 +8,14 @@ public struct CardStack<Direction, ID: Hashable, Data: RandomAccessCollection, C
88 private let direction : ( Double ) -> Direction ?
99 private let data : Data
1010 private let id : KeyPath < Data . Element , ID >
11- private let onSwipe : ( Direction ) -> ( )
11+ private let onSwipe : ( Data . Element , Direction ) -> ( )
1212 private let content : ( Data . Element , Direction ? , Bool ) -> Content
1313
1414 public init (
1515 direction: @escaping ( Double ) -> Direction ? ,
1616 data: Data ,
1717 id: KeyPath < Data . Element , ID > ,
18- onSwipe: @escaping ( Direction ) -> ( ) ,
18+ onSwipe: @escaping ( Data . Element , Direction ) -> ( ) ,
1919 @ViewBuilder content: @escaping ( Data . Element , Direction ? , Bool ) -> Content
2020 ) {
2121 self . direction = direction
@@ -45,8 +45,8 @@ public struct CardStack<Direction, ID: Hashable, Data: RandomAccessCollection, C
4545 direction: direction,
4646 isOnTop: relativeIndex == 0 ,
4747 onSwipe: { direction in
48+ self . onSwipe ( self . data [ index] , direction)
4849 self . currentIndex = self . data. index ( after: index)
49- self . onSwipe ( direction)
5050 } ,
5151 content: { direction in
5252 self . content ( self . data [ index] , direction, relativeIndex == 0 )
@@ -69,7 +69,7 @@ public extension CardStack where Data.Element: Identifiable, ID == Data.Element.
6969 init (
7070 direction: @escaping ( Double ) -> Direction ? ,
7171 data: Data ,
72- onSwipe: @escaping ( Direction ) -> ( ) ,
72+ onSwipe: @escaping ( Data . Element , Direction ) -> ( ) ,
7373 @ViewBuilder content: @escaping ( Data . Element , Direction ? , Bool ) -> Content
7474 ) {
7575 self . init (
@@ -88,7 +88,7 @@ public extension CardStack where Data.Element: Hashable, ID == Data.Element {
8888 init (
8989 direction: @escaping ( Double ) -> Direction ? ,
9090 data: Data ,
91- onSwipe: @escaping ( Direction ) -> ( ) ,
91+ onSwipe: @escaping ( Data . Element , Direction ) -> ( ) ,
9292 @ViewBuilder content: @escaping ( Data . Element , Direction ? , Bool ) -> Content
9393 ) {
9494 self . init (
0 commit comments