Skip to content

Commit 7a0ab86

Browse files
Fabezilkzhao
authored andcommitted
ComposedHeaderProvider tapHandler index fix (#83)
* fix tap index * Make ComposedHeader TapContext public
1 parent e5fbefa commit 7a0ab86

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Sources/Provider/ComposedHeaderProvider.swift

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ open class ComposedHeaderProvider<HeaderView: UIView>:
6161
public typealias TapHandler = (TapContext) -> Void
6262

6363
public struct TapContext {
64-
let view: HeaderView
65-
let index: Int
66-
let section: Provider
64+
public let view: HeaderView
65+
public let index: Int
66+
public let section: Provider
6767
}
6868

6969
private var stickyLayout: StickyLayout
@@ -132,7 +132,8 @@ open class ComposedHeaderProvider<HeaderView: UIView>:
132132

133133
public func didTap(view: UIView, at: Int) {
134134
if let tapHandler = tapHandler {
135-
let context = TapContext(view: view as! HeaderView, index: at, section: sections[at])
135+
let index = at / 2
136+
let context = TapContext(view: view as! HeaderView, index: index, section: sections[index])
136137
tapHandler(context)
137138
}
138139
}

0 commit comments

Comments
 (0)